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.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +40 -40
  3. data/lib/advanced_billing/controllers/advance_invoice_controller.rb +6 -4
  4. data/lib/advanced_billing/controllers/base_controller.rb +1 -1
  5. data/lib/advanced_billing/controllers/components_controller.rb +9 -58
  6. data/lib/advanced_billing/controllers/coupons_controller.rb +6 -115
  7. data/lib/advanced_billing/controllers/custom_fields_controller.rb +4 -4
  8. data/lib/advanced_billing/controllers/events_based_billing_segments_controller.rb +5 -22
  9. data/lib/advanced_billing/controllers/insights_controller.rb +3 -4
  10. data/lib/advanced_billing/controllers/invoices_controller.rb +11 -0
  11. data/lib/advanced_billing/controllers/payment_profiles_controller.rb +26 -0
  12. data/lib/advanced_billing/controllers/product_families_controller.rb +5 -14
  13. data/lib/advanced_billing/controllers/product_price_points_controller.rb +3 -40
  14. data/lib/advanced_billing/controllers/products_controller.rb +5 -14
  15. data/lib/advanced_billing/controllers/subscription_components_controller.rb +16 -66
  16. data/lib/advanced_billing/controllers/subscription_group_invoice_account_controller.rb +5 -15
  17. data/lib/advanced_billing/controllers/subscription_groups_controller.rb +6 -6
  18. data/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb +13 -20
  19. data/lib/advanced_billing/controllers/subscriptions_controller.rb +49 -14
  20. data/lib/advanced_billing/models/ach_agreement.rb +10 -0
  21. data/lib/advanced_billing/models/address_change.rb +0 -22
  22. data/lib/advanced_billing/models/agreement_acceptance.rb +10 -0
  23. data/lib/advanced_billing/models/allocation.rb +1 -3
  24. data/lib/advanced_billing/models/applied_credit_note_data.rb +10 -0
  25. data/lib/advanced_billing/models/apply_credit_note_event.rb +139 -0
  26. data/lib/advanced_billing/models/apply_credit_note_event_data.rb +3 -1
  27. data/lib/advanced_billing/models/apply_debit_note_event.rb +139 -0
  28. data/lib/advanced_billing/models/apply_debit_note_event_data.rb +36 -2
  29. data/lib/advanced_billing/models/apply_payment_event.rb +139 -0
  30. data/lib/advanced_billing/models/apply_payment_event_data.rb +21 -7
  31. data/lib/advanced_billing/models/backport_invoice_event.rb +139 -0
  32. data/lib/advanced_billing/models/bank_account_attributes.rb +10 -0
  33. data/lib/advanced_billing/models/billing_manifest.rb +5 -1
  34. data/lib/advanced_billing/models/billing_schedule.rb +10 -0
  35. data/lib/advanced_billing/models/change_chargeback_status_event.rb +141 -0
  36. data/lib/advanced_billing/models/change_chargeback_status_event_data.rb +73 -0
  37. data/lib/advanced_billing/models/change_invoice_collection_method_event.rb +141 -0
  38. data/lib/advanced_billing/models/change_invoice_status_event.rb +141 -0
  39. data/lib/advanced_billing/models/change_invoice_status_event_data.rb +131 -0
  40. data/lib/advanced_billing/models/chargeback_status.rb +29 -0
  41. data/lib/advanced_billing/models/component.rb +3 -13
  42. data/lib/advanced_billing/models/component_cost_data.rb +10 -0
  43. data/lib/advanced_billing/models/component_cost_data_rate_tier.rb +10 -0
  44. data/lib/advanced_billing/models/component_custom_price.rb +10 -0
  45. data/lib/advanced_billing/models/component_price_point.rb +2 -13
  46. data/lib/advanced_billing/models/component_price_point_item.rb +10 -0
  47. data/lib/advanced_billing/models/coupon.rb +4 -14
  48. data/lib/advanced_billing/models/create_component_price_point.rb +6 -2
  49. data/lib/advanced_billing/models/create_component_price_point_request.rb +1 -1
  50. data/lib/advanced_billing/models/create_component_price_points_request.rb +1 -1
  51. data/lib/advanced_billing/models/create_credit_note_event.rb +139 -0
  52. data/lib/advanced_billing/models/create_debit_note_event.rb +139 -0
  53. data/lib/advanced_billing/models/create_invoice_payment_application.rb +22 -0
  54. data/lib/advanced_billing/models/create_multi_invoice_payment.rb +6 -2
  55. data/lib/advanced_billing/models/create_offer_component.rb +11 -0
  56. data/lib/advanced_billing/models/create_payment_profile.rb +4 -4
  57. data/lib/advanced_billing/models/create_prepaid_usage_component_price_point.rb +10 -4
  58. data/lib/advanced_billing/models/create_product_family.rb +14 -4
  59. data/lib/advanced_billing/models/create_subscription.rb +2 -2
  60. data/lib/advanced_billing/models/credit_card_attributes.rb +10 -0
  61. data/lib/advanced_billing/models/credit_note_application.rb +10 -0
  62. data/lib/advanced_billing/models/credit_note_line_item.rb +10 -0
  63. data/lib/advanced_billing/models/customer.rb +13 -1
  64. data/lib/advanced_billing/models/customer_attributes.rb +10 -0
  65. data/lib/advanced_billing/models/customer_change.rb +7 -22
  66. data/lib/advanced_billing/models/customer_custom_fields_change.rb +0 -22
  67. data/lib/advanced_billing/models/customer_payer_change.rb +0 -22
  68. data/lib/advanced_billing/models/debit_note.rb +351 -0
  69. data/lib/advanced_billing/models/debit_note_role.rb +23 -0
  70. data/lib/advanced_billing/models/debit_note_status.rb +29 -0
  71. data/lib/advanced_billing/models/deduct_service_credit.rb +10 -16
  72. data/lib/advanced_billing/models/dunner_data.rb +38 -0
  73. data/lib/advanced_billing/models/dunning_step_data.rb +34 -0
  74. data/lib/advanced_billing/models/dunning_step_reached.rb +12 -6
  75. data/lib/advanced_billing/models/failed_payment_event.rb +139 -0
  76. data/lib/advanced_billing/models/failed_payment_event_data.rb +132 -0
  77. data/lib/advanced_billing/models/group_billing.rb +10 -0
  78. data/lib/advanced_billing/models/group_settings.rb +4 -2
  79. data/lib/advanced_billing/models/group_target.rb +14 -0
  80. data/lib/advanced_billing/models/historic_usage.rb +109 -0
  81. data/lib/advanced_billing/models/include_null_or_not_null.rb +23 -0
  82. data/lib/advanced_billing/models/invoice.rb +18 -8
  83. data/lib/advanced_billing/models/invoice_address.rb +10 -0
  84. data/lib/advanced_billing/models/invoice_balance_item.rb +10 -0
  85. data/lib/advanced_billing/models/invoice_credit.rb +10 -0
  86. data/lib/advanced_billing/models/invoice_custom_field.rb +10 -0
  87. data/lib/advanced_billing/models/invoice_customer.rb +10 -0
  88. data/lib/advanced_billing/models/invoice_discount.rb +10 -0
  89. data/lib/advanced_billing/models/invoice_discount_breakout.rb +10 -0
  90. data/lib/advanced_billing/models/invoice_display_settings.rb +10 -0
  91. data/lib/advanced_billing/models/invoice_event_type.rb +3 -0
  92. data/lib/advanced_billing/models/invoice_issued.rb +6 -2
  93. data/lib/advanced_billing/models/invoice_line_item.rb +3 -3
  94. data/lib/advanced_billing/models/invoice_line_item_event_data.rb +10 -0
  95. data/lib/advanced_billing/models/invoice_line_item_pricing_detail.rb +10 -0
  96. data/lib/advanced_billing/models/invoice_payer.rb +10 -0
  97. data/lib/advanced_billing/models/invoice_payment.rb +10 -0
  98. data/lib/advanced_billing/models/invoice_payment_method.rb +10 -0
  99. data/lib/advanced_billing/models/invoice_pre_payment.rb +0 -10
  100. data/lib/advanced_billing/models/invoice_previous_balance.rb +10 -0
  101. data/lib/advanced_billing/models/invoice_refund.rb +10 -0
  102. data/lib/advanced_billing/models/invoice_seller.rb +10 -0
  103. data/lib/advanced_billing/models/invoice_status.rb +2 -2
  104. data/lib/advanced_billing/models/invoice_tax.rb +10 -0
  105. data/lib/advanced_billing/models/invoice_tax_breakout.rb +10 -0
  106. data/lib/advanced_billing/models/invoice_tax_component_breakout.rb +10 -0
  107. data/lib/advanced_billing/models/issue_invoice_event.rb +139 -0
  108. data/lib/advanced_billing/models/issue_invoice_event_data.rb +6 -6
  109. data/lib/advanced_billing/models/issue_service_credit.rb +10 -16
  110. data/lib/advanced_billing/models/item_price_point_changed.rb +8 -4
  111. data/lib/advanced_billing/models/item_price_point_data.rb +10 -0
  112. data/lib/advanced_billing/models/list_components_filter.rb +74 -0
  113. data/lib/advanced_billing/models/list_coupons_filter.rb +168 -0
  114. data/lib/advanced_billing/models/list_invoice_events_response.rb +14 -11
  115. data/lib/advanced_billing/models/{refund_prepayment_aggregated_error.rb → list_mrr_filter.rb} +14 -12
  116. data/lib/advanced_billing/models/{list_subscription_group_prepayment_date_field.rb → list_prepayment_date_field.rb} +4 -4
  117. data/lib/advanced_billing/models/list_prepayments_filter.rb +88 -0
  118. data/lib/advanced_billing/models/list_price_points_filter.rb +163 -0
  119. data/lib/advanced_billing/models/list_products_filter.rb +81 -0
  120. data/lib/advanced_billing/models/list_segments_filter.rb +103 -0
  121. data/lib/advanced_billing/models/list_subscription_components_filter.rb +74 -0
  122. data/lib/advanced_billing/models/list_subscription_components_for_site_filter.rb +84 -0
  123. data/lib/advanced_billing/models/list_subscription_components_include.rb +4 -1
  124. data/lib/advanced_billing/models/metafield_scope.rb +10 -0
  125. data/lib/advanced_billing/models/nested_subscription_group.rb +0 -10
  126. data/lib/advanced_billing/models/origin_invoice.rb +10 -0
  127. data/lib/advanced_billing/models/overage_pricing.rb +14 -0
  128. data/lib/advanced_billing/models/paid_invoice.rb +2 -2
  129. data/lib/advanced_billing/models/payer_attributes.rb +10 -0
  130. data/lib/advanced_billing/models/prepaid_component_price_point.rb +10 -0
  131. data/lib/advanced_billing/models/prepaid_product_price_point_filter.rb +56 -0
  132. data/lib/advanced_billing/models/prepaid_usage.rb +6 -2
  133. data/lib/advanced_billing/models/prepaid_usage_allocation_detail.rb +10 -0
  134. data/lib/advanced_billing/models/product.rb +5 -16
  135. data/lib/advanced_billing/models/product_price_point.rb +9 -0
  136. data/lib/advanced_billing/models/proforma_invoice.rb +2 -2
  137. data/lib/advanced_billing/models/proforma_invoice_issued.rb +6 -2
  138. data/lib/advanced_billing/models/reactivation_billing.rb +10 -0
  139. data/lib/advanced_billing/models/record_payment_response.rb +1 -13
  140. data/lib/advanced_billing/models/refund_invoice_event.rb +139 -0
  141. data/lib/advanced_billing/models/refund_invoice_event_data.rb +4 -2
  142. data/lib/advanced_billing/models/refund_invoice_request.rb +1 -1
  143. data/lib/advanced_billing/models/refund_prepayment.rb +3 -1
  144. data/lib/advanced_billing/models/remove_payment_event.rb +139 -0
  145. data/lib/advanced_billing/models/remove_payment_event_data.rb +1 -1
  146. data/lib/advanced_billing/models/segment_price.rb +10 -0
  147. data/lib/advanced_billing/models/subscription.rb +10 -16
  148. data/lib/advanced_billing/models/subscription_component.rb +26 -7
  149. data/lib/advanced_billing/models/subscription_component_subscription.rb +10 -0
  150. data/lib/advanced_billing/models/subscription_filter.rb +153 -0
  151. data/lib/advanced_billing/models/subscription_group.rb +2 -2
  152. data/lib/advanced_billing/models/subscription_group_bank_account.rb +10 -0
  153. data/lib/advanced_billing/models/subscription_group_component_custom_price.rb +10 -0
  154. data/lib/advanced_billing/models/subscription_group_prepayment_response.rb +3 -1
  155. data/lib/advanced_billing/models/subscription_group_signup.rb +2 -2
  156. data/lib/advanced_billing/models/subscription_group_signup_failure.rb +4 -2
  157. data/lib/advanced_billing/models/subscription_group_signup_failure_data.rb +10 -0
  158. data/lib/advanced_billing/models/subscription_group_signup_item.rb +10 -0
  159. data/lib/advanced_billing/models/subscription_group_signup_response.rb +2 -2
  160. data/lib/advanced_billing/models/subscription_group_signup_success.rb +8 -4
  161. data/lib/advanced_billing/models/subscription_group_signup_success_data.rb +50 -0
  162. data/lib/advanced_billing/models/update_customer.rb +12 -0
  163. data/lib/advanced_billing/models/update_subscription_component.rb +10 -0
  164. data/lib/advanced_billing/models/upsert_prepaid_configuration.rb +10 -0
  165. data/lib/advanced_billing/models/usage.rb +3 -1
  166. data/lib/advanced_billing/models/void_invoice_event.rb +139 -0
  167. data/lib/advanced_billing/models/void_invoice_event_data.rb +8 -7
  168. data/lib/advanced_billing/models/void_remainder_event.rb +139 -0
  169. data/lib/advanced_billing/models/void_remainder_event_data.rb +4 -2
  170. data/lib/advanced_billing/utilities/union_type_lookup.rb +69 -199
  171. data/lib/advanced_billing.rb +42 -18
  172. metadata +38 -17
  173. data/lib/advanced_billing/exceptions/refund_prepayment_aggregated_errors_response_exception.rb +0 -33
  174. data/lib/advanced_billing/models/billing_address.rb +0 -117
  175. data/lib/advanced_billing/models/credit_note1.rb +0 -419
  176. data/lib/advanced_billing/models/customer1.rb +0 -125
  177. data/lib/advanced_billing/models/invoice_event.rb +0 -124
  178. data/lib/advanced_billing/models/invoice_event_data.rb +0 -447
  179. data/lib/advanced_billing/models/invoice_event_payment.rb +0 -168
  180. data/lib/advanced_billing/models/invoice_event_payment1.rb +0 -160
  181. data/lib/advanced_billing/models/prepayment_aggregated_error.rb +0 -81
  182. data/lib/advanced_billing/models/price_point.rb +0 -216
  183. data/lib/advanced_billing/models/refund.rb +0 -138
  184. data/lib/advanced_billing/models/seller.rb +0 -92
  185. data/lib/advanced_billing/models/shipping_address.rb +0 -117
