maxio-advanced-billing-sdk 4.0.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +45 -45
  3. data/lib/advanced_billing/configuration.rb +2 -2
  4. data/lib/advanced_billing/controllers/advance_invoice_controller.rb +24 -24
  5. data/lib/advanced_billing/controllers/api_exports_controller.rb +57 -57
  6. data/lib/advanced_billing/controllers/base_controller.rb +10 -10
  7. data/lib/advanced_billing/controllers/billing_portal_controller.rb +33 -32
  8. data/lib/advanced_billing/controllers/component_price_points_controller.rb +60 -60
  9. data/lib/advanced_billing/controllers/components_controller.rb +110 -107
  10. data/lib/advanced_billing/controllers/coupons_controller.rb +89 -89
  11. data/lib/advanced_billing/controllers/custom_fields_controller.rb +76 -76
  12. data/lib/advanced_billing/controllers/customers_controller.rb +45 -41
  13. data/lib/advanced_billing/controllers/events_based_billing_segments_controller.rb +53 -53
  14. data/lib/advanced_billing/controllers/events_controller.rb +16 -15
  15. data/lib/advanced_billing/controllers/insights_controller.rb +17 -17
  16. data/lib/advanced_billing/controllers/invoices_controller.rb +99 -99
  17. data/lib/advanced_billing/controllers/offers_controller.rb +18 -15
  18. data/lib/advanced_billing/controllers/payment_profiles_controller.rb +107 -104
  19. data/lib/advanced_billing/controllers/product_families_controller.rb +26 -26
  20. data/lib/advanced_billing/controllers/product_price_points_controller.rb +62 -62
  21. data/lib/advanced_billing/controllers/products_controller.rb +37 -37
  22. data/lib/advanced_billing/controllers/proforma_invoices_controller.rb +61 -61
  23. data/lib/advanced_billing/controllers/reason_codes_controller.rb +35 -35
  24. data/lib/advanced_billing/controllers/referral_codes_controller.rb +9 -8
  25. data/lib/advanced_billing/controllers/sales_commissions_controller.rb +13 -13
  26. data/lib/advanced_billing/controllers/sites_controller.rb +11 -10
  27. data/lib/advanced_billing/controllers/subscription_components_controller.rb +170 -161
  28. data/lib/advanced_billing/controllers/subscription_group_invoice_account_controller.rb +23 -23
  29. data/lib/advanced_billing/controllers/subscription_group_status_controller.rb +21 -21
  30. data/lib/advanced_billing/controllers/subscription_groups_controller.rb +54 -54
  31. data/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb +37 -37
  32. data/lib/advanced_billing/controllers/subscription_notes_controller.rb +20 -16
  33. data/lib/advanced_billing/controllers/subscription_products_controller.rb +20 -18
  34. data/lib/advanced_billing/controllers/subscription_status_controller.rb +74 -74
  35. data/lib/advanced_billing/controllers/subscriptions_controller.rb +163 -160
  36. data/lib/advanced_billing/controllers/webhooks_controller.rb +45 -44
  37. data/lib/advanced_billing/exceptions/component_allocation_error_exception.rb +15 -15
  38. data/lib/advanced_billing/exceptions/component_price_point_error_exception.rb +15 -15
  39. data/lib/advanced_billing/exceptions/customer_error_response_exception.rb +15 -15
  40. data/lib/advanced_billing/exceptions/error_array_map_response_exception.rb +15 -15
  41. data/lib/advanced_billing/exceptions/error_list_response_exception.rb +15 -15
  42. data/lib/advanced_billing/exceptions/error_string_map_response_exception.rb +15 -15
  43. data/lib/advanced_billing/exceptions/event_based_billing_list_segments_errors_exception.rb +15 -15
  44. data/lib/advanced_billing/exceptions/event_based_billing_segment_errors_exception.rb +15 -15
  45. data/lib/advanced_billing/exceptions/event_based_billing_segment_exception.rb +15 -15
  46. data/lib/advanced_billing/exceptions/product_price_point_error_response_exception.rb +15 -15
  47. data/lib/advanced_billing/exceptions/proforma_bad_request_error_response_exception.rb +15 -15
  48. data/lib/advanced_billing/exceptions/refund_prepayment_base_errors_response_exception.rb +15 -15
  49. data/lib/advanced_billing/exceptions/single_error_response_exception.rb +15 -15
  50. data/lib/advanced_billing/exceptions/single_string_error_response_exception.rb +15 -15
  51. data/lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb +15 -15
  52. data/lib/advanced_billing/exceptions/subscription_component_allocation_error_exception.rb +15 -15
  53. data/lib/advanced_billing/exceptions/subscription_group_create_error_response_exception.rb +15 -15
  54. data/lib/advanced_billing/exceptions/subscription_group_signup_error_response_exception.rb +15 -15
  55. data/lib/advanced_billing/exceptions/subscription_group_update_error_response_exception.rb +15 -15
  56. data/lib/advanced_billing/exceptions/subscription_remove_coupon_errors_exception.rb +15 -15
  57. data/lib/advanced_billing/exceptions/subscriptions_mrr_error_response_exception.rb +15 -15
  58. data/lib/advanced_billing/exceptions/too_many_management_link_requests_error_exception.rb +15 -15
  59. data/lib/advanced_billing/models/activate_event_based_component.rb +84 -0
  60. data/lib/advanced_billing/models/{current_vault.rb → all_vaults.rb} +28 -7
  61. data/lib/advanced_billing/models/allocation.rb +1 -0
  62. data/lib/advanced_billing/models/allocation_preview_item.rb +1 -0
  63. data/lib/advanced_billing/models/apple_pay_payment_profile.rb +232 -0
  64. data/lib/advanced_billing/models/apple_pay_vault.rb +20 -0
  65. data/lib/advanced_billing/models/bank_account_attributes.rb +2 -0
  66. data/lib/advanced_billing/models/bank_account_payment_profile.rb +25 -20
  67. data/lib/advanced_billing/models/bank_account_vault.rb +19 -9
  68. data/lib/advanced_billing/models/change_invoice_status_event_data.rb +6 -6
  69. data/lib/advanced_billing/models/component.rb +1 -0
  70. data/lib/advanced_billing/models/component_custom_price.rb +33 -14
  71. data/lib/advanced_billing/models/component_price_point_item.rb +3 -1
  72. data/lib/advanced_billing/models/create_component_price_point.rb +3 -1
  73. data/lib/advanced_billing/models/create_customer.rb +11 -1
  74. data/lib/advanced_billing/models/create_metafield.rb +2 -1
  75. data/lib/advanced_billing/models/create_or_update_product.rb +7 -4
  76. data/lib/advanced_billing/models/create_payment_profile.rb +1 -1
  77. data/lib/advanced_billing/models/create_prepaid_usage_component_price_point.rb +6 -5
  78. data/lib/advanced_billing/models/create_product_price_point.rb +5 -3
  79. data/lib/advanced_billing/models/create_subscription.rb +27 -25
  80. data/lib/advanced_billing/models/credit_card_payment_profile.rb +17 -16
  81. data/lib/advanced_billing/models/credit_card_vault.rb +117 -0
  82. data/lib/advanced_billing/models/credit_note.rb +2 -2
  83. data/lib/advanced_billing/models/customer.rb +11 -1
  84. data/lib/advanced_billing/models/customer_attributes.rb +12 -1
  85. data/lib/advanced_billing/models/ebb_component.rb +1 -0
  86. data/lib/advanced_billing/models/{extended_interval_unit.rb → expiration_interval_unit.rb} +4 -4
  87. data/lib/advanced_billing/models/full_subscription_group_response.rb +65 -50
  88. data/lib/advanced_billing/models/get_one_time_token_payment_profile.rb +1 -1
  89. data/lib/advanced_billing/models/invoice.rb +19 -9
  90. data/lib/advanced_billing/models/invoice_consolidation_level.rb +2 -2
  91. data/lib/advanced_billing/models/invoice_refund.rb +13 -1
  92. data/lib/advanced_billing/models/invoice_status.rb +2 -2
  93. data/lib/advanced_billing/models/invoice_tax.rb +29 -0
  94. data/lib/advanced_billing/models/invoice_tax_component_breakout.rb +101 -1
  95. data/lib/advanced_billing/models/issue_invoice_event_data.rb +6 -6
  96. data/lib/advanced_billing/models/metered_component.rb +4 -3
  97. data/lib/advanced_billing/models/offer_item.rb +3 -1
  98. data/lib/advanced_billing/models/on_off_component.rb +3 -2
  99. data/lib/advanced_billing/models/paid_invoice.rb +2 -2
  100. data/lib/advanced_billing/models/pay_pal_vault.rb +29 -0
  101. data/lib/advanced_billing/models/payment_profile_attributes.rb +5 -5
  102. data/lib/advanced_billing/models/payment_profile_response.rb +3 -3
  103. data/lib/advanced_billing/models/payment_type.rb +4 -1
  104. data/lib/advanced_billing/models/paypal_payment_profile.rb +242 -0
  105. data/lib/advanced_billing/models/prepaid_usage_component.rb +5 -4
  106. data/lib/advanced_billing/models/product.rb +2 -2
  107. data/lib/advanced_billing/models/product_price_point.rb +2 -2
  108. data/lib/advanced_billing/models/proforma_invoice.rb +6 -6
  109. data/lib/advanced_billing/models/quantity_based_component.rb +4 -3
  110. data/lib/advanced_billing/models/refund_invoice_event_data.rb +4 -4
  111. data/lib/advanced_billing/models/resent_invitation.rb +36 -0
  112. data/lib/advanced_billing/models/subscription.rb +13 -10
  113. data/lib/advanced_billing/models/subscription_component.rb +1 -0
  114. data/lib/advanced_billing/models/subscription_component_subscription.rb +26 -20
  115. data/lib/advanced_billing/models/subscription_custom_price.rb +5 -2
  116. data/lib/advanced_billing/models/subscription_group_bank_account.rb +2 -0
  117. data/lib/advanced_billing/models/subscription_group_credit_card.rb +1 -1
  118. data/lib/advanced_billing/models/subscription_group_signup_response.rb +39 -30
  119. data/lib/advanced_billing/models/subscription_state.rb +30 -30
  120. data/lib/advanced_billing/models/tax_configuration.rb +1 -2
  121. data/lib/advanced_billing/models/update_component_price_point.rb +3 -1
  122. data/lib/advanced_billing/models/update_customer.rb +12 -1
  123. data/lib/advanced_billing/models/update_payment_profile.rb +1 -1
  124. data/lib/advanced_billing/utilities/file_wrapper.rb +9 -9
  125. data/lib/advanced_billing/utilities/union_type_lookup.rb +17 -3
  126. data/lib/advanced_billing.rb +10 -4
  127. metadata +16 -10
