braintree 4.21.0 → 4.23.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/client_token_gateway.rb +2 -2
- data/lib/braintree/configuration.rb +1 -1
- data/lib/braintree/credit_card_gateway.rb +1 -0
- data/lib/braintree/credit_card_verification.rb +16 -12
- data/lib/braintree/customer.rb +2 -1
- data/lib/braintree/customer_gateway.rb +2 -0
- data/lib/braintree/error_codes.rb +3 -0
- data/lib/braintree/local_payment_completed/blik_alias.rb +23 -0
- data/lib/braintree/local_payment_completed.rb +6 -1
- data/lib/braintree/payment_instrument_type.rb +1 -0
- data/lib/braintree/payment_method_gateway.rb +3 -0
- data/lib/braintree/payment_method_parser.rb +1 -0
- data/lib/braintree/paypal_account.rb +1 -0
- data/lib/braintree/samsung_pay_card.rb +2 -0
- data/lib/braintree/test/nonce.rb +1 -0
- data/lib/braintree/transaction/local_payment_details.rb +1 -0
- data/lib/braintree/transaction/samsung_pay_card_details.rb +2 -0
- data/lib/braintree/transaction.rb +3 -1
- data/lib/braintree/transaction_gateway.rb +48 -46
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/webhook_testing_gateway.rb +36 -0
- data/lib/braintree.rb +1 -0
- data/lib/ssl/api_braintreegateway_com.ca.crt +401 -168
- data/spec/integration/braintree/apple_pay_spec.rb +1 -1
- data/spec/integration/braintree/client_api/client_token_spec.rb +229 -38
- data/spec/integration/braintree/credit_card_spec.rb +2 -2
- data/spec/integration/braintree/credit_card_verification_spec.rb +20 -1
- data/spec/integration/braintree/customer_spec.rb +23 -2
- data/spec/integration/braintree/merchant_account_spec.rb +2 -2
- data/spec/integration/braintree/merchant_spec.rb +17 -138
- data/spec/integration/braintree/payment_method_spec.rb +29 -2
- data/spec/integration/braintree/paypal_account_spec.rb +1 -0
- data/spec/integration/braintree/samsung_pay_card_spec.rb +3 -1
- data/spec/integration/braintree/transaction_spec.rb +56 -22
- data/spec/unit/braintree/client_token_spec.rb +1 -1
- data/spec/unit/braintree/configuration_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_spec.rb +2 -2
- data/spec/unit/braintree/credit_card_verification_spec.rb +13 -2
- data/spec/unit/braintree/customer_spec.rb +1 -0
- data/spec/unit/braintree/error_result_spec.rb +1 -1
- data/spec/unit/braintree/local_payment_completed_spec.rb +44 -4
- data/spec/unit/braintree/paypal_account_spec.rb +9 -0
- data/spec/unit/braintree/transaction/local_payment_details_spec.rb +6 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +50 -48
- data/spec/unit/braintree/webhook_notification_spec.rb +22 -1
- metadata +3 -2
@@ -427,6 +427,33 @@ describe Braintree::PaymentMethod do
|
|
427
427
|
expect(result.errors.first.code).to eq("81724")
|
428
428
|
end
|
429
429
|
|
430
|
+
it "respects fail_on_duplicate_payment_method_for_customer when included outside of the nonce" do
|
431
|
+
customer = Braintree::Customer.create!
|
432
|
+
result = Braintree::CreditCard.create(
|
433
|
+
:customer_id => customer.id,
|
434
|
+
:number => 4111111111111111,
|
435
|
+
:expiration_date => "05/2012",
|
436
|
+
)
|
437
|
+
expect(result).to be_success
|
438
|
+
|
439
|
+
nonce = nonce_for_new_payment_method(
|
440
|
+
:credit_card => {
|
441
|
+
:number => 4111111111111111,
|
442
|
+
:expiration_date => "05/2012"
|
443
|
+
},
|
444
|
+
)
|
445
|
+
result = Braintree::PaymentMethod.create(
|
446
|
+
:payment_method_nonce => nonce,
|
447
|
+
:customer_id => customer.id,
|
448
|
+
:options => {
|
449
|
+
:fail_on_duplicate_payment_method_for_customer => true
|
450
|
+
},
|
451
|
+
)
|
452
|
+
|
453
|
+
expect(result).not_to be_success
|
454
|
+
expect(result.errors.first.code).to eq("81763")
|
455
|
+
end
|
456
|
+
|
430
457
|
it "allows passing the billing address outside of the nonce" do
|
431
458
|
config = Braintree::Configuration.instantiate
|
432
459
|
customer = Braintree::Customer.create.customer
|
@@ -659,7 +686,7 @@ describe Braintree::PaymentMethod do
|
|
659
686
|
:customer_id => customer.id,
|
660
687
|
:options => {
|
661
688
|
:verify_card => true,
|
662
|
-
:verification_merchant_account_id => SpecHelper::
|
689
|
+
:verification_merchant_account_id => SpecHelper::CardProcessorBRLMerchantAccountId,
|
663
690
|
:verification_account_type => "debit",
|
664
691
|
},
|
665
692
|
)
|
@@ -776,7 +803,7 @@ describe Braintree::PaymentMethod do
|
|
776
803
|
:expiration_date => "06/2013",
|
777
804
|
:options => {
|
778
805
|
:verify_card => true,
|
779
|
-
:verification_merchant_account_id => SpecHelper::
|
806
|
+
:verification_merchant_account_id => SpecHelper::CardProcessorBRLMerchantAccountId,
|
780
807
|
:verification_account_type => "debit",
|
781
808
|
},
|
782
809
|
)
|
@@ -26,6 +26,7 @@ describe Braintree::PayPalAccount do
|
|
26
26
|
expect(paypal_account.updated_at).not_to be_nil
|
27
27
|
expect(paypal_account.customer_id).to eq(customer.id)
|
28
28
|
expect(paypal_account.funding_source_description).to be_nil
|
29
|
+
expect(paypal_account.edit_paypal_vault_id).to be_nil
|
29
30
|
expect(paypal_account.revoked_at).to be_nil
|
30
31
|
end
|
31
32
|
|
@@ -1,7 +1,9 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")
|
3
3
|
|
4
|
-
|
4
|
+
# NEXT_MAJOR_VERSION remove these tests
|
5
|
+
# SamsungPayCard has been deprecated
|
6
|
+
xdescribe Braintree::SamsungPayCard do
|
5
7
|
it "can create from payment method nonce" do
|
6
8
|
customer = Braintree::Customer.create!
|
7
9
|
|
@@ -1153,7 +1153,7 @@ describe Braintree::Transaction do
|
|
1153
1153
|
)
|
1154
1154
|
result = gateway.merchant.create(
|
1155
1155
|
:email => "name@email.com",
|
1156
|
-
:country_code_alpha3 => "
|
1156
|
+
:country_code_alpha3 => "GBR",
|
1157
1157
|
:payment_methods => ["credit_card", "paypal"],
|
1158
1158
|
)
|
1159
1159
|
|
@@ -4860,27 +4860,6 @@ describe Braintree::Transaction do
|
|
4860
4860
|
end
|
4861
4861
|
|
4862
4862
|
context "external vault" do
|
4863
|
-
it "returns a validation error if used with an unsupported instrument type" do
|
4864
|
-
customer = Braintree::Customer.create!
|
4865
|
-
result = Braintree::PaymentMethod.create(
|
4866
|
-
:payment_method_nonce => Braintree::Test::Nonce::PayPalBillingAgreement,
|
4867
|
-
:customer_id => customer.id,
|
4868
|
-
)
|
4869
|
-
payment_method_token = result.payment_method.token
|
4870
|
-
|
4871
|
-
result = Braintree::Transaction.create(
|
4872
|
-
:type => "sale",
|
4873
|
-
:customer_id => customer.id,
|
4874
|
-
:payment_method_token => payment_method_token,
|
4875
|
-
:external_vault => {
|
4876
|
-
:status => Braintree::Transaction::ExternalVault::Status::WillVault,
|
4877
|
-
},
|
4878
|
-
:amount => "10.00",
|
4879
|
-
)
|
4880
|
-
expect(result.success?).to eq(false)
|
4881
|
-
expect(result.errors.for(:transaction)[0].code).to eq(Braintree::ErrorCodes::Transaction::PaymentInstrumentWithExternalVaultIsInvalid)
|
4882
|
-
end
|
4883
|
-
|
4884
4863
|
it "reject invalid status" do
|
4885
4864
|
result = Braintree::Transaction.create(
|
4886
4865
|
:type => "sale",
|
@@ -7935,4 +7914,59 @@ describe Braintree::Transaction do
|
|
7935
7914
|
expect(result.transaction.merchant_advice_code_text).to eq("New account information available")
|
7936
7915
|
end
|
7937
7916
|
end
|
7917
|
+
|
7918
|
+
context "Shipping Tax Amount" do
|
7919
|
+
it "accepts shipping-tax-amount field" do
|
7920
|
+
result = Braintree::Transaction.create(
|
7921
|
+
:type => "sale",
|
7922
|
+
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
7923
|
+
:amount => "10.00",
|
7924
|
+
:shipping_amount => "1.00",
|
7925
|
+
:shipping_tax_amount => "1.00",
|
7926
|
+
:discount_amount => "2.00",
|
7927
|
+
:ships_from_postal_code => "12345",
|
7928
|
+
)
|
7929
|
+
|
7930
|
+
expect(result.success?).to eq(true)
|
7931
|
+
expect(result.transaction.shipping_amount).to eq("1.00")
|
7932
|
+
expect(result.transaction.shipping_tax_amount).to eq("1.00")
|
7933
|
+
expect(result.transaction.discount_amount).to eq("2.00")
|
7934
|
+
expect(result.transaction.ships_from_postal_code).to eq("12345")
|
7935
|
+
end
|
7936
|
+
|
7937
|
+
it "submit for settlement succeeds when shipping tax amount is provided" do
|
7938
|
+
result = Braintree::Transaction.sale(
|
7939
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
7940
|
+
:merchant_account_id => SpecHelper::FakeFirstDataMerchantAccountId,
|
7941
|
+
:credit_card => {
|
7942
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
7943
|
+
:expiration_date => "05/2029"
|
7944
|
+
},
|
7945
|
+
)
|
7946
|
+
expect(result.success?).to eq(true)
|
7947
|
+
|
7948
|
+
result = Braintree::Transaction.submit_for_settlement(
|
7949
|
+
result.transaction.id,
|
7950
|
+
nil,
|
7951
|
+
:discount_amount => "2.00",
|
7952
|
+
:shipping_amount => "1.23",
|
7953
|
+
:shipping_tax_amount => "0.40",
|
7954
|
+
:ships_from_postal_code => "90210",
|
7955
|
+
:line_items => [
|
7956
|
+
{
|
7957
|
+
:quantity => 1,
|
7958
|
+
:unit_amount => 1,
|
7959
|
+
:name => "New line item",
|
7960
|
+
:kind => "debit",
|
7961
|
+
:total_amount => "18.00",
|
7962
|
+
:discount_amount => "12.00",
|
7963
|
+
:tax_amount => "0",
|
7964
|
+
},
|
7965
|
+
],
|
7966
|
+
)
|
7967
|
+
expect(result.success?).to eq(true)
|
7968
|
+
expect(result.transaction.shipping_tax_amount).to eq("0.40")
|
7969
|
+
expect(result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
|
7970
|
+
end
|
7971
|
+
end
|
7938
7972
|
end
|
@@ -23,7 +23,7 @@ module Braintree
|
|
23
23
|
end
|
24
24
|
|
25
25
|
context "adding credit_card options with no customer ID" do
|
26
|
-
%w(verify_card fail_on_duplicate_payment_method make_default).each do |option_name|
|
26
|
+
%w(verify_card fail_on_duplicate_payment_method make_default fail_on_duplicate_payment_method_for_customer).each do |option_name|
|
27
27
|
it "raises an ArgumentError if #{option_name} is present" do
|
28
28
|
expect do
|
29
29
|
Braintree::ClientToken.generate(
|
@@ -399,7 +399,7 @@ describe Braintree::Configuration do
|
|
399
399
|
|
400
400
|
it "is qa.braintreegateway.com for qa" do
|
401
401
|
Braintree::Configuration.environment = :qa
|
402
|
-
expect(Braintree::Configuration.instantiate.server).to eq("gateway.
|
402
|
+
expect(Braintree::Configuration.instantiate.server).to eq("gateway.qa2.braintreepayments.com")
|
403
403
|
end
|
404
404
|
|
405
405
|
it "can by changed by configuring the production endpoint" do
|
@@ -25,7 +25,7 @@ describe Braintree::CreditCard do
|
|
25
25
|
:payment_method_nonce,
|
26
26
|
{:external_vault=>[:network_transaction_id]},
|
27
27
|
{:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, # NEXT_MAJOR_VERSION Remove this attribute
|
28
|
-
:fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code])},
|
28
|
+
:fail_on_duplicate_payment_method, :fail_on_duplicate_payment_method_for_customer, :verification_account_type, :verification_currency_iso_code])},
|
29
29
|
{:billing_address => [
|
30
30
|
:company,
|
31
31
|
:country_code_alpha2,
|
@@ -73,7 +73,7 @@ describe Braintree::CreditCard do
|
|
73
73
|
:payment_method_nonce,
|
74
74
|
{:external_vault=>[:network_transaction_id]},
|
75
75
|
{:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, # NEXT_MAJOR_VERSION Remove this attribute
|
76
|
-
:fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code])},
|
76
|
+
:fail_on_duplicate_payment_method, :fail_on_duplicate_payment_method_for_customer, :verification_account_type, :verification_currency_iso_code])},
|
77
77
|
{:billing_address => [
|
78
78
|
:company,
|
79
79
|
:country_code_alpha2,
|
@@ -6,6 +6,8 @@ describe Braintree::CreditCardVerification do
|
|
6
6
|
verification = Braintree::CreditCardVerification._new(
|
7
7
|
:status => "verified",
|
8
8
|
:amount => "12.45",
|
9
|
+
:ani_first_name_response_code => "I",
|
10
|
+
:ani_last_name_response_code => "I",
|
9
11
|
:currency_iso_code => "USD",
|
10
12
|
:avs_error_response_code => "I",
|
11
13
|
:avs_postal_code_response_code => "I",
|
@@ -17,8 +19,7 @@ describe Braintree::CreditCardVerification do
|
|
17
19
|
:network_response_code => "05",
|
18
20
|
:network_response_text => "Do not Honor",
|
19
21
|
)
|
20
|
-
|
21
|
-
expect(verification.inspect).to eq(%(#<Braintree::CreditCardVerification status: "verified", processor_response_code: "2000", processor_response_text: "Do Not Honor", amount: "12.45", currency_iso_code: "USD", cvv_response_code: "I", avs_error_response_code: "I", avs_postal_code_response_code: "I", avs_street_address_response_code: "I", network_response_code: "05", network_response_text: "Do not Honor", merchant_account_id: "some_id", gateway_rejection_reason: nil, id: nil, credit_card: nil, billing: nil, created_at: nil>))
|
22
|
+
expect(verification.inspect).to eq(%(#<Braintree::CreditCardVerification amount: "12.45", ani_first_name_response_code: "I", ani_last_name_response_code: "I", avs_error_response_code: "I", avs_postal_code_response_code: "I", avs_street_address_response_code: "I", billing: nil, created_at: nil, credit_card: nil, currency_iso_code: "USD", cvv_response_code: "I", gateway_rejection_reason: nil, id: nil, merchant_account_id: "some_id", network_response_code: "05", network_response_text: "Do not Honor", processor_response_code: "2000", processor_response_text: "Do Not Honor", status: "verified">))
|
22
23
|
end
|
23
24
|
|
24
25
|
it "has a status" do
|
@@ -37,6 +38,16 @@ describe Braintree::CreditCardVerification do
|
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
41
|
+
it "accepts ani name reponse codes" do
|
42
|
+
verification = Braintree::CreditCardVerification._new(
|
43
|
+
:ani_first_name_response_code => "M",
|
44
|
+
:ani_last_name_response_code => "M",
|
45
|
+
)
|
46
|
+
|
47
|
+
expect(verification.ani_first_name_response_code).to eq("M")
|
48
|
+
expect(verification.ani_last_name_response_code).to eq("M")
|
49
|
+
end
|
50
|
+
|
40
51
|
it "accepts amount as either a String or BigDecimal" do
|
41
52
|
expect(Braintree::CreditCardVerification._new(:amount => "12.34").amount).to eq(BigDecimal("12.34"))
|
42
53
|
expect(Braintree::CreditCardVerification._new(:amount => BigDecimal("12.34")).amount).to eq(BigDecimal("12.34"))
|
@@ -209,6 +209,7 @@ describe Braintree::Customer do
|
|
209
209
|
:verification_amount,
|
210
210
|
:venmo_sdk_session, # NEXT_MAJOR_VERSION Remove this attribute
|
211
211
|
:fail_on_duplicate_payment_method,
|
212
|
+
:fail_on_duplicate_payment_method_for_customer,
|
212
213
|
:verification_account_type,
|
213
214
|
:verification_currency_iso_code,
|
214
215
|
:update_existing_token
|
@@ -38,7 +38,7 @@ describe Braintree::ErrorResult do
|
|
38
38
|
:verification => {},
|
39
39
|
:transaction => nil,
|
40
40
|
)
|
41
|
-
expect(result.inspect).to include("credit_card_verification: #<Braintree::CreditCardVerification
|
41
|
+
expect(result.inspect).to include("credit_card_verification: #<Braintree::CreditCardVerification amount: ")
|
42
42
|
end
|
43
43
|
|
44
44
|
it "does not include the credit_card_verification if there isn't one" do
|
@@ -12,8 +12,11 @@ describe Braintree::LocalPaymentCompleted do
|
|
12
12
|
describe "self._new" do
|
13
13
|
it "initializes the object with the appropriate attributes set" do
|
14
14
|
params = {
|
15
|
-
|
15
|
+
bic: "a-bic",
|
16
|
+
iban_last_chars: "1234",
|
16
17
|
payer_id: "a-payer-id",
|
18
|
+
payer_name: "John Doe",
|
19
|
+
payment_id: "a-payment-id",
|
17
20
|
payment_method_nonce: "a-nonce",
|
18
21
|
transaction: {
|
19
22
|
id: "a-transaction-id",
|
@@ -24,25 +27,62 @@ describe Braintree::LocalPaymentCompleted do
|
|
24
27
|
}
|
25
28
|
local_payment_completed = Braintree::LocalPaymentCompleted._new(params)
|
26
29
|
|
27
|
-
expect(local_payment_completed.
|
30
|
+
expect(local_payment_completed.bic).to eq("a-bic")
|
31
|
+
expect(local_payment_completed.iban_last_chars).to eq("1234")
|
28
32
|
expect(local_payment_completed.payer_id).to eq("a-payer-id")
|
33
|
+
expect(local_payment_completed.payer_name).to eq("John Doe")
|
34
|
+
expect(local_payment_completed.payment_id).to eq("a-payment-id")
|
29
35
|
expect(local_payment_completed.payment_method_nonce).to eq("a-nonce")
|
30
|
-
expect(local_payment_completed.transaction.id).to eq("a-transaction-id")
|
31
36
|
expect(local_payment_completed.transaction.amount).to eq(31.0)
|
37
|
+
expect(local_payment_completed.transaction.id).to eq("a-transaction-id")
|
32
38
|
expect(local_payment_completed.transaction.order_id).to eq("an-order-id")
|
33
39
|
expect(local_payment_completed.transaction.status).to eq(Braintree::Transaction::Status::Authorized)
|
34
40
|
end
|
35
41
|
|
36
42
|
it "initializes the object with the appropriate attributes set if no transaction is provided" do
|
37
43
|
params = {
|
38
|
-
|
44
|
+
bic: "a-bic",
|
45
|
+
iban_last_chars: "1234",
|
39
46
|
payer_id: "a-payer-id",
|
47
|
+
payer_name: "John Doe",
|
48
|
+
payment_id: "a-payment-id",
|
40
49
|
payment_method_nonce: "a-nonce",
|
41
50
|
}
|
42
51
|
local_payment_completed = Braintree::LocalPaymentCompleted._new(params)
|
43
52
|
|
53
|
+
expect(local_payment_completed.bic).to eq("a-bic")
|
54
|
+
expect(local_payment_completed.blik_aliases).to be_nil
|
55
|
+
expect(local_payment_completed.iban_last_chars).to eq("1234")
|
56
|
+
expect(local_payment_completed.payer_id).to eq("a-payer-id")
|
57
|
+
expect(local_payment_completed.payer_name).to eq("John Doe")
|
44
58
|
expect(local_payment_completed.payment_id).to eq("a-payment-id")
|
59
|
+
expect(local_payment_completed.payment_method_nonce).to eq("a-nonce")
|
60
|
+
expect(local_payment_completed.transaction).to be_nil
|
61
|
+
end
|
62
|
+
|
63
|
+
it "initializes the object with the appropriate attributes when blik_aliases is provided" do
|
64
|
+
params = {
|
65
|
+
bic: "a-bic",
|
66
|
+
blik_aliases: [
|
67
|
+
{
|
68
|
+
key: "an-alias-key",
|
69
|
+
label: "an-alias-label"
|
70
|
+
}
|
71
|
+
],
|
72
|
+
iban_last_chars: "1234",
|
73
|
+
payer_id: "a-payer-id",
|
74
|
+
payer_name: "John Doe",
|
75
|
+
payment_id: "a-payment-id",
|
76
|
+
payment_method_nonce: "a-nonce",
|
77
|
+
}
|
78
|
+
local_payment_completed = Braintree::LocalPaymentCompleted._new(params)
|
79
|
+
|
80
|
+
expect(local_payment_completed.bic).to eq("a-bic")
|
81
|
+
expect(local_payment_completed.blik_aliases).to match_array([{key: "an-alias-key", label: "an-alias-label"}])
|
82
|
+
expect(local_payment_completed.iban_last_chars).to eq("1234")
|
45
83
|
expect(local_payment_completed.payer_id).to eq("a-payer-id")
|
84
|
+
expect(local_payment_completed.payer_name).to eq("John Doe")
|
85
|
+
expect(local_payment_completed.payment_id).to eq("a-payment-id")
|
46
86
|
expect(local_payment_completed.payment_method_nonce).to eq("a-nonce")
|
47
87
|
expect(local_payment_completed.transaction).to be_nil
|
48
88
|
end
|
@@ -41,4 +41,13 @@ describe Braintree::PayPalAccount do
|
|
41
41
|
expect(paypal_account.updated_at).to eq(now)
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
describe "edit_paypal_vault_id" do
|
46
|
+
it "exposes edit_paypal_vault_id" do
|
47
|
+
mock_edit_paypal_vault_id = "ENCR-BA-ID1"
|
48
|
+
paypal_account = Braintree::PayPalAccount._new(:gateway, :edit_paypal_vault_id => mock_edit_paypal_vault_id)
|
49
|
+
|
50
|
+
expect(paypal_account.edit_paypal_vault_id).to eq(mock_edit_paypal_vault_id)
|
51
|
+
end
|
52
|
+
end
|
44
53
|
end
|
@@ -4,6 +4,12 @@ describe Braintree::Transaction::LocalPaymentDetails do
|
|
4
4
|
describe "initialize" do
|
5
5
|
let(:params) do
|
6
6
|
{
|
7
|
+
blik_aliases: [
|
8
|
+
{
|
9
|
+
key: "a-key",
|
10
|
+
label: "a-label"
|
11
|
+
}
|
12
|
+
],
|
7
13
|
capture_id: "a-capture-id",
|
8
14
|
custom_field: "custom-field",
|
9
15
|
debug_id: "debug-id",
|
@@ -33,36 +33,45 @@ describe Braintree::TransactionGateway do
|
|
33
33
|
# three_d_secure_token has been deprecated in favor of three_d_secure_authentication_id
|
34
34
|
it "creates a transaction gateway signature" do
|
35
35
|
expect(Braintree::TransactionGateway._create_signature).to match([
|
36
|
-
:amount, :billing_address_id, :channel, :
|
36
|
+
:amount, :billing_address_id, :channel, :currency_iso_code, :customer_id, :device_data,
|
37
|
+
:discount_amount, :exchange_rate_quote_id, :foreign_retailer,
|
37
38
|
:merchant_account_id, :order_id, :payment_method_nonce, :payment_method_token,
|
38
39
|
:product_sku, :purchase_order_number, :service_fee_amount, :shared_billing_address_id,
|
39
40
|
:shared_customer_id, :shared_payment_method_nonce, :shared_payment_method_token,
|
40
|
-
:shared_shipping_address_id, :shipping_address_id, :shipping_amount,
|
41
|
+
:shared_shipping_address_id, :shipping_address_id, :shipping_amount, :shipping_tax_amount,
|
41
42
|
:ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,:three_d_secure_token, #Deprecated
|
42
|
-
:transaction_source, :type, :venmo_sdk_payment_method_code, #Deprecated
|
43
|
-
:sca_exemption,
|
44
|
-
{:
|
45
|
-
{:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
|
46
|
-
{: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]}]},
|
47
|
-
{:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
|
43
|
+
:transaction_source, :type, :venmo_sdk_payment_method_code, # Deprecated
|
44
|
+
:sca_exemption,
|
45
|
+
{:apple_pay_card => [:number, :cardholder_name, :cryptogram, :expiration_month, :expiration_year, :eci_indicator]},
|
48
46
|
{
|
49
47
|
:billing => Braintree::AddressGateway._shared_signature
|
50
48
|
},
|
51
|
-
{
|
52
|
-
|
53
|
-
},
|
54
|
-
{
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
:
|
64
|
-
|
65
|
-
|
49
|
+
{: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]}]},
|
50
|
+
{:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
|
51
|
+
{:custom_fields => :_any_key_},
|
52
|
+
{:descriptor => [:name, :phone, :url]},
|
53
|
+
{:external_vault => [
|
54
|
+
:status,
|
55
|
+
:previous_network_transaction_id,
|
56
|
+
]},
|
57
|
+
{:google_pay_card => [:number, :cryptogram, :google_transaction_id, :expiration_month, :expiration_year, :source_card_type, :source_card_last_four, :eci_indicator]},
|
58
|
+
{:industry => [
|
59
|
+
:industry_type,
|
60
|
+
{:data => [
|
61
|
+
: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,
|
62
|
+
:passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
|
63
|
+
: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,
|
64
|
+
{:legs => [
|
65
|
+
:conjunction_ticket, :exchange_ticket, :coupon_number, :service_class, :carrier_code, :fare_basis_code, :flight_number, :departure_date, :departure_airport_code, :departure_time,
|
66
|
+
:arrival_airport_code, :arrival_time, :stopover_permitted, :fare_amount, :fee_amount, :tax_amount, :endorsement_or_restrictions,
|
67
|
+
]},
|
68
|
+
{:additional_charges => [
|
69
|
+
:kind, :amount,
|
70
|
+
]},
|
71
|
+
]},
|
72
|
+
]},
|
73
|
+
{:installments => [:count]},
|
74
|
+
{: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]},
|
66
75
|
{:options => [
|
67
76
|
:hold_in_escrow,
|
68
77
|
:store_in_vault,
|
@@ -70,7 +79,7 @@ describe Braintree::TransactionGateway do
|
|
70
79
|
:submit_for_settlement,
|
71
80
|
:add_billing_address_to_payment_method,
|
72
81
|
:store_shipping_address_in_vault,
|
73
|
-
:venmo_sdk_session, #Deprecated
|
82
|
+
:venmo_sdk_session, # Deprecated
|
74
83
|
:payee_id,
|
75
84
|
:payee_email,
|
76
85
|
:skip_advanced_fraud_checking,
|
@@ -84,31 +93,23 @@ describe Braintree::TransactionGateway do
|
|
84
93
|
{:credit_card => [:account_type, :process_debit_as_credit]},
|
85
94
|
]
|
86
95
|
},
|
87
|
-
{:external_vault => [
|
88
|
-
:status,
|
89
|
-
:previous_network_transaction_id,
|
90
|
-
]},
|
91
|
-
{:custom_fields => :_any_key_},
|
92
|
-
{:descriptor => [:name, :phone, :url]},
|
93
96
|
{:paypal_account => [:email, :token, :paypal_data, :payee_id, :payee_email, :payer_id, :payment_id]},
|
94
|
-
{:
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
{:google_pay_card => [:number, :cryptogram, :google_transaction_id, :expiration_month, :expiration_year, :source_card_type, :source_card_last_four, :eci_indicator]},
|
111
|
-
{:installments => [:count]},
|
97
|
+
{:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
|
98
|
+
{
|
99
|
+
:shipping => Braintree::AddressGateway._shared_signature + [:shipping_method],
|
100
|
+
},
|
101
|
+
{
|
102
|
+
:three_d_secure_pass_thru => [
|
103
|
+
:eci_flag,
|
104
|
+
:cavv,
|
105
|
+
:xid,
|
106
|
+
:three_d_secure_version,
|
107
|
+
:authentication_response,
|
108
|
+
:directory_response,
|
109
|
+
:cavv_algorithm,
|
110
|
+
:ds_transaction_id,
|
111
|
+
]
|
112
|
+
},
|
112
113
|
])
|
113
114
|
end
|
114
115
|
|
@@ -136,6 +137,7 @@ describe Braintree::TransactionGateway do
|
|
136
137
|
:tax_exempt,
|
137
138
|
:discount_amount,
|
138
139
|
:shipping_amount,
|
140
|
+
:shipping_tax_amount,
|
139
141
|
:ships_from_postal_code,
|
140
142
|
: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],
|
141
143
|
])
|
@@ -723,14 +723,35 @@ describe Braintree::WebhookNotification do
|
|
723
723
|
expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::LocalPaymentCompleted)
|
724
724
|
|
725
725
|
local_payment_completed = notification.local_payment_completed
|
726
|
-
expect(local_payment_completed.
|
726
|
+
expect(local_payment_completed.blik_aliases).to be_nil
|
727
727
|
expect(local_payment_completed.payer_id).to eq("ABCPAYER")
|
728
|
+
expect(local_payment_completed.payment_id).to eq("PAY-XYZ123")
|
728
729
|
expect(local_payment_completed.payment_method_nonce).to eq("ee257d98-de40-47e8-96b3-a6954ea7a9a4")
|
729
730
|
expect(local_payment_completed.transaction.id).to eq("my_id")
|
730
731
|
expect(local_payment_completed.transaction.status).to eq(Braintree::Transaction::Status::Authorized)
|
731
732
|
expect(local_payment_completed.transaction.amount).to eq(49.99)
|
732
733
|
expect(local_payment_completed.transaction.order_id).to eq("order4567")
|
733
734
|
end
|
735
|
+
|
736
|
+
it "builds a sample notification for a local_payment webhook when funding source is blik one click" do
|
737
|
+
sample_notification = Braintree::WebhookTesting.sample_notification(
|
738
|
+
Braintree::WebhookNotification::Kind::LocalPaymentCompleted,
|
739
|
+
"blik_one_click_id",
|
740
|
+
)
|
741
|
+
|
742
|
+
notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
|
743
|
+
expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::LocalPaymentCompleted)
|
744
|
+
|
745
|
+
local_payment_completed = notification.local_payment_completed
|
746
|
+
expect(local_payment_completed.blik_aliases).to match_array([{:key => "alias-key-1", :label => "alias-label-1"}])
|
747
|
+
expect(local_payment_completed.payer_id).to eq("ABCPAYER")
|
748
|
+
expect(local_payment_completed.payment_id).to eq("PAY-XYZ123")
|
749
|
+
expect(local_payment_completed.payment_method_nonce).to eq("ee257d98-de40-47e8-96b3-a6954ea7a9a4")
|
750
|
+
expect(local_payment_completed.transaction.id).to eq("blik_one_click_id")
|
751
|
+
expect(local_payment_completed.transaction.status).to eq(Braintree::Transaction::Status::Authorized)
|
752
|
+
expect(local_payment_completed.transaction.amount).to eq(49.99)
|
753
|
+
expect(local_payment_completed.transaction.order_id).to eq("order4567")
|
754
|
+
end
|
734
755
|
end
|
735
756
|
|
736
757
|
context "local_payment_expired" do
|
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: 4.
|
4
|
+
version: 4.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Braintree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/braintree/graphql_client.rb
|
112
112
|
- lib/braintree/http.rb
|
113
113
|
- lib/braintree/local_payment_completed.rb
|
114
|
+
- lib/braintree/local_payment_completed/blik_alias.rb
|
114
115
|
- lib/braintree/local_payment_expired.rb
|
115
116
|
- lib/braintree/local_payment_funded.rb
|
116
117
|
- lib/braintree/local_payment_reversed.rb
|