maxio-advanced-billing-sdk 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +40 -40
- data/lib/advanced_billing/controllers/advance_invoice_controller.rb +6 -4
- data/lib/advanced_billing/controllers/base_controller.rb +1 -1
- data/lib/advanced_billing/controllers/components_controller.rb +9 -58
- data/lib/advanced_billing/controllers/coupons_controller.rb +6 -115
- data/lib/advanced_billing/controllers/custom_fields_controller.rb +4 -4
- data/lib/advanced_billing/controllers/events_based_billing_segments_controller.rb +5 -22
- data/lib/advanced_billing/controllers/insights_controller.rb +3 -4
- data/lib/advanced_billing/controllers/invoices_controller.rb +11 -0
- data/lib/advanced_billing/controllers/payment_profiles_controller.rb +26 -0
- data/lib/advanced_billing/controllers/product_families_controller.rb +5 -14
- data/lib/advanced_billing/controllers/product_price_points_controller.rb +3 -40
- data/lib/advanced_billing/controllers/products_controller.rb +5 -14
- data/lib/advanced_billing/controllers/subscription_components_controller.rb +16 -66
- data/lib/advanced_billing/controllers/subscription_group_invoice_account_controller.rb +5 -15
- data/lib/advanced_billing/controllers/subscription_groups_controller.rb +6 -6
- data/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb +13 -20
- data/lib/advanced_billing/controllers/subscriptions_controller.rb +49 -14
- data/lib/advanced_billing/models/ach_agreement.rb +10 -0
- data/lib/advanced_billing/models/address_change.rb +0 -22
- data/lib/advanced_billing/models/agreement_acceptance.rb +10 -0
- data/lib/advanced_billing/models/allocation.rb +1 -3
- data/lib/advanced_billing/models/applied_credit_note_data.rb +10 -0
- data/lib/advanced_billing/models/apply_credit_note_event.rb +139 -0
- data/lib/advanced_billing/models/apply_credit_note_event_data.rb +3 -1
- data/lib/advanced_billing/models/apply_debit_note_event.rb +139 -0
- data/lib/advanced_billing/models/apply_debit_note_event_data.rb +36 -2
- data/lib/advanced_billing/models/apply_payment_event.rb +139 -0
- data/lib/advanced_billing/models/apply_payment_event_data.rb +21 -7
- data/lib/advanced_billing/models/backport_invoice_event.rb +139 -0
- data/lib/advanced_billing/models/bank_account_attributes.rb +10 -0
- data/lib/advanced_billing/models/billing_manifest.rb +5 -1
- data/lib/advanced_billing/models/billing_schedule.rb +10 -0
- data/lib/advanced_billing/models/change_chargeback_status_event.rb +141 -0
- data/lib/advanced_billing/models/change_chargeback_status_event_data.rb +73 -0
- data/lib/advanced_billing/models/change_invoice_collection_method_event.rb +141 -0
- data/lib/advanced_billing/models/change_invoice_status_event.rb +141 -0
- data/lib/advanced_billing/models/change_invoice_status_event_data.rb +131 -0
- data/lib/advanced_billing/models/chargeback_status.rb +29 -0
- data/lib/advanced_billing/models/component.rb +3 -13
- data/lib/advanced_billing/models/component_cost_data.rb +10 -0
- data/lib/advanced_billing/models/component_cost_data_rate_tier.rb +10 -0
- data/lib/advanced_billing/models/component_custom_price.rb +10 -0
- data/lib/advanced_billing/models/component_price_point.rb +2 -13
- data/lib/advanced_billing/models/component_price_point_item.rb +10 -0
- data/lib/advanced_billing/models/coupon.rb +4 -14
- data/lib/advanced_billing/models/create_component_price_point.rb +6 -2
- data/lib/advanced_billing/models/create_component_price_point_request.rb +1 -1
- data/lib/advanced_billing/models/create_component_price_points_request.rb +1 -1
- data/lib/advanced_billing/models/create_credit_note_event.rb +139 -0
- data/lib/advanced_billing/models/create_debit_note_event.rb +139 -0
- data/lib/advanced_billing/models/create_invoice_payment_application.rb +22 -0
- data/lib/advanced_billing/models/create_multi_invoice_payment.rb +6 -2
- data/lib/advanced_billing/models/create_offer_component.rb +11 -0
- data/lib/advanced_billing/models/create_payment_profile.rb +4 -4
- data/lib/advanced_billing/models/create_prepaid_usage_component_price_point.rb +10 -4
- data/lib/advanced_billing/models/create_product_family.rb +14 -4
- data/lib/advanced_billing/models/create_subscription.rb +2 -2
- data/lib/advanced_billing/models/credit_card_attributes.rb +10 -0
- data/lib/advanced_billing/models/credit_note_application.rb +10 -0
- data/lib/advanced_billing/models/credit_note_line_item.rb +10 -0
- data/lib/advanced_billing/models/customer.rb +13 -1
- data/lib/advanced_billing/models/customer_attributes.rb +10 -0
- data/lib/advanced_billing/models/customer_change.rb +7 -22
- data/lib/advanced_billing/models/customer_custom_fields_change.rb +0 -22
- data/lib/advanced_billing/models/customer_payer_change.rb +0 -22
- data/lib/advanced_billing/models/debit_note.rb +351 -0
- data/lib/advanced_billing/models/debit_note_role.rb +23 -0
- data/lib/advanced_billing/models/debit_note_status.rb +29 -0
- data/lib/advanced_billing/models/deduct_service_credit.rb +10 -16
- data/lib/advanced_billing/models/dunner_data.rb +38 -0
- data/lib/advanced_billing/models/dunning_step_data.rb +34 -0
- data/lib/advanced_billing/models/dunning_step_reached.rb +12 -6
- data/lib/advanced_billing/models/failed_payment_event.rb +139 -0
- data/lib/advanced_billing/models/failed_payment_event_data.rb +132 -0
- data/lib/advanced_billing/models/group_billing.rb +10 -0
- data/lib/advanced_billing/models/group_settings.rb +4 -2
- data/lib/advanced_billing/models/group_target.rb +14 -0
- data/lib/advanced_billing/models/historic_usage.rb +109 -0
- data/lib/advanced_billing/models/include_null_or_not_null.rb +23 -0
- data/lib/advanced_billing/models/invoice.rb +18 -8
- data/lib/advanced_billing/models/invoice_address.rb +10 -0
- data/lib/advanced_billing/models/invoice_balance_item.rb +10 -0
- data/lib/advanced_billing/models/invoice_credit.rb +10 -0
- data/lib/advanced_billing/models/invoice_custom_field.rb +10 -0
- data/lib/advanced_billing/models/invoice_customer.rb +10 -0
- data/lib/advanced_billing/models/invoice_discount.rb +10 -0
- data/lib/advanced_billing/models/invoice_discount_breakout.rb +10 -0
- data/lib/advanced_billing/models/invoice_display_settings.rb +10 -0
- data/lib/advanced_billing/models/invoice_event_type.rb +3 -0
- data/lib/advanced_billing/models/invoice_issued.rb +6 -2
- data/lib/advanced_billing/models/invoice_line_item.rb +3 -3
- data/lib/advanced_billing/models/invoice_line_item_event_data.rb +10 -0
- data/lib/advanced_billing/models/invoice_line_item_pricing_detail.rb +10 -0
- data/lib/advanced_billing/models/invoice_payer.rb +10 -0
- data/lib/advanced_billing/models/invoice_payment.rb +10 -0
- data/lib/advanced_billing/models/invoice_payment_method.rb +10 -0
- data/lib/advanced_billing/models/invoice_pre_payment.rb +0 -10
- data/lib/advanced_billing/models/invoice_previous_balance.rb +10 -0
- data/lib/advanced_billing/models/invoice_refund.rb +10 -0
- data/lib/advanced_billing/models/invoice_seller.rb +10 -0
- data/lib/advanced_billing/models/invoice_status.rb +2 -2
- data/lib/advanced_billing/models/invoice_tax.rb +10 -0
- data/lib/advanced_billing/models/invoice_tax_breakout.rb +10 -0
- data/lib/advanced_billing/models/invoice_tax_component_breakout.rb +10 -0
- data/lib/advanced_billing/models/issue_invoice_event.rb +139 -0
- data/lib/advanced_billing/models/issue_invoice_event_data.rb +6 -6
- data/lib/advanced_billing/models/issue_service_credit.rb +10 -16
- data/lib/advanced_billing/models/item_price_point_changed.rb +8 -4
- data/lib/advanced_billing/models/item_price_point_data.rb +10 -0
- data/lib/advanced_billing/models/list_components_filter.rb +74 -0
- data/lib/advanced_billing/models/list_coupons_filter.rb +168 -0
- data/lib/advanced_billing/models/list_invoice_events_response.rb +14 -11
- data/lib/advanced_billing/models/{refund_prepayment_aggregated_error.rb → list_mrr_filter.rb} +14 -12
- data/lib/advanced_billing/models/{list_subscription_group_prepayment_date_field.rb → list_prepayment_date_field.rb} +4 -4
- data/lib/advanced_billing/models/list_prepayments_filter.rb +88 -0
- data/lib/advanced_billing/models/list_price_points_filter.rb +163 -0
- data/lib/advanced_billing/models/list_products_filter.rb +81 -0
- data/lib/advanced_billing/models/list_segments_filter.rb +103 -0
- data/lib/advanced_billing/models/list_subscription_components_filter.rb +74 -0
- data/lib/advanced_billing/models/list_subscription_components_for_site_filter.rb +84 -0
- data/lib/advanced_billing/models/list_subscription_components_include.rb +4 -1
- data/lib/advanced_billing/models/metafield_scope.rb +10 -0
- data/lib/advanced_billing/models/nested_subscription_group.rb +0 -10
- data/lib/advanced_billing/models/origin_invoice.rb +10 -0
- data/lib/advanced_billing/models/overage_pricing.rb +14 -0
- data/lib/advanced_billing/models/paid_invoice.rb +2 -2
- data/lib/advanced_billing/models/payer_attributes.rb +10 -0
- data/lib/advanced_billing/models/prepaid_component_price_point.rb +10 -0
- data/lib/advanced_billing/models/prepaid_product_price_point_filter.rb +56 -0
- data/lib/advanced_billing/models/prepaid_usage.rb +6 -2
- data/lib/advanced_billing/models/prepaid_usage_allocation_detail.rb +10 -0
- data/lib/advanced_billing/models/product.rb +5 -16
- data/lib/advanced_billing/models/product_price_point.rb +9 -0
- data/lib/advanced_billing/models/proforma_invoice.rb +2 -2
- data/lib/advanced_billing/models/proforma_invoice_issued.rb +6 -2
- data/lib/advanced_billing/models/reactivation_billing.rb +10 -0
- data/lib/advanced_billing/models/record_payment_response.rb +1 -13
- data/lib/advanced_billing/models/refund_invoice_event.rb +139 -0
- data/lib/advanced_billing/models/refund_invoice_event_data.rb +4 -2
- data/lib/advanced_billing/models/refund_invoice_request.rb +1 -1
- data/lib/advanced_billing/models/refund_prepayment.rb +3 -1
- data/lib/advanced_billing/models/remove_payment_event.rb +139 -0
- data/lib/advanced_billing/models/remove_payment_event_data.rb +1 -1
- data/lib/advanced_billing/models/segment_price.rb +10 -0
- data/lib/advanced_billing/models/subscription.rb +10 -16
- data/lib/advanced_billing/models/subscription_component.rb +26 -7
- data/lib/advanced_billing/models/subscription_component_subscription.rb +10 -0
- data/lib/advanced_billing/models/subscription_filter.rb +153 -0
- data/lib/advanced_billing/models/subscription_group.rb +2 -2
- data/lib/advanced_billing/models/subscription_group_bank_account.rb +10 -0
- data/lib/advanced_billing/models/subscription_group_component_custom_price.rb +10 -0
- data/lib/advanced_billing/models/subscription_group_prepayment_response.rb +3 -1
- data/lib/advanced_billing/models/subscription_group_signup.rb +2 -2
- data/lib/advanced_billing/models/subscription_group_signup_failure.rb +4 -2
- data/lib/advanced_billing/models/subscription_group_signup_failure_data.rb +10 -0
- data/lib/advanced_billing/models/subscription_group_signup_item.rb +10 -0
- data/lib/advanced_billing/models/subscription_group_signup_response.rb +2 -2
- data/lib/advanced_billing/models/subscription_group_signup_success.rb +8 -4
- data/lib/advanced_billing/models/subscription_group_signup_success_data.rb +50 -0
- data/lib/advanced_billing/models/update_customer.rb +12 -0
- data/lib/advanced_billing/models/update_subscription_component.rb +10 -0
- data/lib/advanced_billing/models/upsert_prepaid_configuration.rb +10 -0
- data/lib/advanced_billing/models/usage.rb +3 -1
- data/lib/advanced_billing/models/void_invoice_event.rb +139 -0
- data/lib/advanced_billing/models/void_invoice_event_data.rb +8 -7
- data/lib/advanced_billing/models/void_remainder_event.rb +139 -0
- data/lib/advanced_billing/models/void_remainder_event_data.rb +4 -2
- data/lib/advanced_billing/utilities/union_type_lookup.rb +69 -199
- data/lib/advanced_billing.rb +42 -18
- metadata +38 -17
- data/lib/advanced_billing/exceptions/refund_prepayment_aggregated_errors_response_exception.rb +0 -33
- data/lib/advanced_billing/models/billing_address.rb +0 -117
- data/lib/advanced_billing/models/credit_note1.rb +0 -419
- data/lib/advanced_billing/models/customer1.rb +0 -125
- data/lib/advanced_billing/models/invoice_event.rb +0 -124
- data/lib/advanced_billing/models/invoice_event_data.rb +0 -447
- data/lib/advanced_billing/models/invoice_event_payment.rb +0 -168
- data/lib/advanced_billing/models/invoice_event_payment1.rb +0 -160
- data/lib/advanced_billing/models/prepayment_aggregated_error.rb +0 -81
- data/lib/advanced_billing/models/price_point.rb +0 -216
- data/lib/advanced_billing/models/refund.rb +0 -138
- data/lib/advanced_billing/models/seller.rb +0 -92
- data/lib/advanced_billing/models/shipping_address.rb +0 -117
@@ -66,5 +66,15 @@ module AdvancedBilling
|
|
66
66
|
number,
|
67
67
|
hash)
|
68
68
|
end
|
69
|
+
|
70
|
+
# Validates an instance of the object from a given value.
|
71
|
+
# @param [AppliedCreditNoteData | Hash] The value against the validation is performed.
|
72
|
+
def self.validate(value)
|
73
|
+
return true if value.instance_of? self
|
74
|
+
|
75
|
+
return false unless value.instance_of? Hash
|
76
|
+
|
77
|
+
true
|
78
|
+
end
|
69
79
|
end
|
70
80
|
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# advanced_billing
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
module AdvancedBilling
|
8
|
+
# ApplyCreditNoteEvent Model.
|
9
|
+
class ApplyCreditNoteEvent < BaseModel
|
10
|
+
SKIP = Object.new
|
11
|
+
private_constant :SKIP
|
12
|
+
|
13
|
+
# TODO: Write general description for this method
|
14
|
+
# @return [Integer]
|
15
|
+
attr_accessor :id
|
16
|
+
|
17
|
+
# TODO: Write general description for this method
|
18
|
+
# @return [DateTime]
|
19
|
+
attr_accessor :timestamp
|
20
|
+
|
21
|
+
# TODO: Write general description for this method
|
22
|
+
# @return [Invoice]
|
23
|
+
attr_accessor :invoice
|
24
|
+
|
25
|
+
# TODO: Write general description for this method
|
26
|
+
# @return [InvoiceEventType]
|
27
|
+
attr_accessor :event_type
|
28
|
+
|
29
|
+
# Example schema for an `apply_credit_note` event
|
30
|
+
# @return [ApplyCreditNoteEventData]
|
31
|
+
attr_accessor :event_data
|
32
|
+
|
33
|
+
# A mapping from model property names to API property names.
|
34
|
+
def self.names
|
35
|
+
@_hash = {} if @_hash.nil?
|
36
|
+
@_hash['id'] = 'id'
|
37
|
+
@_hash['timestamp'] = 'timestamp'
|
38
|
+
@_hash['invoice'] = 'invoice'
|
39
|
+
@_hash['event_type'] = 'event_type'
|
40
|
+
@_hash['event_data'] = 'event_data'
|
41
|
+
@_hash
|
42
|
+
end
|
43
|
+
|
44
|
+
# An array for optional fields
|
45
|
+
def self.optionals
|
46
|
+
[]
|
47
|
+
end
|
48
|
+
|
49
|
+
# An array for nullable fields
|
50
|
+
def self.nullables
|
51
|
+
[]
|
52
|
+
end
|
53
|
+
|
54
|
+
def initialize(id = nil,
|
55
|
+
timestamp = nil,
|
56
|
+
invoice = nil,
|
57
|
+
event_type = InvoiceEventType::APPLY_CREDIT_NOTE,
|
58
|
+
event_data = nil,
|
59
|
+
additional_properties = {})
|
60
|
+
@id = id
|
61
|
+
@timestamp = timestamp
|
62
|
+
@invoice = invoice
|
63
|
+
@event_type = event_type
|
64
|
+
@event_data = event_data
|
65
|
+
|
66
|
+
# Add additional model properties to the instance.
|
67
|
+
additional_properties.each do |_name, _value|
|
68
|
+
instance_variable_set("@#{_name}", _value)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Creates an instance of the object from a hash.
|
73
|
+
def self.from_hash(hash)
|
74
|
+
return nil unless hash
|
75
|
+
|
76
|
+
# Extract variables from the hash.
|
77
|
+
id = hash.key?('id') ? hash['id'] : nil
|
78
|
+
timestamp = if hash.key?('timestamp')
|
79
|
+
(DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
|
80
|
+
end
|
81
|
+
invoice = Invoice.from_hash(hash['invoice']) if hash['invoice']
|
82
|
+
event_type = hash['event_type'] ||= InvoiceEventType::APPLY_CREDIT_NOTE
|
83
|
+
event_data = ApplyCreditNoteEventData.from_hash(hash['event_data']) if hash['event_data']
|
84
|
+
|
85
|
+
# Clean out expected properties from Hash.
|
86
|
+
names.each_value { |k| hash.delete(k) }
|
87
|
+
|
88
|
+
# Create object from extracted values.
|
89
|
+
ApplyCreditNoteEvent.new(id,
|
90
|
+
timestamp,
|
91
|
+
invoice,
|
92
|
+
event_type,
|
93
|
+
event_data,
|
94
|
+
hash)
|
95
|
+
end
|
96
|
+
|
97
|
+
def to_custom_timestamp
|
98
|
+
DateTimeHelper.to_rfc3339(timestamp)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Validates an instance of the object from a given value.
|
102
|
+
# @param [ApplyCreditNoteEvent | Hash] The value against the validation is performed.
|
103
|
+
def self.validate(value)
|
104
|
+
if value.instance_of? self
|
105
|
+
return (
|
106
|
+
APIHelper.valid_type?(value.id,
|
107
|
+
->(val) { val.instance_of? Integer }) and
|
108
|
+
APIHelper.valid_type?(value.timestamp,
|
109
|
+
->(val) { val.instance_of? DateTime }) and
|
110
|
+
APIHelper.valid_type?(value.invoice,
|
111
|
+
->(val) { Invoice.validate(val) },
|
112
|
+
is_model_hash: true) and
|
113
|
+
APIHelper.valid_type?(value.event_type,
|
114
|
+
->(val) { InvoiceEventType.validate(val) }) and
|
115
|
+
APIHelper.valid_type?(value.event_data,
|
116
|
+
->(val) { ApplyCreditNoteEventData.validate(val) },
|
117
|
+
is_model_hash: true)
|
118
|
+
)
|
119
|
+
end
|
120
|
+
|
121
|
+
return false unless value.instance_of? Hash
|
122
|
+
|
123
|
+
(
|
124
|
+
APIHelper.valid_type?(value['id'],
|
125
|
+
->(val) { val.instance_of? Integer }) and
|
126
|
+
APIHelper.valid_type?(value['timestamp'],
|
127
|
+
->(val) { val.instance_of? String }) and
|
128
|
+
APIHelper.valid_type?(value['invoice'],
|
129
|
+
->(val) { Invoice.validate(val) },
|
130
|
+
is_model_hash: true) and
|
131
|
+
APIHelper.valid_type?(value['event_type'],
|
132
|
+
->(val) { InvoiceEventType.validate(val) }) and
|
133
|
+
APIHelper.valid_type?(value['event_data'],
|
134
|
+
->(val) { ApplyCreditNoteEventData.validate(val) },
|
135
|
+
is_model_hash: true)
|
136
|
+
)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# advanced_billing
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
module AdvancedBilling
|
8
|
+
# ApplyDebitNoteEvent Model.
|
9
|
+
class ApplyDebitNoteEvent < BaseModel
|
10
|
+
SKIP = Object.new
|
11
|
+
private_constant :SKIP
|
12
|
+
|
13
|
+
# TODO: Write general description for this method
|
14
|
+
# @return [Integer]
|
15
|
+
attr_accessor :id
|
16
|
+
|
17
|
+
# TODO: Write general description for this method
|
18
|
+
# @return [DateTime]
|
19
|
+
attr_accessor :timestamp
|
20
|
+
|
21
|
+
# TODO: Write general description for this method
|
22
|
+
# @return [Invoice]
|
23
|
+
attr_accessor :invoice
|
24
|
+
|
25
|
+
# TODO: Write general description for this method
|
26
|
+
# @return [InvoiceEventType]
|
27
|
+
attr_accessor :event_type
|
28
|
+
|
29
|
+
# Example schema for an `apply_debit_note` event
|
30
|
+
# @return [ApplyDebitNoteEventData]
|
31
|
+
attr_accessor :event_data
|
32
|
+
|
33
|
+
# A mapping from model property names to API property names.
|
34
|
+
def self.names
|
35
|
+
@_hash = {} if @_hash.nil?
|
36
|
+
@_hash['id'] = 'id'
|
37
|
+
@_hash['timestamp'] = 'timestamp'
|
38
|
+
@_hash['invoice'] = 'invoice'
|
39
|
+
@_hash['event_type'] = 'event_type'
|
40
|
+
@_hash['event_data'] = 'event_data'
|
41
|
+
@_hash
|
42
|
+
end
|
43
|
+
|
44
|
+
# An array for optional fields
|
45
|
+
def self.optionals
|
46
|
+
[]
|
47
|
+
end
|
48
|
+
|
49
|
+
# An array for nullable fields
|
50
|
+
def self.nullables
|
51
|
+
[]
|
52
|
+
end
|
53
|
+
|
54
|
+
def initialize(id = nil,
|
55
|
+
timestamp = nil,
|
56
|
+
invoice = nil,
|
57
|
+
event_type = InvoiceEventType::APPLY_DEBIT_NOTE,
|
58
|
+
event_data = nil,
|
59
|
+
additional_properties = {})
|
60
|
+
@id = id
|
61
|
+
@timestamp = timestamp
|
62
|
+
@invoice = invoice
|
63
|
+
@event_type = event_type
|
64
|
+
@event_data = event_data
|
65
|
+
|
66
|
+
# Add additional model properties to the instance.
|
67
|
+
additional_properties.each do |_name, _value|
|
68
|
+
instance_variable_set("@#{_name}", _value)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Creates an instance of the object from a hash.
|
73
|
+
def self.from_hash(hash)
|
74
|
+
return nil unless hash
|
75
|
+
|
76
|
+
# Extract variables from the hash.
|
77
|
+
id = hash.key?('id') ? hash['id'] : nil
|
78
|
+
timestamp = if hash.key?('timestamp')
|
79
|
+
(DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
|
80
|
+
end
|
81
|
+
invoice = Invoice.from_hash(hash['invoice']) if hash['invoice']
|
82
|
+
event_type = hash['event_type'] ||= InvoiceEventType::APPLY_DEBIT_NOTE
|
83
|
+
event_data = ApplyDebitNoteEventData.from_hash(hash['event_data']) if hash['event_data']
|
84
|
+
|
85
|
+
# Clean out expected properties from Hash.
|
86
|
+
names.each_value { |k| hash.delete(k) }
|
87
|
+
|
88
|
+
# Create object from extracted values.
|
89
|
+
ApplyDebitNoteEvent.new(id,
|
90
|
+
timestamp,
|
91
|
+
invoice,
|
92
|
+
event_type,
|
93
|
+
event_data,
|
94
|
+
hash)
|
95
|
+
end
|
96
|
+
|
97
|
+
def to_custom_timestamp
|
98
|
+
DateTimeHelper.to_rfc3339(timestamp)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Validates an instance of the object from a given value.
|
102
|
+
# @param [ApplyDebitNoteEvent | Hash] The value against the validation is performed.
|
103
|
+
def self.validate(value)
|
104
|
+
if value.instance_of? self
|
105
|
+
return (
|
106
|
+
APIHelper.valid_type?(value.id,
|
107
|
+
->(val) { val.instance_of? Integer }) and
|
108
|
+
APIHelper.valid_type?(value.timestamp,
|
109
|
+
->(val) { val.instance_of? DateTime }) and
|
110
|
+
APIHelper.valid_type?(value.invoice,
|
111
|
+
->(val) { Invoice.validate(val) },
|
112
|
+
is_model_hash: true) and
|
113
|
+
APIHelper.valid_type?(value.event_type,
|
114
|
+
->(val) { InvoiceEventType.validate(val) }) and
|
115
|
+
APIHelper.valid_type?(value.event_data,
|
116
|
+
->(val) { ApplyDebitNoteEventData.validate(val) },
|
117
|
+
is_model_hash: true)
|
118
|
+
)
|
119
|
+
end
|
120
|
+
|
121
|
+
return false unless value.instance_of? Hash
|
122
|
+
|
123
|
+
(
|
124
|
+
APIHelper.valid_type?(value['id'],
|
125
|
+
->(val) { val.instance_of? Integer }) and
|
126
|
+
APIHelper.valid_type?(value['timestamp'],
|
127
|
+
->(val) { val.instance_of? String }) and
|
128
|
+
APIHelper.valid_type?(value['invoice'],
|
129
|
+
->(val) { Invoice.validate(val) },
|
130
|
+
is_model_hash: true) and
|
131
|
+
APIHelper.valid_type?(value['event_type'],
|
132
|
+
->(val) { InvoiceEventType.validate(val) }) and
|
133
|
+
APIHelper.valid_type?(value['event_data'],
|
134
|
+
->(val) { ApplyDebitNoteEventData.validate(val) },
|
135
|
+
is_model_hash: true)
|
136
|
+
)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
# This file was automatically generated by APIMATIC v2.0
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
|
+
require 'date'
|
6
7
|
module AdvancedBilling
|
7
8
|
# Example schema for an `apply_debit_note` event
|
8
9
|
class ApplyDebitNoteEventData < BaseModel
|
@@ -27,6 +28,15 @@ module AdvancedBilling
|
|
27
28
|
# @return [String]
|
28
29
|
attr_accessor :applied_amount
|
29
30
|
|
31
|
+
# The debit note memo.
|
32
|
+
# @return [String]
|
33
|
+
attr_accessor :memo
|
34
|
+
|
35
|
+
# The time the debit note was applied, in ISO 8601 format, i.e.
|
36
|
+
# "2019-06-07T17:20:06Z"
|
37
|
+
# @return [DateTime]
|
38
|
+
attr_accessor :transaction_time
|
39
|
+
|
30
40
|
# A mapping from model property names to API property names.
|
31
41
|
def self.names
|
32
42
|
@_hash = {} if @_hash.nil?
|
@@ -34,28 +44,40 @@ module AdvancedBilling
|
|
34
44
|
@_hash['debit_note_uid'] = 'debit_note_uid'
|
35
45
|
@_hash['original_amount'] = 'original_amount'
|
36
46
|
@_hash['applied_amount'] = 'applied_amount'
|
47
|
+
@_hash['memo'] = 'memo'
|
48
|
+
@_hash['transaction_time'] = 'transaction_time'
|
37
49
|
@_hash
|
38
50
|
end
|
39
51
|
|
40
52
|
# An array for optional fields
|
41
53
|
def self.optionals
|
42
|
-
[
|
54
|
+
%w[
|
55
|
+
memo
|
56
|
+
transaction_time
|
57
|
+
]
|
43
58
|
end
|
44
59
|
|
45
60
|
# An array for nullable fields
|
46
61
|
def self.nullables
|
47
|
-
[
|
62
|
+
%w[
|
63
|
+
memo
|
64
|
+
transaction_time
|
65
|
+
]
|
48
66
|
end
|
49
67
|
|
50
68
|
def initialize(debit_note_number = nil,
|
51
69
|
debit_note_uid = nil,
|
52
70
|
original_amount = nil,
|
53
71
|
applied_amount = nil,
|
72
|
+
memo = SKIP,
|
73
|
+
transaction_time = SKIP,
|
54
74
|
additional_properties = {})
|
55
75
|
@debit_note_number = debit_note_number
|
56
76
|
@debit_note_uid = debit_note_uid
|
57
77
|
@original_amount = original_amount
|
58
78
|
@applied_amount = applied_amount
|
79
|
+
@memo = memo unless memo == SKIP
|
80
|
+
@transaction_time = transaction_time unless transaction_time == SKIP
|
59
81
|
|
60
82
|
# Add additional model properties to the instance.
|
61
83
|
additional_properties.each do |_name, _value|
|
@@ -76,6 +98,12 @@ module AdvancedBilling
|
|
76
98
|
hash.key?('original_amount') ? hash['original_amount'] : nil
|
77
99
|
applied_amount =
|
78
100
|
hash.key?('applied_amount') ? hash['applied_amount'] : nil
|
101
|
+
memo = hash.key?('memo') ? hash['memo'] : SKIP
|
102
|
+
transaction_time = if hash.key?('transaction_time')
|
103
|
+
(DateTimeHelper.from_rfc3339(hash['transaction_time']) if hash['transaction_time'])
|
104
|
+
else
|
105
|
+
SKIP
|
106
|
+
end
|
79
107
|
|
80
108
|
# Clean out expected properties from Hash.
|
81
109
|
names.each_value { |k| hash.delete(k) }
|
@@ -85,9 +113,15 @@ module AdvancedBilling
|
|
85
113
|
debit_note_uid,
|
86
114
|
original_amount,
|
87
115
|
applied_amount,
|
116
|
+
memo,
|
117
|
+
transaction_time,
|
88
118
|
hash)
|
89
119
|
end
|
90
120
|
|
121
|
+
def to_custom_transaction_time
|
122
|
+
DateTimeHelper.to_rfc3339(transaction_time)
|
123
|
+
end
|
124
|
+
|
91
125
|
# Validates an instance of the object from a given value.
|
92
126
|
# @param [ApplyDebitNoteEventData | Hash] The value against the validation is performed.
|
93
127
|
def self.validate(value)
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# advanced_billing
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require 'date'
|
7
|
+
module AdvancedBilling
|
8
|
+
# ApplyPaymentEvent Model.
|
9
|
+
class ApplyPaymentEvent < BaseModel
|
10
|
+
SKIP = Object.new
|
11
|
+
private_constant :SKIP
|
12
|
+
|
13
|
+
# TODO: Write general description for this method
|
14
|
+
# @return [Integer]
|
15
|
+
attr_accessor :id
|
16
|
+
|
17
|
+
# TODO: Write general description for this method
|
18
|
+
# @return [DateTime]
|
19
|
+
attr_accessor :timestamp
|
20
|
+
|
21
|
+
# TODO: Write general description for this method
|
22
|
+
# @return [Invoice]
|
23
|
+
attr_accessor :invoice
|
24
|
+
|
25
|
+
# TODO: Write general description for this method
|
26
|
+
# @return [InvoiceEventType]
|
27
|
+
attr_accessor :event_type
|
28
|
+
|
29
|
+
# Example schema for an `apply_payment` event
|
30
|
+
# @return [ApplyPaymentEventData]
|
31
|
+
attr_accessor :event_data
|
32
|
+
|
33
|
+
# A mapping from model property names to API property names.
|
34
|
+
def self.names
|
35
|
+
@_hash = {} if @_hash.nil?
|
36
|
+
@_hash['id'] = 'id'
|
37
|
+
@_hash['timestamp'] = 'timestamp'
|
38
|
+
@_hash['invoice'] = 'invoice'
|
39
|
+
@_hash['event_type'] = 'event_type'
|
40
|
+
@_hash['event_data'] = 'event_data'
|
41
|
+
@_hash
|
42
|
+
end
|
43
|
+
|
44
|
+
# An array for optional fields
|
45
|
+
def self.optionals
|
46
|
+
[]
|
47
|
+
end
|
48
|
+
|
49
|
+
# An array for nullable fields
|
50
|
+
def self.nullables
|
51
|
+
[]
|
52
|
+
end
|
53
|
+
|
54
|
+
def initialize(id = nil,
|
55
|
+
timestamp = nil,
|
56
|
+
invoice = nil,
|
57
|
+
event_type = InvoiceEventType::APPLY_PAYMENT,
|
58
|
+
event_data = nil,
|
59
|
+
additional_properties = {})
|
60
|
+
@id = id
|
61
|
+
@timestamp = timestamp
|
62
|
+
@invoice = invoice
|
63
|
+
@event_type = event_type
|
64
|
+
@event_data = event_data
|
65
|
+
|
66
|
+
# Add additional model properties to the instance.
|
67
|
+
additional_properties.each do |_name, _value|
|
68
|
+
instance_variable_set("@#{_name}", _value)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Creates an instance of the object from a hash.
|
73
|
+
def self.from_hash(hash)
|
74
|
+
return nil unless hash
|
75
|
+
|
76
|
+
# Extract variables from the hash.
|
77
|
+
id = hash.key?('id') ? hash['id'] : nil
|
78
|
+
timestamp = if hash.key?('timestamp')
|
79
|
+
(DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
|
80
|
+
end
|
81
|
+
invoice = Invoice.from_hash(hash['invoice']) if hash['invoice']
|
82
|
+
event_type = hash['event_type'] ||= InvoiceEventType::APPLY_PAYMENT
|
83
|
+
event_data = ApplyPaymentEventData.from_hash(hash['event_data']) if hash['event_data']
|
84
|
+
|
85
|
+
# Clean out expected properties from Hash.
|
86
|
+
names.each_value { |k| hash.delete(k) }
|
87
|
+
|
88
|
+
# Create object from extracted values.
|
89
|
+
ApplyPaymentEvent.new(id,
|
90
|
+
timestamp,
|
91
|
+
invoice,
|
92
|
+
event_type,
|
93
|
+
event_data,
|
94
|
+
hash)
|
95
|
+
end
|
96
|
+
|
97
|
+
def to_custom_timestamp
|
98
|
+
DateTimeHelper.to_rfc3339(timestamp)
|
99
|
+
end
|
100
|
+
|
101
|
+
# Validates an instance of the object from a given value.
|
102
|
+
# @param [ApplyPaymentEvent | Hash] The value against the validation is performed.
|
103
|
+
def self.validate(value)
|
104
|
+
if value.instance_of? self
|
105
|
+
return (
|
106
|
+
APIHelper.valid_type?(value.id,
|
107
|
+
->(val) { val.instance_of? Integer }) and
|
108
|
+
APIHelper.valid_type?(value.timestamp,
|
109
|
+
->(val) { val.instance_of? DateTime }) and
|
110
|
+
APIHelper.valid_type?(value.invoice,
|
111
|
+
->(val) { Invoice.validate(val) },
|
112
|
+
is_model_hash: true) and
|
113
|
+
APIHelper.valid_type?(value.event_type,
|
114
|
+
->(val) { InvoiceEventType.validate(val) }) and
|
115
|
+
APIHelper.valid_type?(value.event_data,
|
116
|
+
->(val) { ApplyPaymentEventData.validate(val) },
|
117
|
+
is_model_hash: true)
|
118
|
+
)
|
119
|
+
end
|
120
|
+
|
121
|
+
return false unless value.instance_of? Hash
|
122
|
+
|
123
|
+
(
|
124
|
+
APIHelper.valid_type?(value['id'],
|
125
|
+
->(val) { val.instance_of? Integer }) and
|
126
|
+
APIHelper.valid_type?(value['timestamp'],
|
127
|
+
->(val) { val.instance_of? String }) and
|
128
|
+
APIHelper.valid_type?(value['invoice'],
|
129
|
+
->(val) { Invoice.validate(val) },
|
130
|
+
is_model_hash: true) and
|
131
|
+
APIHelper.valid_type?(value['event_type'],
|
132
|
+
->(val) { InvoiceEventType.validate(val) }) and
|
133
|
+
APIHelper.valid_type?(value['event_data'],
|
134
|
+
->(val) { ApplyPaymentEventData.validate(val) },
|
135
|
+
is_model_hash: true)
|
136
|
+
)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -10,6 +10,10 @@ module AdvancedBilling
|
|
10
10
|
SKIP = Object.new
|
11
11
|
private_constant :SKIP
|
12
12
|
|
13
|
+
# TODO: Write general description for this method
|
14
|
+
# @return [InvoiceConsolidationLevel]
|
15
|
+
attr_accessor :consolidation_level
|
16
|
+
|
13
17
|
# The payment memo
|
14
18
|
# @return [String]
|
15
19
|
attr_accessor :memo
|
@@ -36,7 +40,7 @@ module AdvancedBilling
|
|
36
40
|
attr_accessor :transaction_time
|
37
41
|
|
38
42
|
# A nested data structure detailing the method of payment
|
39
|
-
# @return [
|
43
|
+
# @return [Object]
|
40
44
|
attr_accessor :payment_method
|
41
45
|
|
42
46
|
# The Chargify id of the original payment
|
@@ -62,6 +66,7 @@ module AdvancedBilling
|
|
62
66
|
# A mapping from model property names to API property names.
|
63
67
|
def self.names
|
64
68
|
@_hash = {} if @_hash.nil?
|
69
|
+
@_hash['consolidation_level'] = 'consolidation_level'
|
65
70
|
@_hash['memo'] = 'memo'
|
66
71
|
@_hash['original_amount'] = 'original_amount'
|
67
72
|
@_hash['applied_amount'] = 'applied_amount'
|
@@ -94,7 +99,8 @@ module AdvancedBilling
|
|
94
99
|
]
|
95
100
|
end
|
96
101
|
|
97
|
-
def initialize(
|
102
|
+
def initialize(consolidation_level = nil,
|
103
|
+
memo = nil,
|
98
104
|
original_amount = nil,
|
99
105
|
applied_amount = nil,
|
100
106
|
transaction_time = nil,
|
@@ -105,6 +111,7 @@ module AdvancedBilling
|
|
105
111
|
prepayment = SKIP,
|
106
112
|
external = SKIP,
|
107
113
|
additional_properties = {})
|
114
|
+
@consolidation_level = consolidation_level
|
108
115
|
@memo = memo
|
109
116
|
@original_amount = original_amount
|
110
117
|
@applied_amount = applied_amount
|
@@ -130,6 +137,8 @@ module AdvancedBilling
|
|
130
137
|
return nil unless hash
|
131
138
|
|
132
139
|
# Extract variables from the hash.
|
140
|
+
consolidation_level =
|
141
|
+
hash.key?('consolidation_level') ? hash['consolidation_level'] : nil
|
133
142
|
memo = hash.key?('memo') ? hash['memo'] : nil
|
134
143
|
original_amount =
|
135
144
|
hash.key?('original_amount') ? hash['original_amount'] : nil
|
@@ -154,7 +163,8 @@ module AdvancedBilling
|
|
154
163
|
names.each_value { |k| hash.delete(k) }
|
155
164
|
|
156
165
|
# Create object from extracted values.
|
157
|
-
ApplyPaymentEventData.new(
|
166
|
+
ApplyPaymentEventData.new(consolidation_level,
|
167
|
+
memo,
|
158
168
|
original_amount,
|
159
169
|
applied_amount,
|
160
170
|
transaction_time,
|
@@ -176,8 +186,10 @@ module AdvancedBilling
|
|
176
186
|
def self.validate(value)
|
177
187
|
if value.instance_of? self
|
178
188
|
return (
|
179
|
-
APIHelper.valid_type?(value.
|
180
|
-
->(val) { val
|
189
|
+
APIHelper.valid_type?(value.consolidation_level,
|
190
|
+
->(val) { InvoiceConsolidationLevel.validate(val) }) and
|
191
|
+
APIHelper.valid_type?(value.memo,
|
192
|
+
->(val) { val.instance_of? String }) and
|
181
193
|
APIHelper.valid_type?(value.original_amount,
|
182
194
|
->(val) { val.instance_of? String }) and
|
183
195
|
APIHelper.valid_type?(value.applied_amount,
|
@@ -192,8 +204,10 @@ module AdvancedBilling
|
|
192
204
|
return false unless value.instance_of? Hash
|
193
205
|
|
194
206
|
(
|
195
|
-
APIHelper.valid_type?(value['
|
196
|
-
->(val) { val
|
207
|
+
APIHelper.valid_type?(value['consolidation_level'],
|
208
|
+
->(val) { InvoiceConsolidationLevel.validate(val) }) and
|
209
|
+
APIHelper.valid_type?(value['memo'],
|
210
|
+
->(val) { val.instance_of? String }) and
|
197
211
|
APIHelper.valid_type?(value['original_amount'],
|
198
212
|
->(val) { val.instance_of? String }) and
|
199
213
|
APIHelper.valid_type?(value['applied_amount'],
|