@@ -64,5 +64,27 @@ module AdvancedBilling
64
64
  amount,
65
65
  hash)
66
66
  end
67
+
68
+ # Validates an instance of the object from a given value.
69
+ # @param [CreateInvoicePaymentApplication | Hash] The value against the validation is performed.
70
+ def self.validate(value)
71
+ if value.instance_of? self
72
+ return (
73
+ APIHelper.valid_type?(value.invoice_uid,
74
+ ->(val) { val.instance_of? String }) and
75
+ APIHelper.valid_type?(value.amount,
76
+ ->(val) { val.instance_of? String })
77
+ )
78
+ end
79
+
80
+ return false unless value.instance_of? Hash
81
+
82
+ (
83
+ APIHelper.valid_type?(value['invoice_uid'],
84
+ ->(val) { val.instance_of? String }) and
85
+ APIHelper.valid_type?(value['amount'],
86
+ ->(val) { val.instance_of? String })
87
+ )
88
+ end
67
89
  end
68
90
  end
@@ -126,7 +126,9 @@ module AdvancedBilling
126
126
  UnionTypeLookUp.get(:CreateMultiInvoicePaymentAmount)
127
127
  .validate(value.amount) and
128
128
  APIHelper.valid_type?(value.applications,
129
- ->(val) { CreateInvoicePaymentApplication.validate(val) })
129
+ ->(val) { CreateInvoicePaymentApplication.validate(val) },
130
+ is_model_hash: true,
131
+ is_inner_model_hash: true)
130
132
  )