@@ -0,0 +1,232 @@
1
+ # advanced_billing
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module AdvancedBilling
7
+ # ApplePayPaymentProfile Model.
8
+ class ApplePayPaymentProfile < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The Chargify-assigned ID of the Apple Pay payment profile.
13
+ # @return [Integer]
14
+ attr_accessor :id
15
+
16
+ # The first name of the Apple Pay account holder
17
+ # @return [String]
18
+ attr_accessor :first_name
19
+
20
+ # The last name of the Apple Pay account holder
21
+ # @return [String]
22
+ attr_accessor :last_name
23
+
24
+ # The Chargify-assigned id for the customer record to which the Apple Pay
25
+ # account belongs
26
+ # @return [Integer]
27
+ attr_accessor :customer_id
28
+
29
+ # The vault that stores the payment profile with the provided vault_token.
30
+ # @return [ApplePayVault]
31
+ attr_accessor :current_vault
32
+
33
+ # The “token” provided by your vault storage for an already stored payment
34
+ # profile
35
+ # @return [String]
36
+ attr_accessor :vault_token
37
+
38
+ # The current billing street address for the Apple Pay account
39
+ # @return [String]
40
+ attr_accessor :billing_address
41
+
42
+ # The current billing address city for the Apple Pay account
43
+ # @return [String]
44
+ attr_accessor :billing_city
45
+
46
+ # The current billing address state for the Apple Pay account
47
+ # @return [String]
48
+ attr_accessor :billing_state
49
+
50
+ # The current billing address zip code for the Apple Pay account
51
+ # @return [String]
52
+ attr_accessor :billing_zip
53
+
54
+ # The current billing address country for the Apple Pay account
55
+ # @return [String]
56
+ attr_accessor :billing_country
57
+
58
+ # The current billing address country for the Apple Pay account
59
+ # @return [String]
60
+ attr_accessor :customer_vault_token
61
+
62
+ # The current billing street address, second line, for the Apple Pay account
63
+ # @return [String]
64
+ attr_accessor :billing_address_2
65
+
66
+ # The current billing street address, second line, for the Apple Pay account
67
+ # @return [PaymentType]
68
+ attr_accessor :payment_type
69
+
70
+ # The current billing street address, second line, for the Apple Pay account
71
+ # @return [Integer]
72
+ attr_accessor :site_gateway_setting_id
73
+
74
+ # The current billing street address, second line, for the Apple Pay account
75
+ # @return [String]
76
+ attr_accessor :gateway_handle
77
+
78
+ # A mapping from model property names to API property names.
79
+ def self.names
80
+ @_hash = {} if @_hash.nil?
81
+ @_hash['id'] = 'id'
82
+ @_hash['first_name'] = 'first_name'
83
+ @_hash['last_name'] = 'last_name'
84
+ @_hash['customer_id'] = 'customer_id'
85
+ @_hash['current_vault'] = 'current_vault'
86
+ @_hash['vault_token'] = 'vault_token'
87
+ @_hash['billing_address'] = 'billing_address'
88
+ @_hash['billing_city'] = 'billing_city'
89
+ @_hash['billing_state'] = 'billing_state'
90
+ @_hash['billing_zip'] = 'billing_zip'
91
+ @_hash['billing_country'] = 'billing_country'
92
+ @_hash['customer_vault_token'] = 'customer_vault_token'
93
+ @_hash['billing_address_2'] = 'billing_address_2'
94
+ @_hash['payment_type'] = 'payment_type'
95
+ @_hash['site_gateway_setting_id'] = 'site_gateway_setting_id'
96
+ @_hash['gateway_handle'] = 'gateway_handle'
97
+ @_hash
98
+ end
99
+
100
+ # An array for optional fields
101
+ def self.optionals
102
+ %w[
103
+ id
104
+ first_name
105
+ last_name
106
+ customer_id
107
+ current_vault
108
+ vault_token
109
+ billing_address
110
+ billing_city
111
+ billing_state
112
+ billing_zip
113
+ billing_country
114
+ customer_vault_token
115
+ billing_address_2
116
+ site_gateway_setting_id
117
+ gateway_handle
118
+ ]
119
+ end
120
+
121
+ # An array for nullable fields
122
+ def self.nullables
123
+ %w[
124
+ billing_address
125
+ billing_city
126
+ billing_state
127
+ billing_zip
128
+ billing_country
129
+ customer_vault_token
130
+ billing_address_2
131
+ site_gateway_setting_id
132
+ gateway_handle
133
+ ]
134
+ end
135
+
136
+ def initialize(payment_type: PaymentType::APPLE_PAY, id: SKIP,
137
+ first_name: SKIP, last_name: SKIP, customer_id: SKIP,
138
+ current_vault: SKIP, vault_token: SKIP,
139
+ billing_address: SKIP, billing_city: SKIP,
140
+ billing_state: SKIP, billing_zip: SKIP,
141
+ billing_country: SKIP, customer_vault_token: SKIP,
142
+ billing_address_2: SKIP, site_gateway_setting_id: SKIP,
143
+ gateway_handle: SKIP, additional_properties: {})
144
+ @id = id unless id == SKIP
145
+ @first_name = first_name unless first_name == SKIP
146
+ @last_name = last_name unless last_name == SKIP
147
+ @customer_id = customer_id unless customer_id == SKIP
148
+ @current_vault = current_vault unless current_vault == SKIP
149
+ @vault_token = vault_token unless vault_token == SKIP
150
+ @billing_address = billing_address unless billing_address == SKIP
151
+ @billing_city = billing_city unless billing_city == SKIP
152
+ @billing_state = billing_state unless billing_state == SKIP
153
+ @billing_zip = billing_zip unless billing_zip == SKIP
154
+ @billing_country = billing_country unless billing_country == SKIP
155
+ @customer_vault_token = customer_vault_token unless customer_vault_token == SKIP
156
+ @billing_address_2 = billing_address_2 unless billing_address_2 == SKIP
157
+ @payment_type = payment_type
158
+ @site_gateway_setting_id = site_gateway_setting_id unless site_gateway_setting_id == SKIP
159
+ @gateway_handle = gateway_handle unless gateway_handle == SKIP
160
+
161
+ # Add additional model properties to the instance.
162
+ additional_properties.each do |_name, _value|
163
+ instance_variable_set("@#{_name}", _value)
164
+ end
165
+ end
166
+
167
+ # Creates an instance of the object from a hash.
168
+ def self.from_hash(hash)
169
+ return nil unless hash
170
+
171
+ # Extract variables from the hash.
172
+ payment_type = hash['payment_type'] ||= PaymentType::APPLE_PAY
173
+ id = hash.key?('id') ? hash['id'] : SKIP
174
+ first_name = hash.key?('first_name') ? hash['first_name'] : SKIP
175
+ last_name = hash.key?('last_name') ? hash['last_name'] : SKIP
176
+ customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP
177
+ current_vault = hash.key?('current_vault') ? hash['current_vault'] : SKIP
178
+ vault_token = hash.key?('vault_token') ? hash['vault_token'] : SKIP
179
+ billing_address =
180
+ hash.key?('billing_address') ? hash['billing_address'] : SKIP
181
+ billing_city = hash.key?('billing_city') ? hash['billing_city'] : SKIP
182
+ billing_state = hash.key?('billing_state') ? hash['billing_state'] : SKIP
183
+ billing_zip = hash.key?('billing_zip') ? hash['billing_zip'] : SKIP
184
+ billing_country =
185
+ hash.key?('billing_country') ? hash['billing_country'] : SKIP
186
+ customer_vault_token =
187
+ hash.key?('customer_vault_token') ? hash['customer_vault_token'] : SKIP
188
+ billing_address_2 =
189
+ hash.key?('billing_address_2') ? hash['billing_address_2'] : SKIP
190
+ site_gateway_setting_id =
191
+ hash.key?('site_gateway_setting_id') ? hash['site_gateway_setting_id'] : SKIP
192
+ gateway_handle =
193
+ hash.key?('gateway_handle') ? hash['gateway_handle'] : SKIP
194
+
195
+ # Clean out expected properties from Hash.
196
+ names.each_value { |k| hash.delete(k) }
197
+
198
+ # Create object from extracted values.
199
+ ApplePayPaymentProfile.new(payment_type: payment_type,
200
+ id: id,
201
+ first_name: first_name,
202
+ last_name: last_name,
203
+ customer_id: customer_id,
204
+ current_vault: current_vault,
205
+ vault_token: vault_token,
206
+ billing_address: billing_address,
207
+ billing_city: billing_city,
208
+ billing_state: billing_state,
209
+ billing_zip: billing_zip,
210
+ billing_country: billing_country,
211
+ customer_vault_token: customer_vault_token,
212
+ billing_address_2: billing_address_2,
213
+ site_gateway_setting_id: site_gateway_setting_id,
214
+ gateway_handle: gateway_handle,
215
+ additional_properties: hash)
216
+ end
217
+
218
+ # Validates an instance of the object from a given value.
219
+ # @param [ApplePayPaymentProfile | Hash] The value against the validation is performed.
220
+ def self.validate(value)
221
+ if value.instance_of? self
222
+ return APIHelper.valid_type?(value.payment_type,
223
+ ->(val) { PaymentType.validate(val) })
224
+ end
225
+
226
+ return false unless value.instance_of? Hash
227
+
228
+ APIHelper.valid_type?(value['payment_type'],
229
+ ->(val) { PaymentType.validate(val) })
230
+ end
231
+ end
232
+ end
@@ -0,0 +1,20 @@
1
+ # advanced_billing
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module AdvancedBilling
7
+ # The vault that stores the payment profile with the provided vault_token.
8
+ class ApplePayVault
9
+ APPLE_PAY_VAULT = [
10
+ # TODO: Write general description for BRAINTREE_BLUE
11
+ BRAINTREE_BLUE = 'braintree_blue'.freeze
12
+ ].freeze
13
+
14
+ def self.validate(value)
15
+ return false if value.nil?
16
+
17
+ APPLE_PAY_VAULT.include?(value)
18
+ end
19
+ end
20
+ end
@@ -53,10 +53,12 @@ module AdvancedBilling
53
53
  attr_accessor :payment_type
