braintree 4.15.0 → 4.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/braintree/account_updater_daily_report.rb +3 -3
- data/lib/braintree/ach_mandate.rb +1 -1
- data/lib/braintree/add_on_gateway.rb +1 -1
- data/lib/braintree/address.rb +4 -4
- data/lib/braintree/address_gateway.rb +5 -5
- data/lib/braintree/advanced_search.rb +10 -10
- data/lib/braintree/apple_pay.rb +3 -3
- data/lib/braintree/apple_pay_card.rb +3 -3
- data/lib/braintree/apple_pay_options.rb +3 -3
- data/lib/braintree/authorization_adjustment.rb +3 -3
- data/lib/braintree/base_module.rb +1 -1
- data/lib/braintree/bin_data.rb +2 -2
- data/lib/braintree/client_token_gateway.rb +1 -1
- data/lib/braintree/configuration.rb +22 -22
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
- data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
- data/lib/braintree/credit_card.rb +9 -9
- data/lib/braintree/credit_card_gateway.rb +8 -8
- data/lib/braintree/credit_card_verification.rb +3 -3
- data/lib/braintree/credit_card_verification_gateway.rb +28 -11
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +5 -9
- data/lib/braintree/customer_gateway.rb +7 -7
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/descriptor.rb +1 -1
- data/lib/braintree/digest.rb +1 -1
- data/lib/braintree/disbursement.rb +5 -5
- data/lib/braintree/discount_gateway.rb +1 -1
- data/lib/braintree/dispute/evidence.rb +1 -1
- data/lib/braintree/dispute/paypal_message.rb +1 -1
- data/lib/braintree/dispute/status_history.rb +1 -1
- data/lib/braintree/dispute/transaction.rb +1 -1
- data/lib/braintree/dispute/transaction_details.rb +1 -1
- data/lib/braintree/dispute.rb +3 -3
- data/lib/braintree/dispute_gateway.rb +1 -1
- data/lib/braintree/dispute_search.rb +1 -1
- data/lib/braintree/document_upload.rb +2 -2
- data/lib/braintree/document_upload_gateway.rb +3 -3
- data/lib/braintree/enriched_customer_data.rb +2 -2
- data/lib/braintree/error_codes.rb +4 -0
- data/lib/braintree/error_result.rb +2 -3
- data/lib/braintree/errors.rb +3 -3
- data/lib/braintree/exceptions.rb +1 -2
- data/lib/braintree/exchange_rate.rb +2 -2
- data/lib/braintree/exchange_rate_quote.rb +3 -3
- data/lib/braintree/exchange_rate_quote_gateway.rb +1 -1
- data/lib/braintree/exchange_rate_quote_input.rb +3 -3
- data/lib/braintree/exchange_rate_quote_request.rb +3 -3
- data/lib/braintree/exchange_rate_quote_response.rb +3 -3
- data/lib/braintree/facilitated_details.rb +1 -1
- data/lib/braintree/facilitator_details.rb +1 -1
- data/lib/braintree/google_pay_card.rb +3 -3
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +1 -1
- data/lib/braintree/http.rb +5 -5
- data/lib/braintree/local_payment_completed.rb +2 -2
- data/lib/braintree/local_payment_expired.rb +2 -2
- data/lib/braintree/local_payment_funded.rb +2 -2
- data/lib/braintree/local_payment_reversed.rb +2 -2
- data/lib/braintree/merchant.rb +3 -3
- data/lib/braintree/merchant_account.rb +2 -2
- data/lib/braintree/merchant_account_gateway.rb +9 -9
- data/lib/braintree/meta_checkout_card.rb +89 -0
- data/lib/braintree/meta_checkout_token.rb +88 -0
- data/lib/braintree/modification.rb +3 -3
- data/lib/braintree/oauth_credentials.rb +3 -3
- data/lib/braintree/paginated_collection.rb +2 -2
- data/lib/braintree/paginated_result.rb +1 -1
- data/lib/braintree/payment_instrument_type.rb +2 -0
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +2 -2
- data/lib/braintree/payment_method_gateway.rb +8 -7
- data/lib/braintree/payment_method_nonce.rb +4 -4
- data/lib/braintree/payment_method_nonce_details.rb +1 -1
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +1 -1
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/paypal_account.rb +1 -2
- data/lib/braintree/paypal_account_gateway.rb +5 -5
- data/lib/braintree/plan.rb +1 -1
- data/lib/braintree/plan_gateway.rb +2 -2
- data/lib/braintree/resource_collection.rb +2 -2
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data.rb +1 -1
- data/lib/braintree/samsung_pay_card.rb +5 -5
- data/lib/braintree/sepa_direct_debit_account.rb +2 -2
- data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +1 -1
- data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
- data/lib/braintree/sha256_digest.rb +1 -1
- data/lib/braintree/subscription/status_details.rb +1 -1
- data/lib/braintree/subscription.rb +2 -2
- data/lib/braintree/subscription_gateway.rb +6 -6
- data/lib/braintree/subscription_search.rb +1 -1
- data/lib/braintree/successful_result.rb +2 -2
- data/lib/braintree/test/credit_card.rb +7 -10
- data/lib/braintree/test/merchant_account.rb +1 -1
- data/lib/braintree/test/nonce.rb +3 -0
- data/lib/braintree/test/transaction_amounts.rb +2 -3
- data/lib/braintree/testing_gateway.rb +1 -1
- data/lib/braintree/three_d_secure_info.rb +1 -1
- data/lib/braintree/transaction/address_details.rb +2 -1
- data/lib/braintree/transaction/credit_card_details.rb +1 -1
- data/lib/braintree/transaction/customer_details.rb +1 -1
- data/lib/braintree/transaction/disbursement_details.rb +1 -1
- data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
- data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
- data/lib/braintree/transaction/package_details.rb +16 -0
- data/lib/braintree/transaction/samsung_pay_card_details.rb +1 -1
- data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +1 -1
- data/lib/braintree/transaction/status_details.rb +1 -1
- data/lib/braintree/transaction/subscription_details.rb +1 -1
- data/lib/braintree/transaction/us_bank_account_details.rb +1 -1
- data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
- data/lib/braintree/transaction.rb +32 -16
- data/lib/braintree/transaction_gateway.rb +30 -13
- data/lib/braintree/transaction_line_item.rb +13 -10
- data/lib/braintree/transaction_line_item_gateway.rb +1 -1
- data/lib/braintree/transaction_review.rb +1 -1
- data/lib/braintree/transaction_search.rb +1 -1
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +2 -2
- data/lib/braintree/us_bank_account_verification.rb +23 -15
- data/lib/braintree/us_bank_account_verification_search.rb +1 -1
- data/lib/braintree/util.rb +3 -3
- data/lib/braintree/validation_error.rb +1 -1
- data/lib/braintree/validation_error_collection.rb +3 -3
- data/lib/braintree/venmo_account.rb +3 -3
- data/lib/braintree/venmo_profile_data.rb +6 -4
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +7 -7
- data/lib/braintree/webhook_notification.rb +2 -2
- data/lib/braintree/webhook_notification_gateway.rb +4 -4
- data/lib/braintree/webhook_testing.rb +1 -1
- data/lib/braintree/webhook_testing_gateway.rb +1 -1
- data/lib/braintree/xml/generator.rb +1 -1
- data/lib/braintree/xml/libxml.rb +1 -1
- data/lib/braintree/xml/parser.rb +3 -3
- data/lib/braintree/xml/rexml.rb +2 -2
- data/lib/braintree/xml.rb +1 -1
- data/lib/braintree.rb +5 -1
- data/spec/integration/braintree/client_api/spec_helper.rb +2 -2
- data/spec/integration/braintree/credit_card_spec.rb +4 -5
- data/spec/integration/braintree/credit_card_verification_spec.rb +46 -1
- data/spec/integration/braintree/customer_spec.rb +4 -4
- data/spec/integration/braintree/dispute_search_spec.rb +0 -1
- data/spec/integration/braintree/package_tracking_spec.rb +111 -0
- data/spec/integration/braintree/payment_method_nonce_spec.rb +20 -0
- data/spec/integration/braintree/payment_method_spec.rb +2 -2
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +72 -0
- data/spec/integration/braintree/transaction_line_item_spec.rb +6 -0
- data/spec/integration/braintree/transaction_search_spec.rb +27 -0
- data/spec/integration/braintree/transaction_spec.rb +299 -89
- data/spec/unit/braintree/base_module_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +13 -8
- data/spec/unit/braintree/enriched_customer_data_spec.rb +9 -0
- data/spec/unit/braintree/http_spec.rb +1 -1
- data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
- data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
- data/spec/unit/braintree/package_tracking_spec.rb +74 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +32 -3
- data/spec/unit/braintree/us_bank_account_verification_spec.rb +5 -0
- data/spec/unit/braintree/venmo_profile_data_spec.rb +11 -0
- metadata +13 -2
@@ -77,9 +77,9 @@ module Braintree
|
|
77
77
|
All = constants.map { |c| const_get(c) }
|
78
78
|
end
|
79
79
|
|
80
|
-
module Type
|
81
|
-
Credit = "credit"
|
82
|
-
Sale = "sale"
|
80
|
+
module Type
|
81
|
+
Credit = "credit"
|
82
|
+
Sale = "sale"
|
83
83
|
|
84
84
|
All = constants.map { |c| const_get(c) }
|
85
85
|
end
|
@@ -131,23 +131,26 @@ module Braintree
|
|
131
131
|
attr_reader :merchant_account_id
|
132
132
|
attr_reader :merchant_advice_code
|
133
133
|
attr_reader :merchant_advice_code_text
|
134
|
+
attr_reader :meta_checkout_card_details
|
135
|
+
attr_reader :meta_checkout_token_details
|
134
136
|
attr_reader :network_response_code # Response code from the card network
|
135
137
|
attr_reader :network_response_text # Response text from the card network
|
136
138
|
attr_reader :network_token_details
|
137
139
|
attr_reader :network_transaction_id
|
138
140
|
attr_reader :order_id
|
141
|
+
attr_reader :packages
|
139
142
|
attr_reader :partial_settlement_transaction_ids
|
140
143
|
attr_reader :payment_instrument_type
|
141
144
|
attr_reader :payment_receipt
|
142
145
|
attr_reader :paypal_details
|
143
146
|
attr_reader :paypal_here_details
|
144
147
|
attr_reader :plan_id
|
145
|
-
attr_reader :processor_authorization_code
|
146
|
-
attr_reader :processor_response_code
|
147
|
-
attr_reader :processor_response_text
|
148
|
-
attr_reader :processor_response_type
|
149
|
-
attr_reader :processor_settlement_response_code
|
150
|
-
attr_reader :processor_settlement_response_text
|
148
|
+
attr_reader :processor_authorization_code
|
149
|
+
attr_reader :processor_response_code
|
150
|
+
attr_reader :processor_response_text
|
151
|
+
attr_reader :processor_response_type
|
152
|
+
attr_reader :processor_settlement_response_code
|
153
|
+
attr_reader :processor_settlement_response_text
|
151
154
|
attr_reader :product_sku
|
152
155
|
attr_reader :purchase_order_number
|
153
156
|
attr_reader :recurring
|
@@ -175,7 +178,7 @@ module Braintree
|
|
175
178
|
attr_reader :tax_amount
|
176
179
|
attr_reader :tax_exempt
|
177
180
|
attr_reader :three_d_secure_info
|
178
|
-
attr_reader :type
|
181
|
+
attr_reader :type
|
179
182
|
attr_reader :updated_at
|
180
183
|
attr_reader :us_bank_account_details
|
181
184
|
attr_reader :venmo_account_details
|
@@ -282,6 +285,14 @@ module Braintree
|
|
282
285
|
return_object_or_raise(:transaction) { update_details(*args) }
|
283
286
|
end
|
284
287
|
|
288
|
+
def self.package_tracking(*args)
|
289
|
+
Configuration.gateway.transaction.package_tracking(*args)
|
290
|
+
end
|
291
|
+
|
292
|
+
def self.package_tracking!(*args)
|
293
|
+
Configuration.gateway.transaction.package_tracking!(*args)
|
294
|
+
end
|
295
|
+
|
285
296
|
def self.submit_for_partial_settlement(*args)
|
286
297
|
Configuration.gateway.transaction.submit_for_partial_settlement(*args)
|
287
298
|
end
|
@@ -298,7 +309,7 @@ module Braintree
|
|
298
309
|
Configuration.gateway.transaction.void!(*args)
|
299
310
|
end
|
300
311
|
|
301
|
-
def initialize(gateway, attributes)
|
312
|
+
def initialize(gateway, attributes)
|
302
313
|
@gateway = gateway
|
303
314
|
set_instance_variables_from_hash(attributes)
|
304
315
|
|
@@ -313,6 +324,8 @@ module Braintree
|
|
313
324
|
@disbursement_details = DisbursementDetails.new(@disbursement_details)
|
314
325
|
@google_pay_details = GooglePayDetails.new(@google_pay_card)
|
315
326
|
@local_payment_details = LocalPaymentDetails.new(@local_payment)
|
327
|
+
@meta_checkout_card_details = MetaCheckoutCardDetails.new(attributes[:meta_checkout_card])
|
328
|
+
@meta_checkout_token_details = MetaCheckoutTokenDetails.new(attributes[:meta_checkout_token])
|
316
329
|
@payment_instrument_type = attributes[:payment_instrument_type]
|
317
330
|
@payment_receipt = PaymentReceipt.new(attributes[:payment_receipt]) if attributes[:payment_receipt]
|
318
331
|
@paypal_details = PayPalDetails.new(@paypal)
|
@@ -321,6 +334,7 @@ module Braintree
|
|
321
334
|
@sca_exemption_requested = attributes[:sca_exemption_requested]
|
322
335
|
@sepa_direct_debit_account_details = SepaDirectDebitAccountDetails.new(@sepa_debit_account_detail)
|
323
336
|
@service_fee_amount = Util.to_big_decimal(service_fee_amount)
|
337
|
+
@packages = attributes[:shipments] ? attributes[:shipments].map { |pd| PackageDetails.new(pd) } : []
|
324
338
|
@shipping_details = AddressDetails.new(@shipping)
|
325
339
|
@status_history = attributes[:status_history] ? attributes[:status_history].map { |s| StatusDetails.new(s) } : []
|
326
340
|
@subscription_details = SubscriptionDetails.new(@subscription)
|
@@ -342,7 +356,7 @@ module Braintree
|
|
342
356
|
refunded_installments.map! { |attrs| Installment.new(attrs) } if refunded_installments
|
343
357
|
end
|
344
358
|
|
345
|
-
def inspect
|
359
|
+
def inspect
|
346
360
|
first = [:id, :type, :amount, :status]
|
347
361
|
order = first + (self.class._attributes - first)
|
348
362
|
nice_attributes = order.map do |attr|
|
@@ -359,12 +373,10 @@ module Braintree
|
|
359
373
|
@gateway.transaction_line_item.find_all(id)
|
360
374
|
end
|
361
375
|
|
362
|
-
# Returns true if the transaction has been refunded. False otherwise.
|
363
376
|
def refunded?
|
364
377
|
!@refund_id.nil?
|
365
378
|
end
|
366
379
|
|
367
|
-
# Returns true if the transaction has been disbursed. False otherwise.
|
368
380
|
def disbursed?
|
369
381
|
@disbursement_details.valid?
|
370
382
|
end
|
@@ -373,6 +385,7 @@ module Braintree
|
|
373
385
|
# vault_billing_address will return the associated Braintree::Address. Because the
|
374
386
|
# vault billing address can be updated after the transaction was created, the attributes
|
375
387
|
# on vault_billing_address may not match the attributes on billing_details.
|
388
|
+
# NEXT_MAJOR_VERSION these methods are not documented in the developer docs, remove
|
376
389
|
def vault_billing_address
|
377
390
|
return nil if billing_details.id.nil?
|
378
391
|
@gateway.address.find(customer_details.id, billing_details.id)
|
@@ -382,6 +395,7 @@ module Braintree
|
|
382
395
|
# vault_credit_card will return the associated Braintree::CreditCard. Because the
|
383
396
|
# vault credit card can be updated after the transaction was created, the attributes
|
384
397
|
# on vault_credit_card may not match the attributes on credit_card_details.
|
398
|
+
# NEXT_MAJOR_VERSION these methods are not documented in the developer docs, remove
|
385
399
|
def vault_credit_card
|
386
400
|
return nil if credit_card_details.token.nil?
|
387
401
|
@gateway.credit_card.find(credit_card_details.token)
|
@@ -391,6 +405,7 @@ module Braintree
|
|
391
405
|
# vault_customer will return the associated Braintree::Customer. Because the
|
392
406
|
# vault customer can be updated after the transaction was created, the attributes
|
393
407
|
# on vault_customer may not match the attributes on customer_details.
|
408
|
+
# NEXT_MAJOR_VERSION these methods are not documented in the developer docs, remove
|
394
409
|
def vault_customer
|
395
410
|
return nil if customer_details.id.nil?
|
396
411
|
@gateway.customer.find(customer_details.id)
|
@@ -400,6 +415,7 @@ module Braintree
|
|
400
415
|
# vault_shipping_address will return the associated Braintree::Address. Because the
|
401
416
|
# vault shipping address can be updated after the transaction was created, the attributes
|
402
417
|
# on vault_shipping_address may not match the attributes on shipping_details.
|
418
|
+
# NEXT_MAJOR_VERSION these methods are not documented in the developer docs, remove
|
403
419
|
def vault_shipping_address
|
404
420
|
return nil if shipping_details.id.nil?
|
405
421
|
@gateway.address.find(customer_details.id, shipping_details.id)
|
@@ -411,12 +427,12 @@ module Braintree
|
|
411
427
|
|
412
428
|
class << self
|
413
429
|
protected :new
|
414
|
-
def _new(*args)
|
430
|
+
def _new(*args)
|
415
431
|
self.new(*args)
|
416
432
|
end
|
417
433
|
end
|
418
434
|
|
419
|
-
def self._attributes
|
435
|
+
def self._attributes
|
420
436
|
[:amount, :created_at, :credit_card_details, :customer_details, :id, :status, :subscription_details, :type, :updated_at, :processed_with_network_token?]
|
421
437
|
end
|
422
438
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
class TransactionGateway
|
2
|
+
class TransactionGateway
|
3
3
|
include BaseModule
|
4
4
|
|
5
5
|
def initialize(gateway)
|
@@ -112,6 +112,16 @@ module Braintree
|
|
112
112
|
return_object_or_raise(:transaction) { sale(*args) }
|
113
113
|
end
|
114
114
|
|
115
|
+
def package_tracking(transaction_id, package_tracking_request)
|
116
|
+
raise ArgumentError, "transaction_id is invalid" unless transaction_id =~ /\A[0-9a-z]+\z/
|
117
|
+
Util.verify_keys(TransactionGateway._package_tracking_request_signature, package_tracking_request)
|
118
|
+
_do_create "/transactions/#{transaction_id}/shipments", :shipment => package_tracking_request
|
119
|
+
end
|
120
|
+
|
121
|
+
def package_tracking!(*args)
|
122
|
+
return_object_or_raise(:transaction) { package_tracking(*args) }
|
123
|
+
end
|
124
|
+
|
115
125
|
def search(&block)
|
116
126
|
search = TransactionSearch.new
|
117
127
|
block.call(search) if block
|
@@ -187,15 +197,22 @@ module Braintree
|
|
187
197
|
return_object_or_raise(:transaction) { void(*args) }
|
188
198
|
end
|
189
199
|
|
190
|
-
def self.
|
191
|
-
[
|
200
|
+
def self._package_tracking_request_signature
|
201
|
+
[
|
202
|
+
:carrier,
|
203
|
+
{:line_items => [:commodity_code, :description, :discount_amount, :image_url, :kind, :name, :product_code, :quantity, :tax_amount, :total_amount, :unit_amount, :unit_of_measure, :unit_tax_amount, :upc_code, :upc_type, :url]},
|
204
|
+
:notify_payer, :tracking_number,
|
205
|
+
]
|
192
206
|
end
|
193
207
|
|
208
|
+
def self._clone_signature
|
209
|
+
[:amount, :channel, {:options => [:submit_for_settlement]}]
|
210
|
+
end
|
194
211
|
|
195
212
|
# NEXT_MAJOR_VERSION Remove venmo_sdk_payment_method_code, venmo_sdk_session, and three_d_secure_token
|
196
213
|
# The old venmo SDK class has been deprecated
|
197
214
|
# three_d_secure_token has been deprecated in favor of three_d_secure_authentication_id
|
198
|
-
def self._create_signature
|
215
|
+
def self._create_signature
|
199
216
|
[
|
200
217
|
:amount, :billing_address_id, :channel, :customer_id, :device_data, :discount_amount,
|
201
218
|
:merchant_account_id, :order_id, :payment_method_nonce, :payment_method_token,
|
@@ -205,7 +222,7 @@ module Braintree
|
|
205
222
|
:ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,:three_d_secure_token, #Deprecated
|
206
223
|
:transaction_source, :type, :venmo_sdk_payment_method_code, # Deprecated
|
207
224
|
:sca_exemption, :currency_iso_code, :exchange_rate_quote_id,
|
208
|
-
{:line_items => [:
|
225
|
+
{:line_items => [:commodity_code, :description, :discount_amount, :image_url, :kind, :name, :product_code, :quantity, :tax_amount, :total_amount, :unit_amount, :unit_of_measure, :unit_tax_amount, :upc_code, :upc_type, :url]},
|
209
226
|
{:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
|
210
227
|
{:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number, {:payment_reader_card_details => [:encrypted_card_data, :key_serial_number]}, {:network_tokenization_attributes => [:cryptogram, :ecommerce_indicator, :token_requestor_id]}]},
|
211
228
|
{:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
|
@@ -245,7 +262,7 @@ module Braintree
|
|
245
262
|
{:three_d_secure => [:required]},
|
246
263
|
{:amex_rewards => [:request_id, :points, :currency_amount, :currency_iso_code]},
|
247
264
|
{:venmo => [:profile_id]},
|
248
|
-
{:credit_card => [:account_type]},
|
265
|
+
{:credit_card => [:account_type, :process_debit_as_credit]},
|
249
266
|
]
|
250
267
|
},
|
251
268
|
{:external_vault => [
|
@@ -258,7 +275,7 @@ module Braintree
|
|
258
275
|
{:industry => [
|
259
276
|
:industry_type,
|
260
277
|
{:data => [
|
261
|
-
:folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
|
278
|
+
:country_code, :date_of_birth, :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
|
262
279
|
:passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
|
263
280
|
:issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
|
264
281
|
{:legs => [
|
@@ -276,14 +293,14 @@ module Braintree
|
|
276
293
|
]
|
277
294
|
end
|
278
295
|
|
279
|
-
def self._submit_for_settlement_signature
|
296
|
+
def self._submit_for_settlement_signature
|
280
297
|
[
|
281
298
|
:order_id,
|
282
299
|
{:descriptor => [:name, :phone, :url]},
|
283
300
|
{:industry => [
|
284
301
|
:industry_type,
|
285
302
|
{:data => [
|
286
|
-
:folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
|
303
|
+
:country_code, :date_of_birth, :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
|
287
304
|
:passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
|
288
305
|
:issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
|
289
306
|
{:legs => [
|
@@ -301,7 +318,7 @@ module Braintree
|
|
301
318
|
:discount_amount,
|
302
319
|
:shipping_amount,
|
303
320
|
:ships_from_postal_code,
|
304
|
-
:line_items => [:commodity_code, :description, :discount_amount, :kind, :name, :product_code, :quantity, :tax_amount, :total_amount, :unit_amount, :unit_of_measure, :unit_tax_amount, :
|
321
|
+
:line_items => [:commodity_code, :description, :discount_amount, :image_url, :kind, :name, :product_code, :quantity, :tax_amount, :total_amount, :unit_amount, :unit_of_measure, :unit_tax_amount, :upc_code, :upc_type, :url],
|
305
322
|
]
|
306
323
|
end
|
307
324
|
|
@@ -311,7 +328,7 @@ module Braintree
|
|
311
328
|
]
|
312
329
|
end
|
313
330
|
|
314
|
-
def self._update_details_signature
|
331
|
+
def self._update_details_signature
|
315
332
|
[
|
316
333
|
:amount,
|
317
334
|
:order_id,
|
@@ -327,7 +344,7 @@ module Braintree
|
|
327
344
|
]
|
328
345
|
end
|
329
346
|
|
330
|
-
def _do_create(path, params=nil)
|
347
|
+
def _do_create(path, params=nil)
|
331
348
|
if !params.nil?
|
332
349
|
params = Util.replace_key(params, :google_pay_card, :android_pay_card)
|
333
350
|
end
|
@@ -335,7 +352,7 @@ module Braintree
|
|
335
352
|
_handle_transaction_response(response)
|
336
353
|
end
|
337
354
|
|
338
|
-
def _fetch_transactions(search, ids)
|
355
|
+
def _fetch_transactions(search, ids)
|
339
356
|
search.ids.in ids
|
340
357
|
response = @config.http.post("#{@config.base_merchant_path}/transactions/advanced_search", {:search => search.to_hash})
|
341
358
|
attributes = response[:credit_card_transactions]
|
@@ -1,21 +1,24 @@
|
|
1
1
|
module Braintree
|
2
2
|
class TransactionLineItem
|
3
3
|
include BaseModule
|
4
|
-
attr_reader :
|
5
|
-
attr_reader :name
|
4
|
+
attr_reader :commodity_code
|
6
5
|
attr_reader :description
|
7
|
-
attr_reader :kind
|
8
|
-
attr_reader :unit_amount
|
9
|
-
attr_reader :unit_tax_amount
|
10
|
-
attr_reader :unit_of_measure
|
11
6
|
attr_reader :discount_amount
|
7
|
+
attr_reader :image_url
|
8
|
+
attr_reader :kind
|
9
|
+
attr_reader :name
|
10
|
+
attr_reader :product_code
|
11
|
+
attr_reader :quantity
|
12
12
|
attr_reader :tax_amount
|
13
13
|
attr_reader :total_amount
|
14
|
-
attr_reader :
|
15
|
-
attr_reader :
|
14
|
+
attr_reader :unit_amount
|
15
|
+
attr_reader :unit_of_measure
|
16
|
+
attr_reader :unit_tax_amount
|
17
|
+
attr_reader :upc_code
|
18
|
+
attr_reader :upc_type
|
16
19
|
attr_reader :url
|
17
20
|
|
18
|
-
def initialize(gateway, attributes)
|
21
|
+
def initialize(gateway, attributes)
|
19
22
|
@gateway = gateway
|
20
23
|
set_instance_variables_from_hash(attributes)
|
21
24
|
@quantity = Util.to_big_decimal(quantity)
|
@@ -28,7 +31,7 @@ module Braintree
|
|
28
31
|
|
29
32
|
class << self
|
30
33
|
protected :new
|
31
|
-
def _new(*args)
|
34
|
+
def _new(*args)
|
32
35
|
self.new(*args)
|
33
36
|
end
|
34
37
|
end
|
@@ -14,7 +14,7 @@ module Braintree
|
|
14
14
|
attr_reader :verifications
|
15
15
|
attr_reader :verified
|
16
16
|
|
17
|
-
def initialize(gateway, attributes)
|
17
|
+
def initialize(gateway, attributes)
|
18
18
|
@gateway = gateway
|
19
19
|
set_instance_variables_from_hash(attributes)
|
20
20
|
@ach_mandate = AchMandate.new(attributes[:ach_mandate]) if attributes[:ach_mandate]
|
@@ -34,7 +34,7 @@ module Braintree
|
|
34
34
|
protected :new
|
35
35
|
end
|
36
36
|
|
37
|
-
def self._new(*args)
|
37
|
+
def self._new(*args)
|
38
38
|
self.new(*args)
|
39
39
|
end
|
40
40
|
|
@@ -22,33 +22,41 @@ module Braintree
|
|
22
22
|
All = [IndependentCheck, NetworkCheck, TokenizedCheck, MicroTransfers]
|
23
23
|
end
|
24
24
|
|
25
|
+
module VerificationAddOns
|
26
|
+
CustomerVerification = "customer_verification"
|
27
|
+
|
28
|
+
All = [CustomerVerification]
|
29
|
+
end
|
30
|
+
|
31
|
+
attr_reader :additional_processor_response
|
32
|
+
attr_reader :created_at
|
33
|
+
attr_reader :gateway_rejection_reason
|
25
34
|
attr_reader :id
|
26
|
-
attr_reader :
|
27
|
-
attr_reader :verification_determined_at
|
28
|
-
attr_reader :verification_method
|
35
|
+
attr_reader :merchant_account_id
|
29
36
|
attr_reader :processor_response_code
|
30
37
|
attr_reader :processor_response_text
|
31
|
-
attr_reader :
|
32
|
-
attr_reader :gateway_rejection_reason
|
38
|
+
attr_reader :status
|
33
39
|
attr_reader :us_bank_account
|
34
|
-
attr_reader :
|
40
|
+
attr_reader :verification_determined_at
|
41
|
+
attr_reader :verification_method
|
35
42
|
|
36
|
-
def initialize(attributes)
|
43
|
+
def initialize(attributes)
|
37
44
|
set_instance_variables_from_hash(attributes)
|
38
45
|
end
|
39
46
|
|
40
|
-
def inspect
|
47
|
+
def inspect
|
41
48
|
attr_order = [
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:processor_response_text,
|
45
|
-
:merchant_account_id,
|
49
|
+
:additional_processor_response,
|
50
|
+
:created_at,
|
46
51
|
:gateway_rejection_reason,
|
47
52
|
:id,
|
53
|
+
:merchant_account_id,
|
54
|
+
:processor_response_code,
|
55
|
+
:processor_response_text,
|
56
|
+
:status,
|
48
57
|
:us_bank_account,
|
49
|
-
:verification_method,
|
50
58
|
:verification_determined_at,
|
51
|
-
:
|
59
|
+
:verification_method
|
52
60
|
]
|
53
61
|
|
54
62
|
formatted_attrs = attr_order.map do |attr|
|
@@ -62,7 +70,7 @@ module Braintree
|
|
62
70
|
protected :new
|
63
71
|
end
|
64
72
|
|
65
|
-
def self._new(*args)
|
73
|
+
def self._new(*args)
|
66
74
|
self.new(*args)
|
67
75
|
end
|
68
76
|
|
data/lib/braintree/util.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Braintree
|
2
|
-
module Util
|
2
|
+
module Util
|
3
3
|
def self.extract_attribute_as_array(hash, attribute)
|
4
4
|
raise UnexpectedError.new("Unprocessable entity due to an invalid request") if hash.nil?
|
5
5
|
value = hash.has_key?(attribute) ? hash.delete(attribute) : []
|
@@ -195,14 +195,14 @@ module Braintree
|
|
195
195
|
end
|
196
196
|
|
197
197
|
module IdEquality
|
198
|
-
def ==(other)
|
198
|
+
def ==(other)
|
199
199
|
return false unless other.is_a?(self.class)
|
200
200
|
id == other.id
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
204
|
module TokenEquality
|
205
|
-
def ==(other)
|
205
|
+
def ==(other)
|
206
206
|
return false unless other.is_a?(self.class)
|
207
207
|
token == other.token
|
208
208
|
end
|
@@ -2,7 +2,7 @@ module Braintree
|
|
2
2
|
class ValidationErrorCollection
|
3
3
|
include Enumerable
|
4
4
|
|
5
|
-
def initialize(data)
|
5
|
+
def initialize(data)
|
6
6
|
return if !data.is_a? Hash
|
7
7
|
@errors = (data[:errors] || {}).map { |hash| Braintree::ValidationError.new(hash) }
|
8
8
|
@nested = {}
|
@@ -42,7 +42,7 @@ module Braintree
|
|
42
42
|
self.for("index_#{index}".to_sym)
|
43
43
|
end
|
44
44
|
|
45
|
-
def inspect
|
45
|
+
def inspect
|
46
46
|
"#<#{self.class} errors#{_inner_inspect}>"
|
47
47
|
end
|
48
48
|
|
@@ -61,7 +61,7 @@ module Braintree
|
|
61
61
|
@errors.size
|
62
62
|
end
|
63
63
|
|
64
|
-
def _inner_inspect(scope = [])
|
64
|
+
def _inner_inspect(scope = [])
|
65
65
|
all = []
|
66
66
|
scope_string = scope.join("/")
|
67
67
|
if @errors.any?
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class VenmoAccount
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
|
5
5
|
attr_reader :created_at
|
6
6
|
attr_reader :customer_id
|
@@ -13,7 +13,7 @@ module Braintree
|
|
13
13
|
attr_reader :username
|
14
14
|
attr_reader :venmo_user_id
|
15
15
|
|
16
|
-
def initialize(gateway, attributes)
|
16
|
+
def initialize(gateway, attributes)
|
17
17
|
@gateway = gateway
|
18
18
|
set_instance_variables_from_hash(attributes)
|
19
19
|
@subscriptions = (@subscriptions || []).map { |subscription_hash| Subscription._new(@gateway, subscription_hash) }
|
@@ -27,7 +27,7 @@ module Braintree
|
|
27
27
|
protected :new
|
28
28
|
end
|
29
29
|
|
30
|
-
def self._new(*args)
|
30
|
+
def self._new(*args)
|
31
31
|
self.new(*args)
|
32
32
|
end
|
33
33
|
end
|
@@ -2,13 +2,15 @@ module Braintree
|
|
2
2
|
class VenmoProfileData
|
3
3
|
include BaseModule
|
4
4
|
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :billing_address
|
6
|
+
attr_reader :email
|
6
7
|
attr_reader :first_name
|
7
8
|
attr_reader :last_name
|
8
9
|
attr_reader :phone_number
|
9
|
-
attr_reader :
|
10
|
+
attr_reader :shipping_address
|
11
|
+
attr_reader :username
|
10
12
|
|
11
|
-
def initialize(attributes)
|
13
|
+
def initialize(attributes)
|
12
14
|
set_instance_variables_from_hash(attributes)
|
13
15
|
end
|
14
16
|
|
@@ -16,7 +18,7 @@ module Braintree
|
|
16
18
|
protected :new
|
17
19
|
end
|
18
20
|
|
19
|
-
def self._new(*args)
|
21
|
+
def self._new(*args)
|
20
22
|
self.new(*args)
|
21
23
|
end
|
22
24
|
end
|
data/lib/braintree/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Braintree
|
2
2
|
class VisaCheckoutCard
|
3
|
-
include BaseModule
|
3
|
+
include BaseModule
|
4
4
|
include Braintree::Util::TokenEquality
|
5
5
|
|
6
6
|
attr_reader :billing_address
|
@@ -30,7 +30,7 @@ module Braintree
|
|
30
30
|
attr_reader :updated_at
|
31
31
|
attr_reader :verification
|
32
32
|
|
33
|
-
def initialize(gateway, attributes)
|
33
|
+
def initialize(gateway, attributes)
|
34
34
|
@gateway = gateway
|
35
35
|
set_instance_variables_from_hash(attributes)
|
36
36
|
@billing_address = attributes[:billing_address] ? Address._new(@gateway, attributes[:billing_address]) : nil
|
@@ -39,8 +39,8 @@ module Braintree
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def _most_recent_verification(attributes)
|
42
|
-
|
43
|
-
CreditCardVerification._new(
|
42
|
+
sorted_verifications = (attributes[:verifications] || []).sort_by { |verification| verification[:created_at] }.reverse.first
|
43
|
+
CreditCardVerification._new(sorted_verifications) if sorted_verifications
|
44
44
|
end
|
45
45
|
|
46
46
|
def default?
|
@@ -56,7 +56,7 @@ module Braintree
|
|
56
56
|
@expired
|
57
57
|
end
|
58
58
|
|
59
|
-
def inspect
|
59
|
+
def inspect
|
60
60
|
first = [:token]
|
61
61
|
order = first + (self.class._attributes - first)
|
62
62
|
nice_attributes = order.map do |attr|
|
@@ -73,7 +73,7 @@ module Braintree
|
|
73
73
|
protected :new
|
74
74
|
end
|
75
75
|
|
76
|
-
def self._attributes
|
76
|
+
def self._attributes
|
77
77
|
[
|
78
78
|
:billing_address, :bin, :card_type, :cardholder_name, :created_at,
|
79
79
|
:customer_id, :customer_location, :expiration_month, :expiration_year,
|
@@ -83,7 +83,7 @@ module Braintree
|
|
83
83
|
]
|
84
84
|
end
|
85
85
|
|
86
|
-
def self._new(*args)
|
86
|
+
def self._new(*args)
|
87
87
|
self.new(*args)
|
88
88
|
end
|
89
89
|
end
|
@@ -92,7 +92,7 @@ module Braintree
|
|
92
92
|
Configuration.gateway.webhook_notification.verify(*args)
|
93
93
|
end
|
94
94
|
|
95
|
-
def initialize(gateway, attributes)
|
95
|
+
def initialize(gateway, attributes)
|
96
96
|
@gateway = gateway
|
97
97
|
set_instance_variables_from_hash(attributes)
|
98
98
|
@error_result = ErrorResult.new(gateway, @subject[:api_error_response]) if @subject.has_key?(:api_error_response)
|
@@ -135,7 +135,7 @@ module Braintree
|
|
135
135
|
|
136
136
|
class << self
|
137
137
|
protected :new
|
138
|
-
def _new(*args)
|
138
|
+
def _new(*args)
|
139
139
|
self.new(*args)
|
140
140
|
end
|
141
141
|
end
|