131
133
  end
132
134
 
@@ -136,7 +138,9 @@ module AdvancedBilling
136
138
  UnionTypeLookUp.get(:CreateMultiInvoicePaymentAmount)
137
139
  .validate(value['amount']) and
138
140
  APIHelper.valid_type?(value['applications'],
139
- ->(val) { CreateInvoicePaymentApplication.validate(val) })
141
+ ->(val) { CreateInvoicePaymentApplication.validate(val) },
142
+ is_model_hash: true,
143
+ is_inner_model_hash: true)
140
144
  )
141
145
  end
142
146
  end
@@ -13,6 +13,10 @@ module AdvancedBilling
13
13
  # @return [Integer]
14
14
  attr_accessor :component_id
15
15
 
16
+ # TODO: Write general description for this method
17
+ # @return [Integer]
18
+ attr_accessor :price_point_id
19
+
16
20
  # TODO: Write general description for this method
17
21
  # @return [Integer]
18
22
  attr_accessor :starting_quantity
@@ -21,6 +25,7 @@ module AdvancedBilling
21
25
  def self.names
22
26
  @_hash = {} if @_hash.nil?
23
27
  @_hash['component_id'] = 'component_id'
28
+ @_hash['price_point_id'] = 'price_point_id'
24
29
  @_hash['starting_quantity'] = 'starting_quantity'