54
54
 
55
55
  # The vault that stores the payment profile with the provided vault_token.
56
+ # Use `bogus` for testing.
56
57
  # @return [BankAccountVault]
57
58
  attr_accessor :current_vault
58
59
 
59
60
  # The vault that stores the payment profile with the provided vault_token.
61
+ # Use `bogus` for testing.
60
62
  # @return [String]
61
63
  attr_accessor :vault_token
62
64
 
@@ -29,6 +29,7 @@ module AdvancedBilling
29
29
  attr_accessor :customer_id
30
30
 
31
31
  # The vault that stores the payment profile with the provided vault_token.
32
+ # Use `bogus` for testing.
32
33
  # @return [BankAccountVault]
33
34
  attr_accessor :current_vault
34
35
 
@@ -153,9 +154,9 @@ module AdvancedBilling
153
154
  customer_vault_token
154
155
  billing_address_2
155
156
  bank_name
157
+ masked_bank_routing_number
156
158
  bank_account_type
157
159
  bank_account_holder_type
158
- payment_type
159
160
  verified
160
161
  site_gateway_setting_id
161
162
  gateway_handle
@@ -177,15 +178,16 @@ module AdvancedBilling
177
178
  ]
178
179
  end
179
180
 
180
- def initialize(masked_bank_routing_number:, masked_bank_account_number:,
181
- id: SKIP, first_name: SKIP, last_name: SKIP,
182
- customer_id: SKIP, current_vault: SKIP, vault_token: SKIP,
181
+ def initialize(masked_bank_account_number:,
182
+ payment_type: PaymentType::BANK_ACCOUNT, id: SKIP,
183
+ first_name: SKIP, last_name: SKIP, customer_id: SKIP,
184
+ current_vault: SKIP, vault_token: SKIP,
183
185
  billing_address: SKIP, billing_city: SKIP,
184
186
  billing_state: SKIP, billing_zip: SKIP,
185
187
  billing_country: SKIP, customer_vault_token: SKIP,
186
188
  billing_address_2: SKIP, bank_name: SKIP,
187
- bank_account_type: SKIP, bank_account_holder_type: SKIP,
188
- payment_type: SKIP, verified: false,
189
+ masked_bank_routing_number: SKIP, bank_account_type: SKIP,
190
+ bank_account_holder_type: SKIP, verified: false,
189
191
  site_gateway_setting_id: SKIP, gateway_handle: SKIP,
190
192
  additional_properties: {})
191
193
  @id = id unless id == SKIP
@@ -202,11 +204,14 @@ module AdvancedBilling
202
204
  @customer_vault_token = customer_vault_token unless customer_vault_token == SKIP
203
205
  @billing_address_2 = billing_address_2 unless billing_address_2 == SKIP
204
206
  @bank_name = bank_name unless bank_name == SKIP
205
- @masked_bank_routing_number = masked_bank_routing_number
207
+ unless masked_bank_routing_number == SKIP
208
+ @masked_bank_routing_number =
209
+ masked_bank_routing_number
210
+ end
206
211
  @masked_bank_account_number = masked_bank_account_number
207
212
  @bank_account_type = bank_account_type unless bank_account_type == SKIP
208
213
  @bank_account_holder_type = bank_account_holder_type unless bank_account_holder_type == SKIP
209
- @payment_type = payment_type unless payment_type == SKIP
214
+ @payment_type = payment_type
210
215
  @verified = verified unless verified == SKIP
211
216
  @site_gateway_setting_id = site_gateway_setting_id unless site_gateway_setting_id == SKIP
212
217
  @gateway_handle = gateway_handle unless gateway_handle == SKIP
@@ -222,10 +227,9 @@ module AdvancedBilling
222
227
  return nil unless hash
223
228
 
224
229
  # Extract variables from the hash.
225
- masked_bank_routing_number =
226
- hash.key?('masked_bank_routing_number') ? hash['masked_bank_routing_number'] : nil
227
230
  masked_bank_account_number =
228
231
  hash.key?('masked_bank_account_number') ? hash['masked_bank_account_number'] : nil
232
+ payment_type = hash['payment_type'] ||= PaymentType::BANK_ACCOUNT
229
233
  id = hash.key?('id') ? hash['id'] : SKIP
230
234
  first_name = hash.key?('first_name') ? hash['first_name'] : SKIP
231
235
  last_name = hash.key?('last_name') ? hash['last_name'] : SKIP
@@ -244,11 +248,12 @@ module AdvancedBilling
244
248
  billing_address_2 =
245
249
  hash.key?('billing_address_2') ? hash['billing_address_2'] : SKIP
246
250
  bank_name = hash.key?('bank_name') ? hash['bank_name'] : SKIP
251
+ masked_bank_routing_number =
252
+ hash.key?('masked_bank_routing_number') ? hash['masked_bank_routing_number'] : SKIP
247
253
  bank_account_type =
248
254
  hash.key?('bank_account_type') ? hash['bank_account_type'] : SKIP
249
255
  bank_account_holder_type =
250
256
  hash.key?('bank_account_holder_type') ? hash['bank_account_holder_type'] : SKIP
251
- payment_type = hash.key?('payment_type') ? hash['payment_type'] : SKIP
252
257
  verified = hash['verified'] ||= false
253
258
  site_gateway_setting_id =
254
259
  hash.key?('site_gateway_setting_id') ? hash['site_gateway_setting_id'] : SKIP
@@ -259,8 +264,8 @@ module AdvancedBilling
259
264
  names.each_value { |k| hash.delete(k) }
260
265
 
261
266
  # Create object from extracted values.
262
- BankAccountPaymentProfile.new(masked_bank_routing_number: masked_bank_routing_number,
263
- masked_bank_account_number: masked_bank_account_number,
267
+ BankAccountPaymentProfile.new(masked_bank_account_number: masked_bank_account_number,
268
+ payment_type: payment_type,
264
269
  id: id,
265
270
  first_name: first_name,
266
271
  last_name: last_name,
@@ -275,9 +280,9 @@ module AdvancedBilling
275
280
  customer_vault_token: customer_vault_token,
276
281
  billing_address_2: billing_address_2,
277
282
  bank_name: bank_name,
283
+ masked_bank_routing_number: masked_bank_routing_number,
278
284
  bank_account_type: bank_account_type,
279
285
  bank_account_holder_type: bank_account_holder_type,
280
- payment_type: payment_type,
281
286
  verified: verified,
282
287
  site_gateway_setting_id: site_gateway_setting_id,
283
288
  gateway_handle: gateway_handle,
@@ -289,20 +294,20 @@ module AdvancedBilling
289
294
  def self.validate(value)
290
295
  if value.instance_of? self
291
296
  return (
292
- APIHelper.valid_type?(value.masked_bank_routing_number,
297
+ APIHelper.valid_type?(value.masked_bank_account_number,
293
298
  ->(val) { val.instance_of? String }) and
294
- APIHelper.valid_type?(value.masked_bank_account_number,
295
- ->(val) { val.instance_of? String })
299
+ APIHelper.valid_type?(value.payment_type,
300
+ ->(val) { PaymentType.validate(val) })
296
301
  )
297
302
  end
298
303
 
299
304
  return false unless value.instance_of? Hash
300
305
 
301
306
  (
302
- APIHelper.valid_type?(value['masked_bank_routing_number'],
307
+ APIHelper.valid_type?(value['masked_bank_account_number'],
303
308
  ->(val) { val.instance_of? String }) and
304
- APIHelper.valid_type?(value['masked_bank_account_number'],
305
- ->(val) { val.instance_of? String })
309
+ APIHelper.valid_type?(value['payment_type'],
310
+ ->(val) { PaymentType.validate(val) })
306
311
  )
307
312
  end
308
313
  end
@@ -4,23 +4,33 @@
4
4
  # ( https://apimatic.io ).
5
5
 
6
6
  module AdvancedBilling
7
- # The vault that stores the payment profile with the provided vault_token.
7
+ # The vault that stores the payment profile with the provided vault_token. Use
8
+ # `bogus` for testing.
8
9
  class BankAccountVault
9
10
  BANK_ACCOUNT_VAULT = [
10
- # TODO: Write general description for BOGUS
11
- BOGUS = 'bogus'.freeze,
12
-
13
11
  # TODO: Write general description for AUTHORIZENET
14
12
  AUTHORIZENET = 'authorizenet'.freeze,
15
13
 
16
- # TODO: Write general description for STRIPE_CONNECT
17
- STRIPE_CONNECT = 'stripe_connect'.freeze,
14
+ # TODO: Write general description for BLUE_SNAP
15
+ BLUE_SNAP = 'blue_snap'.freeze,
18
16
 
19
- # TODO: Write general description for BRAINTREE_BLUE
20
- BRAINTREE_BLUE = 'braintree_blue'.freeze,
17
+ # TODO: Write general description for BOGUS
18
+ BOGUS = 'bogus'.freeze,
19
+
20
+ # TODO: Write general description for FORTE
21
+ FORTE = 'forte'.freeze,
21
22
 
22
23
  # TODO: Write general description for GOCARDLESS
23
- GOCARDLESS = 'gocardless'.freeze
24
+ GOCARDLESS = 'gocardless'.freeze,
25
+
26
+ # TODO: Write general description for MAXIO_PAYMENTS
27
+ MAXIO_PAYMENTS = 'maxio_payments'.freeze,
28
+
29
+ # TODO: Write general description for MAXP
30
+ MAXP = 'maxp'.freeze,
31
+
32
+ # TODO: Write general description for STRIPE_CONNECT
33
+ STRIPE_CONNECT = 'stripe_connect'.freeze
24
34
  ].freeze
25
35
 
26
36
  def self.validate(value)
@@ -19,22 +19,22 @@ module AdvancedBilling
19
19
  attr_accessor :amount
20
20
 
21
21
  # The status of the invoice before any changes occurred. See [Invoice
22
- # Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/54050787942
23
- # 53-Introduction-to-Invoices#invoice-statuses) for more.
22
+ # Statuses](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advan
23
+ # ced-Billing-Invoices-Overview#invoice-statuses) for more.
24
24
  # @return [InvoiceStatus]
25
25
  attr_accessor :from_status
26
26
 
27
27
  # The updated status of the invoice after changes have been made. See
28
28
  # [Invoice
29
- # Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/54050787942
30
- # 53-Introduction-to-Invoices#invoice-statuses) for more.
29
+ # Statuses](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advan
30
+ # ced-Billing-Invoices-Overview#invoice-statuses) for more.
31
31
  # @return [InvoiceStatus]
32
32
  attr_accessor :to_status
33
33
 
34
34
  # The updated status of the invoice after changes have been made. See
35
35
  # [Invoice
36
- # Statuses](https://maxio-chargify.zendesk.com/hc/en-us/articles/54050787942
37
- # 53-Introduction-to-Invoices#invoice-statuses) for more.
36
+ # Statuses](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advan
37
+ # ced-Billing-Invoices-Overview#invoice-statuses) for more.
38
38
  # @return [InvoiceConsolidationLevel]
39
39
  attr_accessor :consolidation_level
40
40
 
@@ -274,6 +274,7 @@ module AdvancedBilling
274
274
  item_category
275
275
  use_site_exchange_rate
276
276
  accounting_code
277
+ interval_unit
277
278
  ]
278
279
  end
279
280
 
@@ -10,6 +10,10 @@ module AdvancedBilling
10
10
  SKIP = Object.new
11
11
  private_constant :SKIP
12
12
 
13
+ # Whether or not the price point includes tax
14
+ # @return [TrueClass | FalseClass]
15
+ attr_accessor :tax_included
16
+
13
17
  # Omit for On/Off components
14
18
  # @return [PricingScheme]
15
19
  attr_accessor :pricing_scheme
@@ -34,6 +38,7 @@ module AdvancedBilling
34
38
  # A mapping from model property names to API property names.
35
39
  def self.names
36
40
  @_hash = {} if @_hash.nil?
41
+ @_hash['tax_included'] = 'tax_included'
37
42
  @_hash['pricing_scheme'] = 'pricing_scheme'
38
43
  @_hash['interval'] = 'interval'
39
44
  @_hash['interval_unit'] = 'interval_unit'
@@ -44,24 +49,28 @@ module AdvancedBilling
44
49
  # An array for optional fields
45
50
  def self.optionals
46
51
  %w[
52
+ tax_included
47
53
  pricing_scheme
48
54
  interval
49
55
  interval_unit
50
- prices
51
56
  ]
52
57
  end
53
58
 
54
59
  # An array for nullable fields
55
60
  def self.nullables
56
- []
61
+ %w[
62
+ interval_unit
63
+ ]
57
64
  end
58
65
 
59
- def initialize(pricing_scheme: SKIP, interval: SKIP, interval_unit: SKIP,
60
- prices: SKIP, additional_properties: {})
66
+ def initialize(prices:, tax_included: SKIP, pricing_scheme: SKIP,
67
+ interval: SKIP, interval_unit: SKIP,
68
+ additional_properties: {})
69
+ @tax_included = tax_included unless tax_included == SKIP
61
70
  @pricing_scheme = pricing_scheme unless pricing_scheme == SKIP
62
71
  @interval = interval unless interval == SKIP
63
72
  @interval_unit = interval_unit unless interval_unit == SKIP
64
- @prices = prices unless prices == SKIP
73
+ @prices = prices
65
74
 
66
75
  # Add additional model properties to the instance.
67
76
  additional_properties.each do |_name, _value|
@@ -74,10 +83,6 @@ module AdvancedBilling
74
83
  return nil unless hash
75
84
 
76
85
  # Extract variables from the hash.
77
- pricing_scheme =
78
- hash.key?('pricing_scheme') ? hash['pricing_scheme'] : SKIP
79
- interval = hash.key?('interval') ? hash['interval'] : SKIP
80
- interval_unit = hash.key?('interval_unit') ? hash['interval_unit'] : SKIP
81
86
  # Parameter is an array, so we need to iterate through it
82
87
  prices = nil
83
88
  unless hash['prices'].nil?
@@ -87,27 +92,41 @@ module AdvancedBilling
87
92
  end
88
93
  end
89
94
 
90
- prices = SKIP unless hash.key?('prices')
95
+ prices = nil unless hash.key?('prices')
96
+ tax_included = hash.key?('tax_included') ? hash['tax_included'] : SKIP
97
+ pricing_scheme =
98
+ hash.key?('pricing_scheme') ? hash['pricing_scheme'] : SKIP
99
+ interval = hash.key?('interval') ? hash['interval'] : SKIP
100
+ interval_unit = hash.key?('interval_unit') ? hash['interval_unit'] : SKIP
91
101
 
92
102
  # Clean out expected properties from Hash.
93
103
  names.each_value { |k| hash.delete(k) }
94
104
 
95
105
  # Create object from extracted values.
96
- ComponentCustomPrice.new(pricing_scheme: pricing_scheme,
106
+ ComponentCustomPrice.new(prices: prices,
107
+ tax_included: tax_included,
108
+ pricing_scheme: pricing_scheme,
97
109
  interval: interval,
98
110
  interval_unit: interval_unit,
99
- prices: prices,
100
111
  additional_properties: hash)
101
112
  end
102
113
 
103
114
  # Validates an instance of the object from a given value.
104
115
  # @param [ComponentCustomPrice | Hash] The value against the validation is performed.
105
116
  def self.validate(value)
106
- return true if value.instance_of? self
117
+ if value.instance_of? self
118
+ return APIHelper.valid_type?(value.prices,
119
+ ->(val) { Price.validate(val) },
120
+ is_model_hash: true,
121
+ is_inner_model_hash: true)
122
+ end
107
123
 
108
124
  return false unless value.instance_of? Hash
109
125
 
110
- true
126
+ APIHelper.valid_type?(value['prices'],
127
+ ->(val) { Price.validate(val) },
128
+ is_model_hash: true,
129
+ is_inner_model_hash: true)
111
130
  end
112
131
  end
113
132
  end
@@ -68,7 +68,9 @@ module AdvancedBilling
68
68
 
69
69
  # An array for nullable fields
70
70
  def self.nullables
71
- []
71
+ %w[
72
+ interval_unit
73
+ ]
72
74
  end
73
75
 
74
76
  def initialize(name: SKIP, handle: SKIP, pricing_scheme: SKIP,
@@ -78,7 +78,9 @@ module AdvancedBilling
78
78
 
79
79
  # An array for nullable fields
80
80
  def self.nullables
81
- []
81
+ %w[
82
+ interval_unit
83
+ ]
82
84
  end
83
85
 
84
86
  def initialize(name:, pricing_scheme:, prices:, handle: SKIP,
@@ -82,6 +82,10 @@ module AdvancedBilling
82
82
  # @return [Integer]
83
83
  attr_accessor :parent_id
84
84
 
85
+ # The Salesforce ID of the customer
86
+ # @return [String]
87
+ attr_accessor :salesforce_id
88
+
85
89
  # A mapping from model property names to API property names.
86
90
  def self.names
87
91
  @_hash = {} if @_hash.nil?
@@ -103,6 +107,7 @@ module AdvancedBilling
103
107
  @_hash['tax_exempt'] = 'tax_exempt'
104
108
  @_hash['tax_exempt_reason'] = 'tax_exempt_reason'
105
109
  @_hash['parent_id'] = 'parent_id'
110
+ @_hash['salesforce_id'] = 'salesforce_id'
106
111
  @_hash
107
112
  end
108
113
 
@@ -124,6 +129,7 @@ module AdvancedBilling
124
129
  tax_exempt
125
130
  tax_exempt_reason
126
131
  parent_id
132
+ salesforce_id
127
133
  ]
128
134
  end
129
135
 
@@ -131,6 +137,7 @@ module AdvancedBilling
131
137
  def self.nullables
132
138
  %w[
133
139
  parent_id
140
+ salesforce_id
134
141
  ]
135
142
  end
136
143
 
@@ -139,7 +146,7 @@ module AdvancedBilling
139
146
  address_2: SKIP, city: SKIP, state: SKIP, zip: SKIP,
140
147
  country: SKIP, phone: SKIP, locale: SKIP, vat_number: SKIP,
141
148
  tax_exempt: SKIP, tax_exempt_reason: SKIP, parent_id: SKIP,
142
- additional_properties: {})
149
+ salesforce_id: SKIP, additional_properties: {})
143
150
  @first_name = first_name
144
151
  @last_name = last_name
145
152
  @email = email
@@ -158,6 +165,7 @@ module AdvancedBilling
158
165
  @tax_exempt = tax_exempt unless tax_exempt == SKIP
159
166
  @tax_exempt_reason = tax_exempt_reason unless tax_exempt_reason == SKIP
160
167
  @parent_id = parent_id unless parent_id == SKIP
168
+ @salesforce_id = salesforce_id unless salesforce_id == SKIP
161
169
 
162
170
  # Add additional model properties to the instance.
163
171
  additional_properties.each do |_name, _value|
@@ -189,6 +197,7 @@ module AdvancedBilling
189
197
  tax_exempt_reason =
190
198
  hash.key?('tax_exempt_reason') ? hash['tax_exempt_reason'] : SKIP
191
199
  parent_id = hash.key?('parent_id') ? hash['parent_id'] : SKIP
200
+ salesforce_id = hash.key?('salesforce_id') ? hash['salesforce_id'] : SKIP
192
201
 
193
202
  # Clean out expected properties from Hash.
194
203
  names.each_value { |k| hash.delete(k) }
@@ -212,6 +221,7 @@ module AdvancedBilling
212
221
  tax_exempt: tax_exempt,
213
222
  tax_exempt_reason: tax_exempt_reason,
214
223
  parent_id: parent_id,
224
+ salesforce_id: salesforce_id,
215
225
  additional_properties: hash)
216
226
  end
217
227
  end