braintree 4.13.0 → 4.15.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/credit_card.rb +13 -0
- data/lib/braintree/credit_card_gateway.rb +15 -3
- data/lib/braintree/payment_method_gateway.rb +15 -3
- data/lib/braintree/test/nonce.rb +1 -0
- data/lib/braintree/test/venmo_sdk.rb +2 -0
- data/lib/braintree/transaction/credit_card_details.rb +3 -0
- data/lib/braintree/transaction/local_payment_details.rb +2 -0
- data/lib/braintree/transaction/payment_receipt/card_present_data.rb +36 -0
- data/lib/braintree/transaction/payment_receipt/merchant_address.rb +19 -0
- data/lib/braintree/transaction/payment_receipt.rb +31 -0
- data/lib/braintree/transaction/us_bank_account_details.rb +1 -0
- data/lib/braintree/transaction.rb +7 -4
- data/lib/braintree/transaction_gateway.rb +15 -3
- data/lib/braintree/transaction_search.rb +6 -5
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/webhook_notification.rb +1 -0
- data/lib/braintree/webhook_testing_gateway.rb +17 -0
- data/lib/braintree.rb +3 -0
- data/spec/integration/braintree/add_on_spec.rb +9 -9
- data/spec/integration/braintree/address_spec.rb +69 -69
- data/spec/integration/braintree/advanced_search_spec.rb +45 -45
- data/spec/integration/braintree/apple_pay_spec.rb +8 -8
- data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
- data/spec/integration/braintree/credit_card_spec.rb +223 -223
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
- data/spec/integration/braintree/credit_card_verification_spec.rb +52 -52
- data/spec/integration/braintree/customer_search_spec.rb +20 -20
- data/spec/integration/braintree/customer_spec.rb +313 -313
- data/spec/integration/braintree/disbursement_spec.rb +2 -2
- data/spec/integration/braintree/discount_spec.rb +9 -9
- data/spec/integration/braintree/dispute_spec.rb +87 -87
- data/spec/integration/braintree/document_upload_spec.rb +17 -17
- data/spec/integration/braintree/error_codes_spec.rb +2 -2
- data/spec/integration/braintree/http_spec.rb +28 -28
- data/spec/integration/braintree/merchant_account_spec.rb +127 -127
- data/spec/integration/braintree/merchant_spec.rb +103 -103
- data/spec/integration/braintree/oauth_spec.rb +61 -61
- data/spec/integration/braintree/payment_method_nonce_spec.rb +73 -73
- data/spec/integration/braintree/payment_method_spec.rb +389 -389
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +78 -78
- data/spec/integration/braintree/paypal_account_spec.rb +38 -38
- data/spec/integration/braintree/plan_spec.rb +15 -15
- data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
- data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
- data/spec/integration/braintree/subscription_spec.rb +364 -364
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +19 -19
- data/spec/integration/braintree/transaction_line_item_spec.rb +6 -6
- data/spec/integration/braintree/transaction_search_spec.rb +198 -165
- data/spec/integration/braintree/transaction_spec.rb +1319 -1151
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
- data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
- data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
- data/spec/spec_helper.rb +9 -8
- data/spec/unit/braintree/address_spec.rb +8 -8
- data/spec/unit/braintree/base_module_spec.rb +4 -4
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +57 -57
- data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
- data/spec/unit/braintree/credit_card_spec.rb +31 -29
- data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +28 -28
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
- data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
- data/spec/unit/braintree/customer_spec.rb +41 -40
- data/spec/unit/braintree/digest_spec.rb +5 -5
- data/spec/unit/braintree/disbursement_spec.rb +11 -11
- data/spec/unit/braintree/dispute_search_spec.rb +2 -2
- data/spec/unit/braintree/dispute_spec.rb +56 -56
- data/spec/unit/braintree/document_upload_spec.rb +8 -8
- data/spec/unit/braintree/enriched_customer_data_spec.rb +2 -2
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +9 -9
- data/spec/unit/braintree/http_spec.rb +8 -8
- data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
- data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
- data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
- data/spec/unit/braintree/merchant_account_spec.rb +4 -4
- data/spec/unit/braintree/modification_spec.rb +1 -1
- data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
- data/spec/unit/braintree/payment_method_spec.rb +19 -19
- data/spec/unit/braintree/paypal_account_spec.rb +4 -4
- data/spec/unit/braintree/resource_collection_spec.rb +7 -7
- data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
- data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
- data/spec/unit/braintree/signature_service_spec.rb +2 -2
- data/spec/unit/braintree/subscription_search_spec.rb +17 -17
- data/spec/unit/braintree/subscription_spec.rb +8 -8
- data/spec/unit/braintree/successful_result_spec.rb +5 -5
- data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
- 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/local_payment_details_spec.rb +30 -0
- data/spec/unit/braintree/transaction/payment_receipt_spec.rb +73 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +9 -6
- data/spec/unit/braintree/transaction_search_spec.rb +2 -2
- data/spec/unit/braintree/transaction_spec.rb +101 -93
- data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
- data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
- data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
- data/spec/unit/braintree/us_bank_account_verification_spec.rb +7 -7
- data/spec/unit/braintree/util_spec.rb +27 -27
- data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
- data/spec/unit/braintree/validation_error_spec.rb +4 -4
- data/spec/unit/braintree/venmo_profile_data_spec.rb +5 -5
- data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
- data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
- data/spec/unit/braintree/xml/parser_spec.rb +8 -8
- data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
- data/spec/unit/braintree/xml_spec.rb +17 -17
- data/spec/unit/braintree_spec.rb +2 -2
- metadata +7 -2
@@ -10,7 +10,7 @@ describe Braintree::Test::TransactionAmounts do
|
|
10
10
|
:expiration_date => "12/2012"
|
11
11
|
},
|
12
12
|
)
|
13
|
-
transaction.status.
|
13
|
+
expect(transaction.status).to eq(Braintree::Transaction::Status::Authorized)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -23,7 +23,7 @@ describe Braintree::Test::TransactionAmounts do
|
|
23
23
|
:expiration_date => "12/2012"
|
24
24
|
},
|
25
25
|
)
|
26
|
-
result.transaction.status.
|
26
|
+
expect(result.transaction.status).to eq(Braintree::Transaction::Status::ProcessorDeclined)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -11,12 +11,12 @@ describe Braintree::TestTransaction do
|
|
11
11
|
:submit_for_settlement => true
|
12
12
|
},
|
13
13
|
)
|
14
|
-
sale_result.success
|
15
|
-
sale_result.transaction.status.
|
14
|
+
expect(sale_result.success?).to eq(true)
|
15
|
+
expect(sale_result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
|
16
16
|
|
17
17
|
settle_result = Braintree::TestTransaction.settle(sale_result.transaction.id)
|
18
|
-
settle_result.transaction.status.
|
19
|
-
settle_result.success
|
18
|
+
expect(settle_result.transaction.status).to eq(Braintree::Transaction::Status::Settled)
|
19
|
+
expect(settle_result.success?).to eq(true)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "changes transaction status to settlement_confirmed" do
|
@@ -27,12 +27,12 @@ describe Braintree::TestTransaction do
|
|
27
27
|
:submit_for_settlement => true
|
28
28
|
},
|
29
29
|
)
|
30
|
-
sale_result.success
|
31
|
-
sale_result.transaction.status.
|
30
|
+
expect(sale_result.success?).to eq(true)
|
31
|
+
expect(sale_result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
|
32
32
|
|
33
33
|
settle_result = Braintree::TestTransaction.settlement_confirm(sale_result.transaction.id)
|
34
|
-
settle_result.transaction.status.
|
35
|
-
settle_result.success
|
34
|
+
expect(settle_result.transaction.status).to eq(Braintree::Transaction::Status::SettlementConfirmed)
|
35
|
+
expect(settle_result.success?).to eq(true)
|
36
36
|
end
|
37
37
|
|
38
38
|
it "changes transaction status to settlement_declined" do
|
@@ -43,12 +43,12 @@ describe Braintree::TestTransaction do
|
|
43
43
|
:submit_for_settlement => true
|
44
44
|
},
|
45
45
|
)
|
46
|
-
sale_result.success
|
47
|
-
sale_result.transaction.status.
|
46
|
+
expect(sale_result.success?).to eq(true)
|
47
|
+
expect(sale_result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
|
48
48
|
|
49
49
|
settle_result = Braintree::TestTransaction.settlement_decline(sale_result.transaction.id)
|
50
|
-
settle_result.transaction.status.
|
51
|
-
settle_result.success
|
50
|
+
expect(settle_result.transaction.status).to eq(Braintree::Transaction::Status::SettlementDeclined)
|
51
|
+
expect(settle_result.success?).to eq(true)
|
52
52
|
end
|
53
53
|
|
54
54
|
it "changes transaction status to settlement_pending" do
|
@@ -59,12 +59,12 @@ describe Braintree::TestTransaction do
|
|
59
59
|
:submit_for_settlement => true
|
60
60
|
},
|
61
61
|
)
|
62
|
-
sale_result.success
|
63
|
-
sale_result.transaction.status.
|
62
|
+
expect(sale_result.success?).to eq(true)
|
63
|
+
expect(sale_result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
|
64
64
|
|
65
65
|
settle_result = Braintree::TestTransaction.settlement_pending(sale_result.transaction.id)
|
66
|
-
settle_result.transaction.status.
|
67
|
-
settle_result.success
|
66
|
+
expect(settle_result.transaction.status).to eq(Braintree::Transaction::Status::SettlementPending)
|
67
|
+
expect(settle_result.success?).to eq(true)
|
68
68
|
end
|
69
69
|
|
70
70
|
it "returns a validation error when invalid transition is specified" do
|
@@ -72,11 +72,11 @@ describe Braintree::TestTransaction do
|
|
72
72
|
:amount => "100",
|
73
73
|
:payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutVisa,
|
74
74
|
)
|
75
|
-
sale_result.success
|
75
|
+
expect(sale_result.success?).to eq(true)
|
76
76
|
|
77
77
|
settle_result = Braintree::TestTransaction.settlement_decline(sale_result.transaction.id)
|
78
|
-
settle_result.success
|
79
|
-
settle_result.errors.for(:transaction).on(:base).first.code.
|
78
|
+
expect(settle_result.success?).to be(false)
|
79
|
+
expect(settle_result.errors.for(:transaction).on(:base).first.code).to eq(Braintree::ErrorCodes::Transaction::CannotSimulateTransactionSettlement)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -21,17 +21,17 @@ describe Braintree::TransactionLineItem do
|
|
21
21
|
},
|
22
22
|
],
|
23
23
|
)
|
24
|
-
result.success
|
24
|
+
expect(result.success?).to eq(true)
|
25
25
|
transaction = result.transaction
|
26
26
|
|
27
27
|
line_items = Braintree::TransactionLineItem.find_all(transaction.id)
|
28
28
|
|
29
29
|
line_item = line_items[0]
|
30
|
-
line_item.quantity.
|
31
|
-
line_item.name.
|
32
|
-
line_item.kind.
|
33
|
-
line_item.unit_amount.
|
34
|
-
line_item.total_amount.
|
30
|
+
expect(line_item.quantity).to eq(BigDecimal("1.0232"))
|
31
|
+
expect(line_item.name).to eq("Name #1")
|
32
|
+
expect(line_item.kind).to eq("debit")
|
33
|
+
expect(line_item.unit_amount).to eq(BigDecimal("45.1232"))
|
34
|
+
expect(line_item.total_amount).to eq(BigDecimal("45.15"))
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|