25
30
  @_hash
26
31
  end
@@ -29,6 +34,7 @@ module AdvancedBilling
29
34
  def self.optionals
30
35
  %w[
31
36
  component_id
37
+ price_point_id
32
38
  starting_quantity
33
39
  ]
34
40
  end
@@ -39,9 +45,11 @@ module AdvancedBilling
39
45
  end
40
46
 
41
47
  def initialize(component_id = SKIP,
48
+ price_point_id = SKIP,
42
49
  starting_quantity = SKIP,
43
50
  additional_properties = {})
44
51
  @component_id = component_id unless component_id == SKIP
52
+ @price_point_id = price_point_id unless price_point_id == SKIP
45
53
  @starting_quantity = starting_quantity unless starting_quantity == SKIP
46
54
 
47
55
  # Add additional model properties to the instance.
@@ -56,6 +64,8 @@ module AdvancedBilling
56
64
 
57
65
  # Extract variables from the hash.
58
66
  component_id = hash.key?('component_id') ? hash['component_id'] : SKIP
67
+ price_point_id =
68
+ hash.key?('price_point_id') ? hash['price_point_id'] : SKIP
59
69
  starting_quantity =
60
70
  hash.key?('starting_quantity') ? hash['starting_quantity'] : SKIP
61
71
 
