braintree 3.1.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/braintree.gemspec +3 -3
- data/lib/braintree.rb +8 -1
- data/lib/braintree/account_updater_daily_report.rb +1 -1
- data/lib/braintree/address.rb +2 -1
- data/lib/braintree/apple_pay.rb +1 -1
- data/lib/braintree/apple_pay_card.rb +1 -1
- data/lib/braintree/apple_pay_options.rb +1 -1
- data/lib/braintree/authorization_adjustment.rb +1 -1
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/configuration.rb +11 -11
- 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 +2 -2
- data/lib/braintree/credit_card_gateway.rb +14 -4
- data/lib/braintree/credit_card_verification.rb +5 -5
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +6 -4
- data/lib/braintree/customer_gateway.rb +2 -0
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/disbursement.rb +1 -1
- data/lib/braintree/dispute.rb +15 -1
- data/lib/braintree/dispute/paypal_message.rb +15 -0
- data/lib/braintree/dispute_gateway.rb +2 -2
- data/lib/braintree/dispute_search.rb +3 -2
- data/lib/braintree/document_upload.rb +1 -1
- data/lib/braintree/error_codes.rb +12 -4
- data/lib/braintree/google_pay_card.rb +1 -1
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +7 -7
- data/lib/braintree/http.rb +3 -3
- data/lib/braintree/local_payment_completed.rb +1 -1
- data/lib/braintree/local_payment_reversed.rb +19 -0
- data/lib/braintree/merchant.rb +1 -1
- data/lib/braintree/merchant_account.rb +1 -1
- data/lib/braintree/merchant_account_gateway.rb +1 -1
- data/lib/braintree/merchant_gateway.rb +1 -1
- data/lib/braintree/modification.rb +1 -1
- data/lib/braintree/oauth_credentials.rb +1 -1
- data/lib/braintree/oauth_gateway.rb +5 -5
- data/lib/braintree/payment_instrument_type.rb +10 -10
- data/lib/braintree/payment_method_gateway.rb +11 -8
- data/lib/braintree/payment_method_nonce.rb +1 -1
- data/lib/braintree/payment_method_nonce_details.rb +37 -0
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/plan.rb +1 -1
- data/lib/braintree/processor_response_types.rb +3 -3
- data/lib/braintree/resource_collection.rb +8 -3
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data.rb +3 -1
- data/lib/braintree/samsung_pay_card.rb +1 -1
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/subscription.rb +6 -6
- data/lib/braintree/test/credit_card.rb +1 -0
- data/lib/braintree/three_d_secure_info.rb +22 -12
- data/lib/braintree/transaction.rb +40 -24
- data/lib/braintree/transaction/installment.rb +28 -0
- data/lib/braintree/transaction/installment/adjustment.rb +33 -0
- data/lib/braintree/transaction_gateway.rb +27 -6
- data/lib/braintree/transaction_line_item.rb +1 -1
- data/lib/braintree/transaction_search.rb +3 -1
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +3 -3
- data/lib/braintree/us_bank_account_verification.rb +1 -1
- data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
- data/lib/braintree/util.rb +4 -4
- data/lib/braintree/venmo_account.rb +1 -1
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +2 -2
- data/lib/braintree/webhook_notification.rb +30 -20
- data/lib/braintree/webhook_notification_gateway.rb +5 -5
- data/lib/braintree/webhook_testing_gateway.rb +30 -0
- data/lib/braintree/xml/generator.rb +5 -4
- data/lib/braintree/xml/libxml.rb +0 -1
- data/lib/braintree/xml/parser.rb +22 -12
- data/lib/braintree/xml/rexml.rb +70 -0
- data/spec/integration/braintree/add_on_spec.rb +1 -1
- data/spec/integration/braintree/address_spec.rb +28 -24
- data/spec/integration/braintree/advanced_search_spec.rb +45 -45
- data/spec/integration/braintree/apple_pay_spec.rb +3 -3
- data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
- data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
- data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
- data/spec/integration/braintree/credit_card_spec.rb +213 -122
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
- data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
- data/spec/integration/braintree/customer_search_spec.rb +8 -8
- data/spec/integration/braintree/customer_spec.rb +433 -149
- data/spec/integration/braintree/dispute_search_spec.rb +28 -3
- data/spec/integration/braintree/dispute_spec.rb +6 -6
- data/spec/integration/braintree/error_codes_spec.rb +1 -1
- data/spec/integration/braintree/http_spec.rb +2 -2
- data/spec/integration/braintree/merchant_account_spec.rb +25 -26
- data/spec/integration/braintree/merchant_spec.rb +14 -14
- data/spec/integration/braintree/oauth_spec.rb +11 -11
- data/spec/integration/braintree/payment_method_nonce_spec.rb +26 -35
- data/spec/integration/braintree/payment_method_spec.rb +430 -149
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +17 -13
- data/spec/integration/braintree/paypal_account_spec.rb +28 -28
- data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
- data/spec/integration/braintree/subscription_spec.rb +133 -133
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +10 -10
- data/spec/integration/braintree/transaction_search_spec.rb +93 -67
- data/spec/integration/braintree/transaction_spec.rb +752 -383
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -26
- data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
- data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
- data/spec/integration/spec_helper.rb +9 -3
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +6 -3
- data/spec/unit/braintree/address_spec.rb +1 -1
- data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +42 -42
- data/spec/unit/braintree/credit_card_spec.rb +13 -13
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
- data/spec/unit/braintree/customer_spec.rb +21 -10
- data/spec/unit/braintree/disbursement_spec.rb +7 -7
- data/spec/unit/braintree/dispute_search_spec.rb +1 -0
- data/spec/unit/braintree/dispute_spec.rb +34 -9
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +8 -8
- data/spec/unit/braintree/http_spec.rb +5 -5
- data/spec/unit/braintree/merchant_account_spec.rb +1 -1
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
- data/spec/unit/braintree/payment_method_spec.rb +1 -1
- data/spec/unit/braintree/paypal_account_spec.rb +2 -2
- data/spec/unit/braintree/resource_collection_spec.rb +30 -1
- data/spec/unit/braintree/risk_data_spec.rb +9 -5
- data/spec/unit/braintree/subscription_search_spec.rb +1 -1
- data/spec/unit/braintree/successful_result_spec.rb +1 -1
- data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
- data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
- data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +25 -17
- data/spec/unit/braintree/util_spec.rb +18 -18
- data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
- data/spec/unit/braintree/webhook_notification_spec.rb +88 -56
- data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
- data/spec/unit/braintree/xml_spec.rb +31 -31
- metadata +18 -8
- data/lib/braintree/settlement_batch.rb +0 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
module Braintree
|
2
|
+
class Dispute
|
3
|
+
class PayPalMessage # :nodoc:
|
4
|
+
include BaseModule
|
5
|
+
|
6
|
+
attr_reader :message,
|
7
|
+
:sender,
|
8
|
+
:sent_at
|
9
|
+
|
10
|
+
def initialize(attributes)
|
11
|
+
set_instance_variables_from_hash attributes unless attributes.nil?
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -25,7 +25,7 @@ module Braintree
|
|
25
25
|
raise ArgumentError, "dispute_id cannot be blank" if dispute_id.nil? || dispute_id.to_s.strip == ""
|
26
26
|
raise ArgumentError, "document_id_or_request cannot be blank" if document_id_or_request.nil?
|
27
27
|
|
28
|
-
request = document_id_or_request.is_a?(Hash) ? document_id_or_request : {
|
28
|
+
request = document_id_or_request.is_a?(Hash) ? document_id_or_request : {document_id: document_id_or_request}
|
29
29
|
|
30
30
|
raise ArgumentError, "document_id contains invalid characters" unless request[:document_id].to_s =~ /\A[\w-]+\z/
|
31
31
|
raise ArgumentError, "document_id cannot be blank" if request[:document_id].nil? || dispute_id.to_s.strip == ""
|
@@ -55,7 +55,7 @@ module Braintree
|
|
55
55
|
raise ArgumentError, "dispute_id cannot be blank" if dispute_id.nil? || dispute_id.to_s.strip == ""
|
56
56
|
raise ArgumentError, "content_or_request cannot be blank" if content_or_request.nil?
|
57
57
|
|
58
|
-
request = content_or_request.is_a?(String) ? {
|
58
|
+
request = content_or_request.is_a?(String) ? {content: content_or_request} : content_or_request
|
59
59
|
|
60
60
|
raise ArgumentError, "content cannot be blank" if request[:content].nil? || request[:content].to_s.strip == ""
|
61
61
|
raise ArgumentError, "request can only contain the keys [:content, :category, :sequence_number]" if (request.keys - [:category, :content, :sequence_number]).any?
|
@@ -5,9 +5,10 @@ module Braintree
|
|
5
5
|
:customer_id,
|
6
6
|
:id,
|
7
7
|
:reference_number,
|
8
|
-
:transaction_id
|
8
|
+
:transaction_id,
|
9
9
|
)
|
10
10
|
|
11
|
+
multiple_value_field :chargeback_protection_level, :allows => Dispute::ChargebackProtectionLevel::All
|
11
12
|
multiple_value_field :kind, :allows => Dispute::Kind::All
|
12
13
|
multiple_value_field :merchant_account_id
|
13
14
|
multiple_value_field :reason, :allows => Dispute::Reason::All
|
@@ -21,7 +22,7 @@ module Braintree
|
|
21
22
|
:disbursement_date,
|
22
23
|
:effective_date,
|
23
24
|
:received_date,
|
24
|
-
:reply_by_date
|
25
|
+
:reply_by_date,
|
25
26
|
)
|
26
27
|
end
|
27
28
|
end
|
@@ -68,6 +68,7 @@ module Braintree
|
|
68
68
|
CardholderNameIsTooLong = "81723"
|
69
69
|
CreditCardTypeIsNotAccepted = "81703"
|
70
70
|
CreditCardTypeIsNotAcceptedBySubscriptionMerchantAccount = "81718"
|
71
|
+
CurrencyCodeNotSupportedByMerchantAccount = "91760"
|
71
72
|
CustomerIdIsInvalid = "91705"
|
72
73
|
CustomerIdIsRequired = "91704"
|
73
74
|
CvvIsInvalid = "81707"
|
@@ -270,6 +271,7 @@ module Braintree
|
|
270
271
|
end
|
271
272
|
|
272
273
|
module Transaction
|
274
|
+
AdjustmentAmountMustBeGreaterThanZero = "95605"
|
273
275
|
AmountCannotBeNegative = "81501"
|
274
276
|
AmountDoesNotMatch3DSecureAmount = "91585"
|
275
277
|
AmountFormatIsInvalid = "81503" # Keep for backwards compatibility
|
@@ -301,6 +303,7 @@ module Braintree
|
|
301
303
|
CannotUpdateTransactionDetailsNotSubmittedForSettlement = "915129"
|
302
304
|
ChannelIsTooLong = "91550"
|
303
305
|
CreditCardIsRequired = "91508"
|
306
|
+
CurrencyCodeNotSupportedByMerchantAccount = "915214"
|
304
307
|
CustomFieldIsInvalid = "91526"
|
305
308
|
CustomFieldIsTooLong = "81527"
|
306
309
|
CustomerDefaultPaymentMethodCardTypeIsNotAccepted = "81509"
|
@@ -320,6 +323,7 @@ module Braintree
|
|
320
323
|
MerchantAccountIdDoesNotMatchSubscription = "915180"
|
321
324
|
MerchantAccountIdIsInvalid = "91513"
|
322
325
|
MerchantAccountIsSuspended = "91514"
|
326
|
+
NoNetAmountToPerformAuthAdjustment = "95606"
|
323
327
|
OrderIdIsTooLong = "91501"
|
324
328
|
PayPalAuthExpired = "91579"
|
325
329
|
PayPalNotEnabled = "91576"
|
@@ -341,8 +345,11 @@ module Braintree
|
|
341
345
|
ProcessorAuthorizationCodeCannotBeSet = "91519"
|
342
346
|
ProcessorAuthorizationCodeIsInvalid = "81520"
|
343
347
|
ProcessorDoesNotSupportAuths = "915104"
|
348
|
+
ProcessorDoesNotSupportAuthAdjustment = "915222"
|
344
349
|
ProcessorDoesNotSupportCredits = "91546"
|
350
|
+
ProcessorDoesNotSupportIncrementalAuth = "915220"
|
345
351
|
ProcessorDoesNotSupportMotoForCardType = "915195"
|
352
|
+
ProcessorDoesNotSupportPartialAuthReversal = "915221"
|
346
353
|
ProcessorDoesNotSupportPartialSettlement = "915102"
|
347
354
|
ProcessorDoesNotSupportUpdatingDescriptor = "915108"
|
348
355
|
ProcessorDoesNotSupportUpdatingOrderId = "915107"
|
@@ -354,6 +361,7 @@ module Braintree
|
|
354
361
|
RefundAmountIsTooLarge = "91521"
|
355
362
|
RefundAuthHardDeclined = "915200"
|
356
363
|
RefundAuthSoftDeclined = "915201"
|
364
|
+
ScaExemptionInvalid = "915213"
|
357
365
|
ServiceFeeAmountCannotBeNegative = "91554"
|
358
366
|
ServiceFeeAmountFormatIsInvalid = "91555"
|
359
367
|
ServiceFeeAmountIsTooLarge = "91556"
|
@@ -395,6 +403,8 @@ module Braintree
|
|
395
403
|
ThreeDSecureTransactionPaymentMethodDoesntMatchThreeDSecureAuthenticationPaymentMethod = "915197"
|
396
404
|
ThreeDSecureXidIsRequired = "915115"
|
397
405
|
TooManyLineItems = "915157"
|
406
|
+
TransactionIsNotEligibleForAdjustment = "915219"
|
407
|
+
TransactionMustBeInStateAuthorized = "915218"
|
398
408
|
TransactionSourceIsInvalid = "915133"
|
399
409
|
TypeIsInvalid = "91523"
|
400
410
|
TypeIsRequired = "91524"
|
@@ -507,7 +517,6 @@ module Braintree
|
|
507
517
|
end
|
508
518
|
|
509
519
|
module ExternalVault
|
510
|
-
CardTypeIsInvalid = "915178"
|
511
520
|
PreviousNetworkTransactionIdIsInvalid = "915179"
|
512
521
|
StatusIsInvalid = "915175"
|
513
522
|
StatusWithPreviousNetworkTransactionIdIsInvalid = "915177"
|
@@ -694,13 +703,13 @@ module Braintree
|
|
694
703
|
end
|
695
704
|
|
696
705
|
module PaymentMethod
|
697
|
-
CannotForwardPaymentMethodType = "
|
706
|
+
CannotForwardPaymentMethodType = "93106"
|
698
707
|
CustomerIdIsInvalid = "93105"
|
699
708
|
CustomerIdIsRequired = "93104"
|
700
709
|
NonceIsInvalid = "93102"
|
701
710
|
NonceIsRequired = "93103"
|
702
711
|
PaymentMethodNoLongerSupported = "93117"
|
703
|
-
PaymentMethodNonceConsumed = "
|
712
|
+
PaymentMethodNonceConsumed = "93107"
|
704
713
|
PaymentMethodNonceLocked = "93109"
|
705
714
|
PaymentMethodNonceUnknown = "93108"
|
706
715
|
PaymentMethodParamsAreRequired = "93101"
|
@@ -775,7 +784,6 @@ module Braintree
|
|
775
784
|
end
|
776
785
|
|
777
786
|
module RiskData
|
778
|
-
CustomerBrowserIsTooLong = "94701"
|
779
787
|
CustomerDeviceIdIsTooLong = "94702"
|
780
788
|
CustomerLocationZipInvalidCharacters = "94703"
|
781
789
|
CustomerLocationZipIsInvalid = "94704"
|
@@ -4,9 +4,9 @@ module Braintree
|
|
4
4
|
def initialize(config)
|
5
5
|
@config = config
|
6
6
|
@graphql_headers = {
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
"Accept" => "application/json",
|
8
|
+
"Braintree-Version" => @config.graphql_api_version,
|
9
|
+
"Content-Type" => "application/json"
|
10
10
|
}
|
11
11
|
end
|
12
12
|
|
@@ -14,9 +14,9 @@ module Braintree
|
|
14
14
|
graphql_connection = _setup_connection(@config.graphql_server, @config.graphql_port)
|
15
15
|
|
16
16
|
request = {}
|
17
|
-
request[
|
18
|
-
request[
|
19
|
-
request[
|
17
|
+
request["query"] = definition
|
18
|
+
request["operationName"] = operationName if operationName
|
19
|
+
request["variables"] = variables
|
20
20
|
|
21
21
|
response = _http_do Net::HTTP::Post, @config.graphql_base_url, request.to_json, nil, graphql_connection, @graphql_headers
|
22
22
|
data = _parse_response(response)
|
@@ -27,7 +27,7 @@ module Braintree
|
|
27
27
|
|
28
28
|
def _parse_response(response)
|
29
29
|
body = response.body
|
30
|
-
body = Zlib::GzipReader.new(StringIO.new(body)).read if response.header[
|
30
|
+
body = Zlib::GzipReader.new(StringIO.new(body)).read if response.header["Content-Encoding"] == "gzip"
|
31
31
|
JSON.parse(body, :symbolize_names => true)
|
32
32
|
end
|
33
33
|
end
|
data/lib/braintree/http.rb
CHANGED
@@ -75,7 +75,7 @@ module Braintree
|
|
75
75
|
@config.proxy_address,
|
76
76
|
@config.proxy_port,
|
77
77
|
@config.proxy_user,
|
78
|
-
@config.proxy_pass
|
78
|
+
@config.proxy_pass,
|
79
79
|
)
|
80
80
|
else
|
81
81
|
connection = Net::HTTP.new(server, port)
|
@@ -127,7 +127,7 @@ module Braintree
|
|
127
127
|
form_params.push(_add_form_field(k, v))
|
128
128
|
end
|
129
129
|
form_params.push(_add_file_part("file", file))
|
130
|
-
request.body = form_params.collect {|p| "--" + boundary + "#{LINE_FEED}" + p}.join("") + "--" + boundary + "--"
|
130
|
+
request.body = form_params.collect { |p| "--" + boundary + "#{LINE_FEED}" + p }.join("") + "--" + boundary + "--"
|
131
131
|
@config.logger.debug _format_and_sanitize_body_for_log(_build_xml(body))
|
132
132
|
else
|
133
133
|
request.body = body
|
@@ -187,7 +187,7 @@ module Braintree
|
|
187
187
|
def _format_and_sanitize_body_for_log(input_xml)
|
188
188
|
formatted_xml = input_xml.gsub(/^/, "[Braintree] ")
|
189
189
|
formatted_xml = formatted_xml.gsub(/<number>(.{6}).+?(.{4})<\/number>/m, '<number>\1******\2</number>')
|
190
|
-
formatted_xml = formatted_xml.gsub(/<cvv>.+?<\/cvv>/m,
|
190
|
+
formatted_xml = formatted_xml.gsub(/<cvv>.+?<\/cvv>/m, "<cvv>***</cvv>")
|
191
191
|
formatted_xml
|
192
192
|
end
|
193
193
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Braintree
|
2
|
+
class LocalPaymentReversed
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :payment_id
|
6
|
+
|
7
|
+
def initialize(attributes) # :nodoc:
|
8
|
+
set_instance_variables_from_hash(attributes)
|
9
|
+
end
|
10
|
+
|
11
|
+
class << self
|
12
|
+
protected :new
|
13
|
+
end
|
14
|
+
|
15
|
+
def self._new(*args) # :nodoc:
|
16
|
+
self.new(*args)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/braintree/merchant.rb
CHANGED
@@ -74,7 +74,7 @@ module Braintree
|
|
74
74
|
|
75
75
|
if response.has_key?(:response) && response[:response][:merchant_account]
|
76
76
|
Braintree::SuccessfulResult.new(
|
77
|
-
:merchant_account => MerchantAccount._new(@gateway, response[:response][:merchant_account])
|
77
|
+
:merchant_account => MerchantAccount._new(@gateway, response[:response][:merchant_account]),
|
78
78
|
)
|
79
79
|
elsif response[:api_error_response]
|
80
80
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -26,7 +26,7 @@ module Braintree
|
|
26
26
|
if response.has_key?(:response) && response[:response][:merchant]
|
27
27
|
Braintree::SuccessfulResult.new(
|
28
28
|
:merchant => Merchant._new(@gateway, response[:response][:merchant]),
|
29
|
-
:credentials => OAuthCredentials._new(response[:response][:credentials])
|
29
|
+
:credentials => OAuthCredentials._new(response[:response][:credentials]),
|
30
30
|
)
|
31
31
|
elsif response[:api_error_response]
|
32
32
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -22,7 +22,7 @@ module Braintree
|
|
22
22
|
})
|
23
23
|
if response[:credentials]
|
24
24
|
Braintree::SuccessfulResult.new(
|
25
|
-
:credentials => OAuthCredentials._new(response[:credentials])
|
25
|
+
:credentials => OAuthCredentials._new(response[:credentials]),
|
26
26
|
)
|
27
27
|
elsif response[:api_error_response]
|
28
28
|
ErrorResult.new(@gateway, response[:api_error_response])
|
@@ -47,10 +47,10 @@ module Braintree
|
|
47
47
|
user_params = _sub_query(params, :user)
|
48
48
|
business_params = _sub_query(params, :business)
|
49
49
|
payment_methods = _sub_array_query(params, :payment_methods)
|
50
|
-
query = params.to_a
|
51
|
-
concat(user_params)
|
52
|
-
concat(business_params)
|
53
|
-
concat(payment_methods)
|
50
|
+
query = params.to_a
|
51
|
+
.concat(user_params)
|
52
|
+
.concat(business_params)
|
53
|
+
.concat(payment_methods)
|
54
54
|
|
55
55
|
query_string = query.map { |k, v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join("&")
|
56
56
|
"#{@config.base_url}/oauth/connect?#{query_string}"
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module Braintree
|
2
2
|
module PaymentInstrumentType
|
3
|
-
PayPalAccount =
|
4
|
-
CreditCard =
|
5
|
-
ApplePayCard =
|
6
|
-
GooglePayCard =
|
7
|
-
VenmoAccount =
|
8
|
-
UsBankAccount =
|
9
|
-
VisaCheckoutCard =
|
10
|
-
SamsungPayCard =
|
11
|
-
LocalPayment =
|
12
|
-
PayPalHere =
|
3
|
+
PayPalAccount = "paypal_account"
|
4
|
+
CreditCard = "credit_card"
|
5
|
+
ApplePayCard = "apple_pay_card"
|
6
|
+
GooglePayCard = "android_pay_card"
|
7
|
+
VenmoAccount = "venmo_account"
|
8
|
+
UsBankAccount = "us_bank_account"
|
9
|
+
VisaCheckoutCard = "visa_checkout_card"
|
10
|
+
SamsungPayCard = "samsung_pay_card"
|
11
|
+
LocalPayment = "local_payment"
|
12
|
+
PayPalHere = "paypal_here"
|
13
13
|
end
|
14
14
|
end
|
@@ -19,7 +19,6 @@ module Braintree
|
|
19
19
|
|
20
20
|
def _do_create(path, params=nil) # :nodoc:
|
21
21
|
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
22
|
-
|
23
22
|
if response[:api_error_response]
|
24
23
|
ErrorResult.new(@gateway, response[:api_error_response])
|
25
24
|
elsif response
|
@@ -83,7 +82,7 @@ module Braintree
|
|
83
82
|
if options.class == Hash
|
84
83
|
grant_options = options
|
85
84
|
elsif [true, false].include?(options)
|
86
|
-
grant_options = {
|
85
|
+
grant_options = {:allow_vaulting => options}
|
87
86
|
else
|
88
87
|
raise ArgumentError
|
89
88
|
end
|
@@ -92,7 +91,7 @@ module Braintree
|
|
92
91
|
"/payment_methods/grant",
|
93
92
|
:payment_method => {
|
94
93
|
:shared_payment_method_token => token,
|
95
|
-
}.merge(grant_options)
|
94
|
+
}.merge(grant_options),
|
96
95
|
)
|
97
96
|
rescue NotFoundError
|
98
97
|
raise NotFoundError, "payment method with token #{token.inspect} not found"
|
@@ -116,7 +115,7 @@ module Braintree
|
|
116
115
|
"/payment_methods/revoke",
|
117
116
|
:payment_method => {
|
118
117
|
:shared_payment_method_token => token
|
119
|
-
}
|
118
|
+
},
|
120
119
|
)
|
121
120
|
rescue NotFoundError
|
122
121
|
raise NotFoundError, "payment method with token #{token.inspect} not found"
|
@@ -149,9 +148,15 @@ module Braintree
|
|
149
148
|
billing_address_params = AddressGateway._shared_signature
|
150
149
|
paypal_options_shipping_signature = AddressGateway._shared_signature
|
151
150
|
options = [
|
152
|
-
:make_default,
|
153
|
-
:
|
151
|
+
:make_default,
|
152
|
+
:skip_advanced_fraud_checking,
|
153
|
+
:us_bank_account_verification_method,
|
154
|
+
:venmo_sdk_session,
|
154
155
|
:verification_account_type,
|
156
|
+
:verification_amount,
|
157
|
+
:verification_currency_iso_code,
|
158
|
+
:verification_merchant_account_id,
|
159
|
+
:verify_card,
|
155
160
|
:paypal => [
|
156
161
|
:payee_email,
|
157
162
|
:order_id,
|
@@ -186,8 +191,6 @@ module Braintree
|
|
186
191
|
options << :fail_on_duplicate_payment_method
|
187
192
|
signature << :customer_id
|
188
193
|
signature << :paypal_refresh_token
|
189
|
-
# NEXT_MAJOR_VERSION remove this from the signature
|
190
|
-
signature << :paypal_vault_without_upgrade
|
191
194
|
when :update
|
192
195
|
billing_address_params << {:options => [:update_existing]}
|
193
196
|
else
|
@@ -25,7 +25,7 @@ module Braintree
|
|
25
25
|
@gateway = gateway
|
26
26
|
@nonce = attributes.fetch(:nonce)
|
27
27
|
@type = attributes.fetch(:type)
|
28
|
-
@details =
|
28
|
+
@details = PaymentMethodNonceDetails.new(attributes[:details]) if attributes[:details]
|
29
29
|
@authentication_insight = attributes.fetch(:authentication_insight, nil)
|
30
30
|
@three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
|
31
31
|
@bin_data = BinData.new(attributes[:bin_data]) if attributes[:bin_data]
|