braintree 2.100.0 → 2.101.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/lib/braintree/android_pay_card.rb +4 -0
- data/lib/braintree/base_module.rb +4 -0
- data/lib/braintree/credit_card_verification.rb +1 -0
- data/lib/braintree/customer.rb +1 -0
- data/lib/braintree/dispute.rb +1 -0
- data/lib/braintree/error_codes.rb +40 -34
- data/lib/braintree/graphql_client.rb +7 -1
- data/lib/braintree/payment_method_gateway.rb +1 -0
- data/lib/braintree/three_d_secure_info.rb +2 -0
- data/lib/braintree/transaction.rb +1 -0
- data/lib/braintree/transaction/android_pay_details.rb +4 -0
- data/lib/braintree/transaction_gateway.rb +8 -1
- data/lib/braintree/version.rb +1 -1
- data/spec/integration/braintree/client_api/spec_helper.rb +73 -80
- data/spec/integration/braintree/credit_card_spec.rb +2 -1
- data/spec/integration/braintree/credit_card_verification_spec.rb +1 -0
- data/spec/integration/braintree/customer_spec.rb +3 -0
- data/spec/integration/braintree/dispute_search_spec.rb +1 -1
- data/spec/integration/braintree/dispute_spec.rb +1 -0
- data/spec/integration/braintree/payment_method_nonce_spec.rb +6 -2
- data/spec/integration/braintree/payment_method_spec.rb +4 -18
- data/spec/integration/braintree/transaction_spec.rb +266 -32
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/braintree/three_d_secure_info_spec.rb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a5d32a025ec741caa8fd1de8f33b64951f8e61cf6c16dbfd32b12ec0d88d81a
|
|
4
|
+
data.tar.gz: e7500376e7de67a7ebda3c275b22235dc298d386edec860994aa15c129807006
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5f8f63a4af2e318f9ac5b9fcbd88f8e7b185e61f9f0fa4e090a75a66ce0c534a50b712af237b8d22b0741319a2764a081991be0b7d8535ab4246858dd8150600
|
|
7
|
+
data.tar.gz: 23cc9b627afc2804750d41a64bbdae27a5ad68df550a7aaebc4c291b96dd31265569ed917cb980952a47190aee52c5d0a04192dbe5e72850eedb534a25419508
|
data/lib/braintree/customer.rb
CHANGED
data/lib/braintree/dispute.rb
CHANGED
|
@@ -323,29 +323,21 @@ module Braintree
|
|
|
323
323
|
CannotUpdateTransactionDetailsNotSubmittedForSettlement = "915129"
|
|
324
324
|
ChannelIsTooLong = "91550"
|
|
325
325
|
CreditCardIsRequired = "91508"
|
|
326
|
-
CustomFieldIsInvalid = "91526"
|
|
327
|
-
CustomFieldIsTooLong = "81527"
|
|
328
326
|
CustomerDefaultPaymentMethodCardTypeIsNotAccepted = "81509"
|
|
329
327
|
CustomerDoesNotHaveCreditCard = "91511"
|
|
330
328
|
CustomerIdIsInvalid = "91510"
|
|
329
|
+
CustomFieldIsInvalid = "91526"
|
|
330
|
+
CustomFieldIsTooLong = "81527"
|
|
331
|
+
DiscountAmountCannotBeNegative = "915160"
|
|
332
|
+
DiscountAmountFormatIsInvalid = "915159"
|
|
333
|
+
DiscountAmountIsTooLarge = "915161"
|
|
331
334
|
FailedAuthAdjustmentAllowRetry = "95603"
|
|
332
335
|
FailedAuthAdjustmentHardDecline = "95602"
|
|
333
336
|
FinalAuthSubmitForSettlementForDifferentAmount = "95601"
|
|
334
337
|
HasAlreadyBeenRefunded = "91512"
|
|
335
338
|
IdealPaymentNotComplete = "815141"
|
|
336
|
-
PaymentInstrumentWithExternalVaultIsInvalid = "915176"
|
|
337
|
-
TooManyLineItems = "915157"
|
|
338
|
-
LineItemsExpected = "915158"
|
|
339
|
-
DiscountAmountFormatIsInvalid = "915159"
|
|
340
|
-
DiscountAmountCannotBeNegative = "915160"
|
|
341
|
-
DiscountAmountIsTooLarge = "915161"
|
|
342
|
-
ShippingAmountFormatIsInvalid = "915162"
|
|
343
|
-
ShippingAmountCannotBeNegative = "915163"
|
|
344
|
-
ShippingAmountIsTooLarge = "915164"
|
|
345
|
-
ShipsFromPostalCodeIsTooLong = "915165"
|
|
346
|
-
ShipsFromPostalCodeIsInvalid = "915166"
|
|
347
|
-
ShipsFromPostalCodeInvalidCharacters = "915167"
|
|
348
339
|
IdealPaymentsCannotBeVaulted = "915150"
|
|
340
|
+
LineItemsExpected = "915158"
|
|
349
341
|
MerchantAccountDoesNotMatch3DSecureMerchantAccount = "91584"
|
|
350
342
|
MerchantAccountDoesNotMatchIdealPaymentMerchantAccount = "915143"
|
|
351
343
|
MerchantAccountDoesNotSupportMOTO = "91558"
|
|
@@ -353,14 +345,12 @@ module Braintree
|
|
|
353
345
|
MerchantAccountIdDoesNotMatchSubscription = "915180"
|
|
354
346
|
MerchantAccountIdIsInvalid = "91513"
|
|
355
347
|
MerchantAccountIsSuspended = "91514"
|
|
356
|
-
OrderIdIsTooLong = "91501"
|
|
357
|
-
OrderIdIsRequiredWithIdealPayment = "91502"
|
|
358
348
|
OrderIdDoesNotMatchIdealPaymentOrderId = "91503"
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
PayPalVaultRecordMissingData = "91583"
|
|
349
|
+
OrderIdIsRequiredWithIdealPayment = "91502"
|
|
350
|
+
OrderIdIsTooLong = "91501"
|
|
362
351
|
PaymentInstrumentNotSupportedByMerchantAccount = "91577"
|
|
363
352
|
PaymentInstrumentTypeIsNotAccepted = "915101"
|
|
353
|
+
PaymentInstrumentWithExternalVaultIsInvalid = "915176"
|
|
364
354
|
PaymentMethodConflict = "91515"
|
|
365
355
|
PaymentMethodConflictWithVenmoSDK = "91549"
|
|
366
356
|
PaymentMethodDoesNotBelongToCustomer = "91516"
|
|
@@ -368,25 +358,28 @@ module Braintree
|
|
|
368
358
|
PaymentMethodNonceCardTypeIsNotAccepted = "91567"
|
|
369
359
|
PaymentMethodNonceConsumed = "91564"
|
|
370
360
|
PaymentMethodNonceHasNoValidPaymentInstrumentType = "91569"
|
|
371
|
-
UsBankAccountNonceMustBePlaidVerified = "915171"
|
|
372
|
-
UsBankAccountNotVerified = "915172"
|
|
373
361
|
PaymentMethodNonceLocked = "91566"
|
|
374
362
|
PaymentMethodNonceUnknown = "91565"
|
|
375
363
|
PaymentMethodTokenCardTypeIsNotAccepted = "91517"
|
|
376
364
|
PaymentMethodTokenIsInvalid = "91518"
|
|
365
|
+
PayPalAuthExpired = "91579"
|
|
366
|
+
PayPalNotEnabled = "91576"
|
|
367
|
+
PayPalVaultRecordMissingData = "91583"
|
|
377
368
|
ProcessorAuthorizationCodeCannotBeSet = "91519"
|
|
378
369
|
ProcessorAuthorizationCodeIsInvalid = "81520"
|
|
379
370
|
ProcessorDoesNotSupportAuths = "915104"
|
|
380
|
-
ProcessorDoesNotSupportUpdatingOrderId = "915107"
|
|
381
|
-
ProcessorDoesNotSupportUpdatingDescriptor = "915108"
|
|
382
|
-
ProcessorDoesNotSupportUpdatingTransactionDetails = "915130"
|
|
383
371
|
ProcessorDoesNotSupportCredits = "91546"
|
|
372
|
+
ProcessorDoesNotSupportMotoForCardType = "915195"
|
|
384
373
|
ProcessorDoesNotSupportPartialSettlement = "915102"
|
|
374
|
+
ProcessorDoesNotSupportUpdatingDescriptor = "915108"
|
|
375
|
+
ProcessorDoesNotSupportUpdatingOrderId = "915107"
|
|
376
|
+
ProcessorDoesNotSupportUpdatingTransactionDetails = "915130"
|
|
385
377
|
ProcessorDoesNotSupportVoiceAuthorizations = "91545"
|
|
386
|
-
ProcessorDoesNotSupportMotoForCardType = "915195"
|
|
387
378
|
PurchaseOrderNumberIsInvalid = "91548"
|
|
388
379
|
PurchaseOrderNumberIsTooLong = "91537"
|
|
389
380
|
RefundAmountIsTooLarge = "91521"
|
|
381
|
+
RefundAuthHardDeclined = "915200"
|
|
382
|
+
RefundAuthSoftDeclined = "915201"
|
|
390
383
|
ServiceFeeAmountCannotBeNegative = "91554"
|
|
391
384
|
ServiceFeeAmountFormatIsInvalid = "91555"
|
|
392
385
|
ServiceFeeAmountIsTooLarge = "91556"
|
|
@@ -396,6 +389,12 @@ module Braintree
|
|
|
396
389
|
SettlementAmountIsLessThanServiceFeeAmount = "91551"
|
|
397
390
|
SettlementAmountIsTooLarge = "91522"
|
|
398
391
|
ShippingAddressDoesntMatchCustomer = "91581"
|
|
392
|
+
ShippingAmountCannotBeNegative = "915163"
|
|
393
|
+
ShippingAmountFormatIsInvalid = "915162"
|
|
394
|
+
ShippingAmountIsTooLarge = "915164"
|
|
395
|
+
ShipsFromPostalCodeInvalidCharacters = "915167"
|
|
396
|
+
ShipsFromPostalCodeIsInvalid = "915166"
|
|
397
|
+
ShipsFromPostalCodeIsTooLong = "915165"
|
|
399
398
|
SubMerchantAccountRequiresServiceFeeAmount = "91553"
|
|
400
399
|
SubscriptionDoesNotBelongToCustomer = "91529"
|
|
401
400
|
SubscriptionIdIsInvalid = "91528"
|
|
@@ -404,21 +403,28 @@ module Braintree
|
|
|
404
403
|
TaxAmountFormatIsInvalid = "81535"
|
|
405
404
|
TaxAmountIsTooLarge = "81536"
|
|
406
405
|
ThreeDSecureAuthenticationFailed = "81571"
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
ThreeDSecureCavvIsRequired = "915116"
|
|
411
|
-
ThreeDSecureXidIsRequired = "915115"
|
|
412
|
-
ThreeDSecureEciFlagIsInvalid = "915114"
|
|
413
|
-
ThreeDSecureThreeDSecureVersionIsInvalid = "915119"
|
|
406
|
+
ThreeDSecureAuthenticationIdDoesntMatchNonceThreeDSecureAuthentication = "915198"
|
|
407
|
+
ThreeDSecureAuthenticationIdIsInvalid = "915196"
|
|
408
|
+
ThreeDSecureAuthenticationIdWithThreeDSecurePassThruIsInvalid = "915199"
|
|
414
409
|
ThreeDSecureAuthenticationResponseIsInvalid = "915120"
|
|
415
|
-
ThreeDSecureDirectoryResponseIsInvalid = "915121"
|
|
416
410
|
ThreeDSecureCavvAlgorithmIsInvalid = "915122"
|
|
411
|
+
ThreeDSecureCavvIsRequired = "915116"
|
|
412
|
+
ThreeDSecureDirectoryResponseIsInvalid = "915121"
|
|
413
|
+
ThreeDSecureEciFlagIsInvalid = "915114"
|
|
414
|
+
ThreeDSecureEciFlagIsRequired = "915113"
|
|
417
415
|
ThreeDSecureMerchantAccountDoesNotSupportCardType = "915131"
|
|
416
|
+
ThreeDSecureThreeDSecureVersionIsInvalid = "915119"
|
|
417
|
+
ThreeDSecureTokenIsInvalid = "91568"
|
|
418
|
+
ThreeDSecureTransactionDataDoesntMatchVerify = "91570"
|
|
419
|
+
ThreeDSecureTransactionPaymentMethodDoesntMatchThreeDSecureAuthenticationPaymentMethod = "915197"
|
|
420
|
+
ThreeDSecureXidIsRequired = "915115"
|
|
421
|
+
TooManyLineItems = "915157"
|
|
422
|
+
TransactionSourceIsInvalid = "915133"
|
|
418
423
|
TypeIsInvalid = "91523"
|
|
419
424
|
TypeIsRequired = "91524"
|
|
420
425
|
UnsupportedVoiceAuthorization = "91539"
|
|
421
|
-
|
|
426
|
+
UsBankAccountNonceMustBePlaidVerified = "915171"
|
|
427
|
+
UsBankAccountNotVerified = "915172"
|
|
422
428
|
|
|
423
429
|
module Options
|
|
424
430
|
SubmitForSettlementIsRequiredForCloning = "91544"
|
|
@@ -19,10 +19,16 @@ module Braintree
|
|
|
19
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
|
-
data =
|
|
22
|
+
data = _parse_response(response)
|
|
23
23
|
Util.raise_exception_for_graphql_error(data)
|
|
24
24
|
|
|
25
25
|
data
|
|
26
26
|
end
|
|
27
|
+
|
|
28
|
+
def _parse_response(response)
|
|
29
|
+
body = response.body
|
|
30
|
+
body = Zlib::GzipReader.new(StringIO.new(body)).read if response.header['Content-Encoding'] == "gzip"
|
|
31
|
+
JSON.parse(body, :symbolize_names => true)
|
|
32
|
+
end
|
|
27
33
|
end
|
|
28
34
|
end
|
|
@@ -178,6 +178,7 @@ module Braintree
|
|
|
178
178
|
options << :fail_on_duplicate_payment_method
|
|
179
179
|
signature << :customer_id
|
|
180
180
|
signature << :paypal_refresh_token
|
|
181
|
+
# NEXT_MAJOR_VERSION remove this from the signature
|
|
181
182
|
signature << :paypal_vault_without_upgrade
|
|
182
183
|
when :update
|
|
183
184
|
billing_address_params << {:options => [:update_existing]}
|
|
@@ -11,6 +11,7 @@ module Braintree
|
|
|
11
11
|
attr_reader :eci_flag
|
|
12
12
|
attr_reader :three_d_secure_version
|
|
13
13
|
attr_reader :ds_transaction_id
|
|
14
|
+
attr_reader :three_d_secure_authentication_id
|
|
14
15
|
|
|
15
16
|
alias_method :liability_shifted?, :liability_shifted
|
|
16
17
|
alias_method :liability_shift_possible?, :liability_shift_possible
|
|
@@ -30,6 +31,7 @@ module Braintree
|
|
|
30
31
|
:eci_flag,
|
|
31
32
|
:three_d_secure_version,
|
|
32
33
|
:ds_transaction_id,
|
|
34
|
+
:three_d_secure_authentication_id,
|
|
33
35
|
]
|
|
34
36
|
|
|
35
37
|
formatted_attrs = attr_order.map do |attr|
|
|
@@ -119,6 +119,7 @@ module Braintree
|
|
|
119
119
|
attr_reader :facilitated_details
|
|
120
120
|
attr_reader :facilitator_details
|
|
121
121
|
attr_reader :gateway_rejection_reason
|
|
122
|
+
attr_reader :graphql_id
|
|
122
123
|
attr_reader :id
|
|
123
124
|
# NEXT_MAJOR_VERSION Remove this class as legacy Ideal has been removed/disabled in the Braintree Gateway
|
|
124
125
|
# DEPRECATED If you're looking to accept iDEAL as a payment method contact accounts@braintreepayments.com for a solution.
|
|
@@ -188,7 +188,7 @@ module Braintree
|
|
|
188
188
|
:purchase_order_number, :recurring, :transaction_source, :shipping_address_id, :type, :tax_amount, :tax_exempt,
|
|
189
189
|
:venmo_sdk_payment_method_code, :device_session_id, :service_fee_amount, :device_data, :fraud_merchant_id,
|
|
190
190
|
:shipping_amount, :discount_amount, :ships_from_postal_code,
|
|
191
|
-
:billing_address_id, :payment_method_nonce, :three_d_secure_token,
|
|
191
|
+
:billing_address_id, :payment_method_nonce, :three_d_secure_token, :three_d_secure_authentication_id,
|
|
192
192
|
:shared_payment_method_token, :shared_billing_address_id, :shared_customer_id, :shared_shipping_address_id, :shared_payment_method_nonce,
|
|
193
193
|
{:line_items => [:quantity, :name, :description, :kind, :unit_amount, :unit_tax_amount, :total_amount, :discount_amount, :tax_amount, :unit_of_measure, :product_code, :commodity_code, :url]},
|
|
194
194
|
{:risk_data => [:customer_browser, :customer_ip]},
|
|
@@ -263,6 +263,13 @@ module Braintree
|
|
|
263
263
|
[
|
|
264
264
|
:order_id,
|
|
265
265
|
{:descriptor => [:name, :phone, :url]},
|
|
266
|
+
:purchase_order_number,
|
|
267
|
+
:tax_amount,
|
|
268
|
+
:tax_exempt,
|
|
269
|
+
:discount_amount,
|
|
270
|
+
:shipping_amount,
|
|
271
|
+
:ships_from_postal_code,
|
|
272
|
+
:line_items => [:commodity_code, :description, :discount_amount, :kind, :name, :product_code, :quantity, :tax_amount, :total_amount, :unit_amount, :unit_of_measure, :unit_tax_amount, :url, :tax_amount],
|
|
266
273
|
]
|
|
267
274
|
end
|
|
268
275
|
|
data/lib/braintree/version.rb
CHANGED
|
@@ -56,83 +56,93 @@ def nonce_for_paypal_account(paypal_account_details)
|
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
def generate_non_plaid_us_bank_account_nonce(account_number="1000000000")
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
payload = {
|
|
65
|
-
:type => "us_bank_account",
|
|
66
|
-
:billing_address => {
|
|
67
|
-
:street_address => "123 Ave",
|
|
68
|
-
:region => "CA",
|
|
69
|
-
:locality => "San Francisco",
|
|
70
|
-
:postal_code => "94112"
|
|
71
|
-
},
|
|
72
|
-
:account_type => "checking",
|
|
73
|
-
:routing_number => "021000021",
|
|
74
|
-
:account_number => account_number,
|
|
75
|
-
:first_name => "John",
|
|
76
|
-
:last_name => "Doe",
|
|
77
|
-
:ownership_type => "personal",
|
|
78
|
-
:ach_mandate => {
|
|
79
|
-
:text => "cl mandate text"
|
|
59
|
+
definition = <<-GRAPHQL
|
|
60
|
+
mutation TokenizeUsBankAccount($input: TokenizeUsBankAccountInput!) {
|
|
61
|
+
tokenizeUsBankAccount(input: $input) {
|
|
62
|
+
paymentMethod {
|
|
63
|
+
id
|
|
80
64
|
}
|
|
81
65
|
}
|
|
66
|
+
}
|
|
67
|
+
GRAPHQL
|
|
68
|
+
variables = {
|
|
69
|
+
input: {
|
|
70
|
+
usBankAccount: {
|
|
71
|
+
achMandate: "cl mandate text",
|
|
72
|
+
routingNumber: "021000021",
|
|
73
|
+
accountNumber: account_number,
|
|
74
|
+
accountType: "CHECKING",
|
|
75
|
+
individualOwner: {
|
|
76
|
+
firstName: "John",
|
|
77
|
+
lastName: "Doe",
|
|
78
|
+
},
|
|
79
|
+
billingAddress: {
|
|
80
|
+
streetAddress: "123 Ave",
|
|
81
|
+
city: "San Francisco",
|
|
82
|
+
state: "CA",
|
|
83
|
+
zipCode: "94112"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
response = Braintree::GraphQLClient.new(Braintree::Configuration.instantiate).query(definition, variables)
|
|
82
89
|
|
|
83
|
-
|
|
84
|
-
json["data"]["id"]
|
|
90
|
+
response[:data][:tokenizeUsBankAccount][:paymentMethod][:id]
|
|
85
91
|
end
|
|
86
92
|
|
|
87
93
|
def generate_valid_plaid_us_bank_account_nonce
|
|
88
94
|
raw_client_token = Braintree::ClientToken.generate
|
|
89
95
|
client_token = decode_client_token(raw_client_token)
|
|
90
96
|
|
|
91
|
-
url = client_token["
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
:
|
|
106
|
-
:
|
|
97
|
+
url = client_token["graphQL"]["url"]
|
|
98
|
+
date = client_token["graphQL"]["date"]
|
|
99
|
+
token = client_token["authorizationFingerprint"]
|
|
100
|
+
|
|
101
|
+
definition = <<-GRAPHQL
|
|
102
|
+
mutation TokenizeUsBankLogin($input: TokenizeUsBankLoginInput!) {
|
|
103
|
+
tokenizeUsBankLogin(input: $input) {
|
|
104
|
+
paymentMethod {
|
|
105
|
+
id
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
GRAPHQL
|
|
110
|
+
variables = {
|
|
111
|
+
input: {
|
|
112
|
+
usBankLogin: {
|
|
113
|
+
achMandate: "cl mandate text",
|
|
114
|
+
publicToken: "good",
|
|
115
|
+
accountId: "plaid_account_id",
|
|
116
|
+
accountType: "CHECKING",
|
|
117
|
+
businessOwner: {
|
|
118
|
+
businessName: "PayPal, Inc."
|
|
119
|
+
},
|
|
120
|
+
billingAddress: {
|
|
121
|
+
streetAddress: "123 Ave",
|
|
122
|
+
city: "San Francisco",
|
|
123
|
+
state: "CA",
|
|
124
|
+
zipCode: "94112"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
107
127
|
}
|
|
108
128
|
}
|
|
109
|
-
|
|
110
|
-
json = _cosmos_post(token, url, payload)
|
|
111
|
-
json["data"]["id"]
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
def generate_valid_ideal_payment_nonce(amount = Braintree::Test::TransactionAmounts::Authorize)
|
|
115
|
-
raw_client_token = Braintree::ClientToken.generate(:merchant_account_id => "ideal_merchant_account")
|
|
116
|
-
client_token = decode_client_token(raw_client_token)
|
|
117
|
-
client = ClientApiHttp.new(
|
|
118
|
-
Braintree::Configuration.instantiate,
|
|
119
|
-
:authorization_fingerprint => client_token["authorizationFingerprint"],
|
|
120
|
-
)
|
|
121
|
-
config = JSON.parse(client.get_configuration.body)
|
|
122
|
-
|
|
123
|
-
token = client_token["braintree_api"]["access_token"]
|
|
124
|
-
url = client_token["braintree_api"]["url"] + "/ideal-payments"
|
|
125
129
|
payload = {
|
|
126
|
-
:
|
|
127
|
-
:
|
|
128
|
-
:amount => amount,
|
|
129
|
-
:currency => "EUR",
|
|
130
|
-
:redirect_url => "https://braintree-api.com",
|
|
131
|
-
:route_id => config["ideal"]["routeId"]
|
|
130
|
+
query: definition,
|
|
131
|
+
variables: variables
|
|
132
132
|
}
|
|
133
|
+
uri = URI::parse(url)
|
|
134
|
+
connection = Net::HTTP.new(uri.host, uri.port)
|
|
135
|
+
connection.use_ssl = false
|
|
136
|
+
response = connection.start do |http|
|
|
137
|
+
request = Net::HTTP::Post.new(uri.path)
|
|
138
|
+
request["Content-Type"] = "application/json"
|
|
139
|
+
request["Braintree-Version"] = date
|
|
140
|
+
request["Authorization"] = "Bearer #{token}"
|
|
141
|
+
request.body = payload.to_json
|
|
142
|
+
http.request(request)
|
|
143
|
+
end
|
|
133
144
|
|
|
134
|
-
|
|
135
|
-
json["data"]["id"]
|
|
145
|
+
JSON.parse(response.body)[:data][:tokenizeUsBankLogin][:paymentMethod][:id]
|
|
136
146
|
end
|
|
137
147
|
|
|
138
148
|
def sample(arr)
|
|
@@ -146,23 +156,6 @@ def generate_invalid_us_bank_account_nonce
|
|
|
146
156
|
nonce += "_xxx"
|
|
147
157
|
end
|
|
148
158
|
|
|
149
|
-
def _cosmos_post(token, url, payload)
|
|
150
|
-
uri = URI::parse(url)
|
|
151
|
-
connection = Net::HTTP.new(uri.host, uri.port)
|
|
152
|
-
connection.use_ssl = true
|
|
153
|
-
connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
|
154
|
-
resp = connection.start do |http|
|
|
155
|
-
request = Net::HTTP::Post.new(uri.path)
|
|
156
|
-
request["Content-Type"] = "application/json"
|
|
157
|
-
request["Braintree-Version"] = "2016-10-07"
|
|
158
|
-
request["Authorization"] = "Bearer #{token}"
|
|
159
|
-
request.body = payload.to_json
|
|
160
|
-
http.request(request)
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
JSON.parse(resp.body)
|
|
164
|
-
end
|
|
165
|
-
|
|
166
159
|
class ClientApiHttp
|
|
167
160
|
attr_reader :config, :options
|
|
168
161
|
|
|
@@ -246,6 +246,7 @@ describe Braintree::CreditCard do
|
|
|
246
246
|
three_d_secure_info.eci_flag.should == "05"
|
|
247
247
|
three_d_secure_info.three_d_secure_version.should == "1.0.2"
|
|
248
248
|
three_d_secure_info.ds_transaction_id.should == nil
|
|
249
|
+
three_d_secure_info.three_d_secure_authentication_id.should_not be_nil
|
|
249
250
|
end
|
|
250
251
|
|
|
251
252
|
it "adds credit card with billing address to customer" do
|
|
@@ -1274,7 +1275,7 @@ describe Braintree::CreditCard do
|
|
|
1274
1275
|
Braintree::CreditCard.create!(
|
|
1275
1276
|
:customer_id => customer.id,
|
|
1276
1277
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1277
|
-
:expiration_date => "01
|
|
1278
|
+
:expiration_date => "01/#{Time.now.year - 3}"
|
|
1278
1279
|
)
|
|
1279
1280
|
end
|
|
1280
1281
|
|
|
@@ -161,6 +161,7 @@ describe Braintree::CreditCardVerification, "search" do
|
|
|
161
161
|
found_verification = Braintree::CreditCardVerification.find(credit_card_verification.id)
|
|
162
162
|
|
|
163
163
|
found_verification.should == credit_card_verification
|
|
164
|
+
found_verification.graphql_id.should_not be_nil
|
|
164
165
|
end
|
|
165
166
|
|
|
166
167
|
it "raises a NotFoundError exception if verification cannot be found" do
|
|
@@ -889,6 +889,7 @@ describe Braintree::Customer do
|
|
|
889
889
|
|
|
890
890
|
customer = Braintree::Customer.find(result.customer.id)
|
|
891
891
|
customer.id.should == result.customer.id
|
|
892
|
+
customer.graphql_id.should_not be_nil
|
|
892
893
|
customer.first_name.should == "Joe"
|
|
893
894
|
customer.last_name.should == "Cool"
|
|
894
895
|
end
|
|
@@ -1015,6 +1016,7 @@ describe Braintree::Customer do
|
|
|
1015
1016
|
android_pay_card.should be_a Braintree::AndroidPayCard
|
|
1016
1017
|
android_pay_card.token.should_not be_nil
|
|
1017
1018
|
android_pay_card.expiration_year.should_not be_nil
|
|
1019
|
+
android_pay_card.is_network_tokenized?.should == false
|
|
1018
1020
|
end
|
|
1019
1021
|
|
|
1020
1022
|
it "returns associated android pay network tokens" do
|
|
@@ -1030,6 +1032,7 @@ describe Braintree::Customer do
|
|
|
1030
1032
|
android_pay_card.should be_a Braintree::AndroidPayCard
|
|
1031
1033
|
android_pay_card.token.should_not be_nil
|
|
1032
1034
|
android_pay_card.expiration_year.should_not be_nil
|
|
1035
|
+
android_pay_card.is_network_tokenized?.should == true
|
|
1033
1036
|
end
|
|
1034
1037
|
|
|
1035
1038
|
it "returns associated amex express checkout cards" do
|
|
@@ -186,6 +186,7 @@ describe Braintree::Dispute do
|
|
|
186
186
|
dispute.amount_disputed.should == 31.0
|
|
187
187
|
dispute.amount_won.should == 0.0
|
|
188
188
|
dispute.id.should == "open_dispute"
|
|
189
|
+
dispute.graphql_id.should_not be_nil
|
|
189
190
|
dispute.status.should == Braintree::Dispute::Status::Open
|
|
190
191
|
dispute.transaction.amount.should == 31.0
|
|
191
192
|
dispute.transaction.id.should == "open_disputed_transaction"
|
|
@@ -84,10 +84,14 @@ describe Braintree::PaymentMethodNonce do
|
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
it "return paypal details if details exist" do
|
|
87
|
-
result = Braintree::PaymentMethodNonce.find("fake-
|
|
88
|
-
|
|
87
|
+
result = Braintree::PaymentMethodNonce.find("fake-paypal-one-time-nonce")
|
|
89
88
|
nonce = result.payment_method_nonce
|
|
90
89
|
|
|
90
|
+
nonce.details.fetch(:cobranded_card_label).should_not be_nil
|
|
91
|
+
nonce.details.fetch(:shipping_option_id).should_not be_nil
|
|
92
|
+
nonce.details.fetch(:billing_address).fetch(:recipient_name).should_not be_nil
|
|
93
|
+
nonce.details.fetch(:shipping_address).fetch(:recipient_name).should_not be_nil
|
|
94
|
+
|
|
91
95
|
nonce.details.fetch(:payer_info).fetch(:first_name).should_not be_nil
|
|
92
96
|
nonce.details.fetch(:payer_info).fetch(:last_name).should_not be_nil
|
|
93
97
|
nonce.details.fetch(:payer_info).fetch(:email).should_not be_nil
|
|
@@ -121,6 +121,7 @@ describe Braintree::PaymentMethod do
|
|
|
121
121
|
android_pay_card.expiration_year.to_i.should > 0
|
|
122
122
|
android_pay_card.default.should == true
|
|
123
123
|
android_pay_card.image_url.should =~ /android_pay/
|
|
124
|
+
android_pay_card.is_network_tokenized?.should == false
|
|
124
125
|
android_pay_card.source_card_type.should == Braintree::CreditCard::CardType::Discover
|
|
125
126
|
android_pay_card.source_card_last_4.should == "1111"
|
|
126
127
|
android_pay_card.google_transaction_id.should == "google_transaction_id"
|
|
@@ -148,6 +149,7 @@ describe Braintree::PaymentMethod do
|
|
|
148
149
|
android_pay_card.expiration_year.to_i.should > 0
|
|
149
150
|
android_pay_card.default.should == true
|
|
150
151
|
android_pay_card.image_url.should =~ /android_pay/
|
|
152
|
+
android_pay_card.is_network_tokenized?.should == true
|
|
151
153
|
android_pay_card.source_card_type.should == Braintree::CreditCard::CardType::MasterCard
|
|
152
154
|
android_pay_card.source_card_last_4.should == "4444"
|
|
153
155
|
android_pay_card.google_transaction_id.should == "google_transaction_id"
|
|
@@ -727,24 +729,6 @@ describe Braintree::PaymentMethod do
|
|
|
727
729
|
found_paypal_account.payer_id.should_not be_nil
|
|
728
730
|
end
|
|
729
731
|
|
|
730
|
-
it "creates a billing agreement payment method from a refresh token without upgrading" do
|
|
731
|
-
customer = Braintree::Customer.create.customer
|
|
732
|
-
result = Braintree::PaymentMethod.create(
|
|
733
|
-
:customer_id => customer.id,
|
|
734
|
-
:paypal_refresh_token => "some_future_payment_token",
|
|
735
|
-
:paypal_vault_without_upgrade => true,
|
|
736
|
-
)
|
|
737
|
-
|
|
738
|
-
result.should be_success
|
|
739
|
-
result.payment_method.should be_a(Braintree::PayPalAccount)
|
|
740
|
-
result.payment_method.billing_agreement_id.should be_nil
|
|
741
|
-
token = result.payment_method.token
|
|
742
|
-
|
|
743
|
-
found_paypal_account = Braintree::PayPalAccount.find(token)
|
|
744
|
-
found_paypal_account.should_not be_nil
|
|
745
|
-
found_paypal_account.billing_agreement_id.should be_nil
|
|
746
|
-
end
|
|
747
|
-
|
|
748
732
|
it "does not create a payment method from an unvalidated onetime paypal account nonce" do
|
|
749
733
|
customer = Braintree::Customer.create.customer
|
|
750
734
|
nonce = nonce_for_paypal_account(:access_token => "PAYPAL_ACCESS_TOKEN")
|
|
@@ -1017,6 +1001,7 @@ describe Braintree::PaymentMethod do
|
|
|
1017
1001
|
android_pay_card.expiration_year.to_i.should > 0
|
|
1018
1002
|
android_pay_card.default.should == true
|
|
1019
1003
|
android_pay_card.image_url.should =~ /android_pay/
|
|
1004
|
+
android_pay_card.is_network_tokenized?.should == false
|
|
1020
1005
|
android_pay_card.source_card_type.should == Braintree::CreditCard::CardType::Discover
|
|
1021
1006
|
android_pay_card.source_card_last_4.should == "1111"
|
|
1022
1007
|
android_pay_card.google_transaction_id.should == "google_transaction_id"
|
|
@@ -1044,6 +1029,7 @@ describe Braintree::PaymentMethod do
|
|
|
1044
1029
|
android_pay_card.expiration_year.to_i.should > 0
|
|
1045
1030
|
android_pay_card.default.should == true
|
|
1046
1031
|
android_pay_card.image_url.should =~ /android_pay/
|
|
1032
|
+
android_pay_card.is_network_tokenized?.should == true
|
|
1047
1033
|
android_pay_card.source_card_type.should == Braintree::CreditCard::CardType::MasterCard
|
|
1048
1034
|
android_pay_card.source_card_last_4.should == "4444"
|
|
1049
1035
|
android_pay_card.google_transaction_id.should == "google_transaction_id"
|
|
@@ -1706,6 +1706,7 @@ describe Braintree::Transaction do
|
|
|
1706
1706
|
android_pay_details.expiration_year.to_i.should > 0
|
|
1707
1707
|
android_pay_details.google_transaction_id.should == "google_transaction_id"
|
|
1708
1708
|
android_pay_details.image_url.should_not be_nil
|
|
1709
|
+
android_pay_details.is_network_tokenized?.should == false
|
|
1709
1710
|
android_pay_details.token.should be_nil
|
|
1710
1711
|
android_pay_details.prepaid.should_not be_nil
|
|
1711
1712
|
android_pay_details.healthcare.should_not be_nil
|
|
@@ -1737,6 +1738,7 @@ describe Braintree::Transaction do
|
|
|
1737
1738
|
android_pay_details.expiration_year.to_i.should > 0
|
|
1738
1739
|
android_pay_details.google_transaction_id.should == "google_transaction_id"
|
|
1739
1740
|
android_pay_details.image_url.should_not be_nil
|
|
1741
|
+
android_pay_details.is_network_tokenized?.should == false
|
|
1740
1742
|
android_pay_details.token.should_not be_nil
|
|
1741
1743
|
end
|
|
1742
1744
|
|
|
@@ -1759,6 +1761,7 @@ describe Braintree::Transaction do
|
|
|
1759
1761
|
android_pay_details.expiration_month.to_i.should > 0
|
|
1760
1762
|
android_pay_details.expiration_year.to_i.should > 0
|
|
1761
1763
|
android_pay_details.google_transaction_id.should == "google_transaction_id"
|
|
1764
|
+
android_pay_details.is_network_tokenized?.should == true
|
|
1762
1765
|
end
|
|
1763
1766
|
|
|
1764
1767
|
it "can create a transaction with a fake amex express checkout card nonce" do
|
|
@@ -2085,6 +2088,7 @@ describe Braintree::Transaction do
|
|
|
2085
2088
|
|
|
2086
2089
|
result = Braintree::Transaction.create(
|
|
2087
2090
|
:type => "sale",
|
|
2091
|
+
:merchant_account_id => SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2088
2092
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2089
2093
|
:credit_card => {
|
|
2090
2094
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
@@ -2121,7 +2125,8 @@ describe Braintree::Transaction do
|
|
|
2121
2125
|
result.transaction.gateway_rejection_reason.should == Braintree::Transaction::GatewayRejectionReason::ThreeDSecure
|
|
2122
2126
|
end
|
|
2123
2127
|
|
|
2124
|
-
|
|
2128
|
+
|
|
2129
|
+
it "can create a transaction without a three_d_secure_authentication_id" do
|
|
2125
2130
|
result = Braintree::Transaction.create(
|
|
2126
2131
|
:merchant_account_id => SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2127
2132
|
:type => "sale",
|
|
@@ -2134,41 +2139,174 @@ describe Braintree::Transaction do
|
|
|
2134
2139
|
result.success?.should == true
|
|
2135
2140
|
end
|
|
2136
2141
|
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2142
|
-
:credit_card => {
|
|
2142
|
+
context "with three_d_secure_authentication_id" do
|
|
2143
|
+
it "can create a transaction with a three_d_secure_authentication_id" do
|
|
2144
|
+
three_d_secure_authentication_id = SpecHelper.create_3ds_verification(
|
|
2145
|
+
SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2143
2146
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2144
|
-
:
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2147
|
+
:expiration_month => "12",
|
|
2148
|
+
:expiration_year => "2022"
|
|
2149
|
+
)
|
|
2150
|
+
|
|
2151
|
+
result = Braintree::Transaction.create(
|
|
2152
|
+
:merchant_account_id => SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2153
|
+
:type => "sale",
|
|
2154
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2155
|
+
:credit_card => {
|
|
2156
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2157
|
+
:expiration_date => "12/22",
|
|
2158
|
+
},
|
|
2159
|
+
:three_d_secure_authentication_id => three_d_secure_authentication_id
|
|
2160
|
+
)
|
|
2161
|
+
|
|
2162
|
+
result.success?.should == true
|
|
2163
|
+
end
|
|
2164
|
+
it "returns an error if sent a nil three_d_secure_authentication_id" do
|
|
2165
|
+
result = Braintree::Transaction.create(
|
|
2166
|
+
:merchant_account_id => SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2167
|
+
:type => "sale",
|
|
2168
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2169
|
+
:credit_card => {
|
|
2170
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2171
|
+
:expiration_date => "12/12",
|
|
2172
|
+
},
|
|
2173
|
+
:three_d_secure_authentication_id => nil
|
|
2174
|
+
)
|
|
2175
|
+
result.success?.should == false
|
|
2176
|
+
result.errors.for(:transaction).on(:three_d_secure_authentication_id)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureAuthenticationIdIsInvalid
|
|
2177
|
+
end
|
|
2178
|
+
it "returns an error if merchant_account in the payment_method does not match with 3ds data" do
|
|
2179
|
+
three_d_secure_authentication_id = SpecHelper.create_3ds_verification(
|
|
2180
|
+
SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2181
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2182
|
+
:expiration_month => "12",
|
|
2183
|
+
:expiration_year => "2012"
|
|
2184
|
+
)
|
|
2185
|
+
|
|
2186
|
+
result = Braintree::Transaction.create(
|
|
2187
|
+
:type => "sale",
|
|
2188
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2189
|
+
:credit_card => {
|
|
2190
|
+
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
2191
|
+
:expiration_date => "12/12",
|
|
2192
|
+
},
|
|
2193
|
+
:three_d_secure_authentication_id => three_d_secure_authentication_id
|
|
2194
|
+
)
|
|
2195
|
+
result.success?.should == false
|
|
2196
|
+
result.errors.for(:transaction).on(:three_d_secure_authentication_id)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureTransactionPaymentMethodDoesntMatchThreeDSecureAuthenticationPaymentMethod
|
|
2197
|
+
end
|
|
2198
|
+
it "returns an error if 3ds lookup data does not match txn data" do
|
|
2199
|
+
three_d_secure_authentication_id = SpecHelper.create_3ds_verification(
|
|
2200
|
+
SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2201
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2202
|
+
:expiration_month => "12",
|
|
2203
|
+
:expiration_year => "2012"
|
|
2204
|
+
)
|
|
2205
|
+
|
|
2206
|
+
result = Braintree::Transaction.create(
|
|
2207
|
+
:merchant_account_id => SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2208
|
+
:type => "sale",
|
|
2209
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2210
|
+
:credit_card => {
|
|
2211
|
+
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
2212
|
+
:expiration_date => "12/12",
|
|
2213
|
+
},
|
|
2214
|
+
:three_d_secure_authentication_id => three_d_secure_authentication_id
|
|
2215
|
+
)
|
|
2216
|
+
result.success?.should == false
|
|
2217
|
+
result.errors.for(:transaction).on(:three_d_secure_authentication_id)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureTransactionPaymentMethodDoesntMatchThreeDSecureAuthenticationPaymentMethod
|
|
2218
|
+
end
|
|
2219
|
+
it "returns an error if three_d_secure_authentication_id is supplied with three_d_secure_pass_thru" do
|
|
2220
|
+
three_d_secure_authentication_id = SpecHelper.create_3ds_verification(
|
|
2221
|
+
SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2222
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2223
|
+
:expiration_month => "12",
|
|
2224
|
+
:expiration_year => "2012"
|
|
2225
|
+
)
|
|
2226
|
+
result = Braintree::Transaction.create(
|
|
2227
|
+
:merchant_account_id => SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2228
|
+
:type => "sale",
|
|
2229
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2230
|
+
:credit_card => {
|
|
2231
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2232
|
+
:expiration_date => "12/12",
|
|
2233
|
+
},
|
|
2234
|
+
:three_d_secure_authentication_id => three_d_secure_authentication_id,
|
|
2235
|
+
:three_d_secure_pass_thru => {
|
|
2236
|
+
:eci_flag => "02",
|
|
2237
|
+
:cavv => "some_cavv",
|
|
2238
|
+
:xid => "some_xid",
|
|
2239
|
+
:three_d_secure_version => "1.0.2",
|
|
2240
|
+
:authentication_response => "Y",
|
|
2241
|
+
:directory_response => "Y",
|
|
2242
|
+
:cavv_algorithm => "2",
|
|
2243
|
+
:ds_transaction_id => "some_ds_id",
|
|
2244
|
+
}
|
|
2245
|
+
)
|
|
2246
|
+
result.success?.should == false
|
|
2247
|
+
result.errors.for(:transaction).on(:three_d_secure_authentication_id)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureAuthenticationIdWithThreeDSecurePassThruIsInvalid
|
|
2248
|
+
end
|
|
2150
2249
|
end
|
|
2151
2250
|
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
SpecHelper
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2251
|
+
context "with three_d_secure_token" do
|
|
2252
|
+
it "can create a transaction with a three_d_secure token" do
|
|
2253
|
+
three_d_secure_token = SpecHelper.create_3ds_verification(
|
|
2254
|
+
SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2255
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2256
|
+
:expiration_month => "12",
|
|
2257
|
+
:expiration_year => "2012"
|
|
2258
|
+
)
|
|
2159
2259
|
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2260
|
+
result = Braintree::Transaction.create(
|
|
2261
|
+
:merchant_account_id => SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2262
|
+
:type => "sale",
|
|
2263
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2264
|
+
:credit_card => {
|
|
2265
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2266
|
+
:expiration_date => "12/12",
|
|
2267
|
+
},
|
|
2268
|
+
:three_d_secure_token => three_d_secure_token
|
|
2269
|
+
)
|
|
2270
|
+
|
|
2271
|
+
result.success?.should == true
|
|
2272
|
+
end
|
|
2273
|
+
|
|
2274
|
+
it "returns an error if sent a nil three_d_secure token" do
|
|
2275
|
+
result = Braintree::Transaction.create(
|
|
2276
|
+
:merchant_account_id => SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2277
|
+
:type => "sale",
|
|
2278
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2279
|
+
:credit_card => {
|
|
2280
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2281
|
+
:expiration_date => "12/12",
|
|
2282
|
+
},
|
|
2283
|
+
:three_d_secure_token => nil
|
|
2284
|
+
)
|
|
2285
|
+
result.success?.should == false
|
|
2286
|
+
result.errors.for(:transaction).on(:three_d_secure_token)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureTokenIsInvalid
|
|
2287
|
+
end
|
|
2288
|
+
|
|
2289
|
+
it "returns an error if 3ds lookup data does not match txn data" do
|
|
2290
|
+
three_d_secure_token = SpecHelper.create_3ds_verification(
|
|
2291
|
+
SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2292
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2293
|
+
:expiration_month => "12",
|
|
2294
|
+
:expiration_year => "2012"
|
|
2295
|
+
)
|
|
2296
|
+
|
|
2297
|
+
result = Braintree::Transaction.create(
|
|
2298
|
+
:merchant_account_id => SpecHelper::ThreeDSecureMerchantAccountId,
|
|
2299
|
+
:type => "sale",
|
|
2300
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2301
|
+
:credit_card => {
|
|
2302
|
+
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
2303
|
+
:expiration_date => "12/12",
|
|
2304
|
+
},
|
|
2305
|
+
:three_d_secure_token => three_d_secure_token
|
|
2306
|
+
)
|
|
2307
|
+
result.success?.should == false
|
|
2308
|
+
result.errors.for(:transaction).on(:three_d_secure_token)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureTransactionDataDoesntMatchVerify
|
|
2309
|
+
end
|
|
2172
2310
|
end
|
|
2173
2311
|
|
|
2174
2312
|
it "can create a transaction with a three_d_secure_pass_thru" do
|
|
@@ -2632,6 +2770,36 @@ describe Braintree::Transaction do
|
|
|
2632
2770
|
result.success?.should == false
|
|
2633
2771
|
result.errors.for(:transaction).on(:base)[0].code.should == Braintree::ErrorCodes::Transaction::CannotRefundUnlessSettled
|
|
2634
2772
|
end
|
|
2773
|
+
|
|
2774
|
+
it "handles soft declined refund authorizations" do
|
|
2775
|
+
transaction = Braintree::Transaction.sale!(
|
|
2776
|
+
:amount => "9000.00",
|
|
2777
|
+
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
|
2778
|
+
:options => {
|
|
2779
|
+
:submit_for_settlement => true
|
|
2780
|
+
}
|
|
2781
|
+
)
|
|
2782
|
+
config = Braintree::Configuration.instantiate
|
|
2783
|
+
response = config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
|
|
2784
|
+
result = Braintree::Transaction.refund(transaction.id, :amount => "2046.00")
|
|
2785
|
+
result.success?.should == false
|
|
2786
|
+
result.errors.for(:transaction).on(:base)[0].code.should == Braintree::ErrorCodes::Transaction::RefundAuthSoftDeclined
|
|
2787
|
+
end
|
|
2788
|
+
|
|
2789
|
+
it "handles hard declined refund authorizations" do
|
|
2790
|
+
transaction = Braintree::Transaction.sale!(
|
|
2791
|
+
:amount => "9000.00",
|
|
2792
|
+
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
|
2793
|
+
:options => {
|
|
2794
|
+
:submit_for_settlement => true
|
|
2795
|
+
}
|
|
2796
|
+
)
|
|
2797
|
+
config = Braintree::Configuration.instantiate
|
|
2798
|
+
response = config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
|
|
2799
|
+
result = Braintree::Transaction.refund(transaction.id, :amount => "2009.00")
|
|
2800
|
+
result.success?.should == false
|
|
2801
|
+
result.errors.for(:transaction).on(:base)[0].code.should == Braintree::ErrorCodes::Transaction::RefundAuthHardDeclined
|
|
2802
|
+
end
|
|
2635
2803
|
end
|
|
2636
2804
|
|
|
2637
2805
|
context "handling errors" do
|
|
@@ -5088,6 +5256,71 @@ describe Braintree::Transaction do
|
|
|
5088
5256
|
result.errors.for(:transaction).on(:amount)[0].code.should == Braintree::ErrorCodes::Transaction::SettlementAmountIsLessThanServiceFeeAmount
|
|
5089
5257
|
end
|
|
5090
5258
|
end
|
|
5259
|
+
|
|
5260
|
+
it "succeeds when level 2 data is provided" do
|
|
5261
|
+
result = Braintree::Transaction.sale(
|
|
5262
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
5263
|
+
:merchant_account_id => SpecHelper::FakeAmexDirectMerchantAccountId,
|
|
5264
|
+
:credit_card => {
|
|
5265
|
+
:number => Braintree::Test::CreditCardNumbers::AmexPayWithPoints::Success,
|
|
5266
|
+
:expiration_date => "05/2009"
|
|
5267
|
+
},
|
|
5268
|
+
:options => {
|
|
5269
|
+
:amex_rewards => {
|
|
5270
|
+
:request_id => "ABC123",
|
|
5271
|
+
:points => "1000",
|
|
5272
|
+
:currency_amount => "10.00",
|
|
5273
|
+
:currency_iso_code => "USD"
|
|
5274
|
+
}
|
|
5275
|
+
}
|
|
5276
|
+
)
|
|
5277
|
+
result.success?.should == true
|
|
5278
|
+
|
|
5279
|
+
result = Braintree::Transaction.submit_for_settlement(result.transaction.id, nil, :tax_amount => "2.00", :tax_exempt => false, :purchase_order_number => "0Rd3r#")
|
|
5280
|
+
result.success?.should == true
|
|
5281
|
+
result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
|
5282
|
+
end
|
|
5283
|
+
|
|
5284
|
+
it "succeeds when level 3 data is provided" do
|
|
5285
|
+
result = Braintree::Transaction.sale(
|
|
5286
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
5287
|
+
:merchant_account_id => SpecHelper::FakeAmexDirectMerchantAccountId,
|
|
5288
|
+
:credit_card => {
|
|
5289
|
+
:number => Braintree::Test::CreditCardNumbers::AmexPayWithPoints::Success,
|
|
5290
|
+
:expiration_date => "05/2009"
|
|
5291
|
+
},
|
|
5292
|
+
:options => {
|
|
5293
|
+
:amex_rewards => {
|
|
5294
|
+
:request_id => "ABC123",
|
|
5295
|
+
:points => "1000",
|
|
5296
|
+
:currency_amount => "10.00",
|
|
5297
|
+
:currency_iso_code => "USD"
|
|
5298
|
+
}
|
|
5299
|
+
}
|
|
5300
|
+
)
|
|
5301
|
+
result.success?.should == true
|
|
5302
|
+
|
|
5303
|
+
result = Braintree::Transaction.submit_for_settlement(
|
|
5304
|
+
result.transaction.id,
|
|
5305
|
+
nil,
|
|
5306
|
+
:discount_amount => "2.00",
|
|
5307
|
+
:shipping_amount => "1.23",
|
|
5308
|
+
:ships_from_postal_code => "90210",
|
|
5309
|
+
:line_items => [
|
|
5310
|
+
{
|
|
5311
|
+
:quantity => 1,
|
|
5312
|
+
:unit_amount => 1,
|
|
5313
|
+
:name => "New line item",
|
|
5314
|
+
:kind => "debit",
|
|
5315
|
+
:total_amount => "18.00",
|
|
5316
|
+
:discount_amount => "12.00",
|
|
5317
|
+
:tax_amount => "0",
|
|
5318
|
+
},
|
|
5319
|
+
]
|
|
5320
|
+
)
|
|
5321
|
+
result.success?.should == true
|
|
5322
|
+
result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
|
5323
|
+
end
|
|
5091
5324
|
end
|
|
5092
5325
|
|
|
5093
5326
|
describe "self.submit_for_settlement!" do
|
|
@@ -5884,6 +6117,7 @@ describe Braintree::Transaction do
|
|
|
5884
6117
|
created_transaction = result.transaction
|
|
5885
6118
|
found_transaction = Braintree::Transaction.find(created_transaction.id)
|
|
5886
6119
|
found_transaction.should == created_transaction
|
|
6120
|
+
found_transaction.graphql_id.should_not be_nil
|
|
5887
6121
|
end
|
|
5888
6122
|
|
|
5889
6123
|
it "finds the vaulted transaction with the given id" do
|
data/spec/spec_helper.rb
CHANGED
|
@@ -110,7 +110,7 @@ unless defined?(SPEC_HELPER_LOADED)
|
|
|
110
110
|
def self.create_3ds_verification(merchant_account_id, params)
|
|
111
111
|
config = Braintree::Configuration.instantiate
|
|
112
112
|
response = config.http.post("#{config.base_merchant_path}/three_d_secure/create_verification/#{merchant_account_id}", :three_d_secure_verification => params)
|
|
113
|
-
response[:three_d_secure_verification][:
|
|
113
|
+
response[:three_d_secure_verification][:three_d_secure_authentication_id]
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
def self.create_merchant(params={})
|
|
@@ -12,6 +12,7 @@ describe Braintree::ThreeDSecureInfo do
|
|
|
12
12
|
:eci_flag => "06",
|
|
13
13
|
:three_d_secure_version => "1.0.2",
|
|
14
14
|
:ds_transaction_id => "dstrxid",
|
|
15
|
+
:three_d_secure_authentication_id => "auth_id",
|
|
15
16
|
)
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -26,12 +27,13 @@ describe Braintree::ThreeDSecureInfo do
|
|
|
26
27
|
three_d_secure_info.eci_flag.should == "06"
|
|
27
28
|
three_d_secure_info.three_d_secure_version.should == "1.0.2"
|
|
28
29
|
three_d_secure_info.ds_transaction_id.should == "dstrxid"
|
|
30
|
+
three_d_secure_info.three_d_secure_authentication_id.should == "auth_id"
|
|
29
31
|
end
|
|
30
32
|
end
|
|
31
33
|
|
|
32
34
|
describe "inspect" do
|
|
33
35
|
it "prints the attributes" do
|
|
34
|
-
three_d_secure_info.inspect.should == %(#<ThreeDSecureInfo enrolled: "Y", liability_shifted: true, liability_shift_possible: true, status: "authenticate_successful", cavv: "cavvvalue", xid: "xidvalue", eci_flag: "06", three_d_secure_version: "1.0.2", ds_transaction_id: "dstrxid">)
|
|
36
|
+
three_d_secure_info.inspect.should == %(#<ThreeDSecureInfo enrolled: "Y", liability_shifted: true, liability_shift_possible: true, status: "authenticate_successful", cavv: "cavvvalue", xid: "xidvalue", eci_flag: "06", three_d_secure_version: "1.0.2", ds_transaction_id: "dstrxid", three_d_secure_authentication_id: "auth_id">)
|
|
35
37
|
end
|
|
36
38
|
end
|
|
37
39
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: braintree
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.101.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Braintree
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-02-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: builder
|
|
@@ -320,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
320
320
|
- !ruby/object:Gem::Version
|
|
321
321
|
version: '0'
|
|
322
322
|
requirements: []
|
|
323
|
-
rubygems_version: 3.
|
|
323
|
+
rubygems_version: 3.1.2
|
|
324
324
|
signing_key:
|
|
325
325
|
specification_version: 4
|
|
326
326
|
summary: Braintree Gateway Ruby Client Library
|