@@ -64,6 +74,7 @@ module AdvancedBilling
64
74
 
65
75
  # Create object from extracted values.
66
76
  CreateOfferComponent.new(component_id,
77
+ price_point_id,
67
78
  starting_quantity,
68
79
  hash)
69
80
  end
@@ -155,13 +155,13 @@ module AdvancedBilling
155
155
  # @return [String]
156
156
  attr_accessor :bank_routing_number
157
157
 
158
- # (Required when creating with ACH, GoCardless, Stripe BECS Direct Debit and
159
- # bank_iban is blank) The customerʼs bank account number
158
+ # (Required when creating with ACH, GoCardless, Stripe BECS or BACS Direct
159
+ # Debit, and bank_iban is blank) The customerʼs bank account number
160
160
  # @return [String]
161
161
  attr_accessor :bank_account_number
162
162
 
163
- # (Optional when creating with GoCardless, required with Stripe BECS Direct
164
- # Debit) Branch code. Alternatively, an IBAN can be provided
163
+ # (Optional when creating with GoCardless, required with Stripe BECS or BACS
164
+ # Direct Debit) Branch/Sort code. Alternatively, an IBAN can be provided
165
165
  # @return [String]
166
166
  attr_accessor :bank_branch_code
167
167
 
@@ -184,9 +184,12 @@ module AdvancedBilling
184
184
  APIHelper.valid_type?(value.pricing_scheme,
185
185
  ->(val) { PricingScheme.validate(val) }) and
186
186
  APIHelper.valid_type?(value.prices,
187
- ->(val) { Price.validate(val) }) and
187
+ ->(val) { Price.validate(val) },
188
+ is_model_hash: true,
189
+ is_inner_model_hash: true) and
188
190
  APIHelper.valid_type?(value.overage_pricing,
189
- ->(val) { OveragePricing.validate(val) })
191
+ ->(val) { OveragePricing.validate(val) },
192
+ is_model_hash: true)
190
193
  )
191
194
  end
192
195
 
@@ -198,9 +201,12 @@ module AdvancedBilling
198
201
  APIHelper.valid_type?(value['pricing_scheme'],
199
202
  ->(val) { PricingScheme.validate(val) }) and
200
203
  APIHelper.valid_type?(value['prices'],
201
- ->(val) { Price.validate(val) }) and
204
+ ->(val) { Price.validate(val) },
205
+ is_model_hash: true,
206
+ is_inner_model_hash: true) and
202
207
  APIHelper.valid_type?(value['overage_pricing'],
203
- ->(val) { OveragePricing.validate(val) })
208
+ ->(val) { OveragePricing.validate(val) },
209
+ is_model_hash: true)
204
210
  )
205
211
  end
206
212
  end
@@ -13,6 +13,10 @@ module AdvancedBilling
13
13
  # @return [String]
14
14
  attr_accessor :name
15
15
 
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :handle
19
+
16
20
  # TODO: Write general description for this method
17
21
  # @return [String]
18
22
  attr_accessor :description
@@ -21,6 +25,7 @@ module AdvancedBilling
21
25
  def self.names
22
26
  @_hash = {} if @_hash.nil?
23
27
  @_hash['name'] = 'name'
28
+ @_hash['handle'] = 'handle'
24
29
  @_hash['description'] = 'description'
25
30
  @_hash
26
31
  end
@@ -28,7 +33,7 @@ module AdvancedBilling
28
33
  # An array for optional fields
29
34
  def self.optionals
30
35
  %w[
31
- name
36
+ handle
32
37
  description
33
38
  ]
34
39
  end
@@ -36,14 +41,17 @@ module AdvancedBilling
36
41
  # An array for nullable fields
37
42
  def self.nullables
38
43
  %w[
44
+ handle
39
45
  description
40
46
  ]
41
47
  end
42
48
 
43
- def initialize(name = SKIP,
49
+ def initialize(name = nil,
50
+ handle = SKIP,
44
51
  description = SKIP,
45
52
  additional_properties = {})
46
- @name = name unless name == SKIP
53
+ @name = name
54
+ @handle = handle unless handle == SKIP
47
55
  @description = description unless description == SKIP
48
56
 
49
57
  # Add additional model properties to the instance.
@@ -57,7 +65,8 @@ module AdvancedBilling
57
65
  return nil unless hash
58
66
 
59
67
  # Extract variables from the hash.
60
- name = hash.key?('name') ? hash['name'] : SKIP
68
+ name = hash.key?('name') ? hash['name'] : nil
69
+ handle = hash.key?('handle') ? hash['handle'] : SKIP
61
70
  description = hash.key?('description') ? hash['description'] : SKIP
62
71
 
63
72
  # Clean out expected properties from Hash.
@@ -65,6 +74,7 @@ module AdvancedBilling
65
74
 
66
75
  # Create object from extracted values.
67
76
  CreateProductFamily.new(name,
77
+ handle,
68
78
  description,
69
79
  hash)
70
80
  end
@@ -437,7 +437,7 @@ module AdvancedBilling
437
437
  custom_price = SKIP,
438
438
  coupon_code = SKIP,
439
439
  coupon_codes = SKIP,
440
- payment_collection_method = CollectionMethod::AUTOMATIC,
440
+ payment_collection_method = SKIP,
441
441
  receives_invoice_emails = SKIP,
442
442
  net_terms = SKIP,
443
443
  customer_id = SKIP,
@@ -580,7 +580,7 @@ module AdvancedBilling
580
580
  coupon_code = hash.key?('coupon_code') ? hash['coupon_code'] : SKIP
581
581
  coupon_codes = hash.key?('coupon_codes') ? hash['coupon_codes'] : SKIP
582
582
  payment_collection_method =
583
- hash['payment_collection_method'] ||= CollectionMethod::AUTOMATIC
583
+ hash.key?('payment_collection_method') ? hash['payment_collection_method'] : SKIP
584
584
  receives_invoice_emails =
585
585
  hash.key?('receives_invoice_emails') ? hash['receives_invoice_emails'] : SKIP
586
586
  net_terms = hash.key?('net_terms') ? hash['net_terms'] : SKIP
@@ -78,5 +78,15 @@ module AdvancedBilling
78
78
  expiration_year,
79
79
  hash)
80
80
  end
81
+
82
+ # Validates an instance of the object from a given value.
83
+ # @param [CreditCardAttributes | Hash] The value against the validation is performed.
84
+ def self.validate(value)
85
+ return true if value.instance_of? self
86
+
87
+ return false unless value.instance_of? Hash
88
+
89
+ true
90
+ end
81
91
  end
82
92
  end
@@ -106,5 +106,15 @@ module AdvancedBilling
106
106
  def to_custom_transaction_time
107
107
  DateTimeHelper.to_rfc3339(transaction_time)
108
108
  end
109
+
110
+ # Validates an instance of the object from a given value.
111
+ # @param [CreditNoteApplication | Hash] The value against the validation is performed.
112
+ def self.validate(value)
113
+ return true if value.instance_of? self
114
+
115
+ return false unless value.instance_of? Hash
116
+
117
+ true
118
+ end
109
119
  end
110
120
  end
@@ -275,5 +275,15 @@ module AdvancedBilling
275
275
  custom_item,
276
276
  hash)
277
277
  end
278
+
279
+ # Validates an instance of the object from a given value.
280
+ # @param [CreditNoteLineItem | Hash] The value against the validation is performed.
281
+ def self.validate(value)
282
+ return true if value.instance_of? self
283
+
284
+ return false unless value.instance_of? Hash
285
+
286
+ true
287
+ end
278
288
  end
279
289
  end
@@ -27,7 +27,9 @@ module AdvancedBilling
27
27
  # @return [String]
28
28
  attr_accessor :cc_emails
29
29
 
30
- # The organization of the customer
30
+ # The organization of the customer. If no value, `null` or empty string is
31
+ # provided, `organization` will be populated with the customer's first and
32
+ # last name, separated with a space.
31
33
  # @return [String]
32
34
  attr_accessor :organization
33
35
 
@@ -402,5 +404,15 @@ module AdvancedBilling
402
404
  def to_custom_portal_invite_last_accepted_at
403
405
  DateTimeHelper.to_rfc3339(portal_invite_last_accepted_at)
404
406
  end
407
+
408
+ # Validates an instance of the object from a given value.
409
+ # @param [Customer | Hash] The value against the validation is performed.
410
+ def self.validate(value)
411
+ return true if value.instance_of? self
412
+
413
+ return false unless value.instance_of? Hash
414
+
415
+ true
416
+ end
405
417
  end
406
418
  end
@@ -249,5 +249,15 @@ module AdvancedBilling
249
249
  parent_id,
250
250
  hash)
251
251
  end
252
+
253
+ # Validates an instance of the object from a given value.
254
+ # @param [CustomerAttributes | Hash] The value against the validation is performed.
255
+ def self.validate(value)
256
+ return true if value.instance_of? self
257
+
258
+ return false unless value.instance_of? Hash
259
+
260
+ true
261
+ end
252
262
  end
253
263
  end
@@ -76,18 +76,13 @@ module AdvancedBilling
76
76
  return nil unless hash
77
77
 
78
78
  # Extract variables from the hash.
79
- payer = hash.key?('payer') ? APIHelper.deserialize_union_type(
80
- UnionTypeLookUp.get(:CustomerChangePayer), hash['payer']
81
- ) : SKIP
82
- shipping_address = hash.key?('shipping_address') ? APIHelper.deserialize_union_type(
83
- UnionTypeLookUp.get(:CustomerChangeShippingAddress), hash['shipping_address']
84
- ) : SKIP
85
- billing_address = hash.key?('billing_address') ? APIHelper.deserialize_union_type(
86
- UnionTypeLookUp.get(:CustomerChangeBillingAddress), hash['billing_address']
87
- ) : SKIP
88
- custom_fields = hash.key?('custom_fields') ? APIHelper.deserialize_union_type(
89
- UnionTypeLookUp.get(:CustomerChangeCustomFields), hash['custom_fields']
90
- ) : SKIP
79
+ payer = CustomerPayerChange.from_hash(hash['payer']) if hash['payer']
80
+ shipping_address = AddressChange.from_hash(hash['shipping_address']) if
81
+ hash['shipping_address']
82
+ billing_address = AddressChange.from_hash(hash['billing_address']) if
83
+ hash['billing_address']
84
+ custom_fields = CustomerCustomFieldsChange.from_hash(hash['custom_fields']) if
85
+ hash['custom_fields']
91
86
 
92
87
  # Clean out expected properties from Hash.
93
88
  names.each_value { |k| hash.delete(k) }
@@ -99,15 +94,5 @@ module AdvancedBilling
99
94
  custom_fields,
100
95
  hash)
101
96
  end
102
-
103
- # Validates an instance of the object from a given value.
104
- # @param [CustomerChange | Hash] The value against the validation is performed.
105
- def self.validate(value)
106
- return true if value.instance_of? self
107
-
108
- return false unless value.instance_of? Hash
109
-
110
- true
111
- end
112
97
  end
113
98
  end
@@ -81,27 +81,5 @@ module AdvancedBilling
81
81
  after,
82
82
  hash)
83
83
  end
84
-
85
- # Validates an instance of the object from a given value.
86
- # @param [CustomerCustomFieldsChange | Hash] The value against the validation is performed.
87
- def self.validate(value)
88
- if value.instance_of? self
89
- return (
90
- APIHelper.valid_type?(value.before,
91
- ->(val) { InvoiceCustomField.validate(val) }) and
92
- APIHelper.valid_type?(value.after,
93
- ->(val) { InvoiceCustomField.validate(val) })
94
- )
95
- end
96
-
97
- return false unless value.instance_of? Hash
98
-
99
- (
100
- APIHelper.valid_type?(value['before'],
101
- ->(val) { InvoiceCustomField.validate(val) }) and
102
- APIHelper.valid_type?(value['after'],
103
- ->(val) { InvoiceCustomField.validate(val) })
104
- )
105
- end
106
84
  end
107
85
  end
@@ -63,27 +63,5 @@ module AdvancedBilling
63
63
  after,
64
64
  hash)
65
65
  end
66
-
67
- # Validates an instance of the object from a given value.
68
- # @param [CustomerPayerChange | Hash] The value against the validation is performed.
69
- def self.validate(value)
70
- if value.instance_of? self
71
- return (
72
- APIHelper.valid_type?(value.before,
73
- ->(val) { InvoicePayerChange.validate(val) }) and
74
- APIHelper.valid_type?(value.after,
75
- ->(val) { InvoicePayerChange.validate(val) })
76
- )
77
- end
78
-
79
- return false unless value.instance_of? Hash
80
-
81
- (
82
- APIHelper.valid_type?(value['before'],
83
- ->(val) { InvoicePayerChange.validate(val) }) and
84
- APIHelper.valid_type?(value['after'],
85
- ->(val) { InvoicePayerChange.validate(val) })
86
- )
87
- end
88
66
  end
89
67
  end