braintree 2.104.0 → 4.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/braintree.gemspec +7 -4
- data/lib/braintree/account_updater_daily_report.rb +1 -1
- data/lib/braintree/address.rb +2 -23
- data/lib/braintree/apple_pay.rb +1 -1
- data/lib/braintree/apple_pay_card.rb +11 -1
- data/lib/braintree/apple_pay_options.rb +1 -1
- data/lib/braintree/authorization_adjustment.rb +1 -1
- data/lib/braintree/base_module.rb +6 -0
- data/lib/braintree/bin_data.rb +9 -2
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/configuration.rb +12 -12
- 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 -77
- data/lib/braintree/credit_card_gateway.rb +17 -36
- data/lib/braintree/credit_card_verification.rb +18 -5
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +9 -78
- data/lib/braintree/customer_gateway.rb +2 -23
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/disbursement.rb +1 -1
- data/lib/braintree/{transaction/coinbase_details.rb → dispute/paypal_message.rb} +5 -6
- data/lib/braintree/dispute/{history_event.rb → status_history.rb} +3 -1
- data/lib/braintree/dispute.rb +32 -8
- data/lib/braintree/dispute_gateway.rb +4 -9
- data/lib/braintree/dispute_search.rb +6 -3
- data/lib/braintree/document_upload.rb +1 -1
- data/lib/braintree/enriched_customer_data.rb +21 -0
- data/lib/braintree/error_codes.rb +150 -171
- data/lib/braintree/exceptions.rb +5 -3
- data/lib/braintree/exchange_rate.rb +13 -0
- data/lib/braintree/exchange_rate_quote.rb +24 -0
- data/lib/braintree/exchange_rate_quote_gateway.rb +35 -0
- data/lib/braintree/exchange_rate_quote_input.rb +21 -0
- data/lib/braintree/exchange_rate_quote_request.rb +18 -0
- data/lib/braintree/exchange_rate_quote_response.rb +18 -0
- data/lib/braintree/gateway.rb +4 -14
- data/lib/braintree/{android_pay_card.rb → google_pay_card.rb} +11 -3
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +7 -7
- data/lib/braintree/http.rb +4 -3
- data/lib/braintree/local_payment_completed.rb +2 -2
- data/lib/braintree/local_payment_expired.rb +21 -0
- data/lib/braintree/local_payment_funded.rb +22 -0
- 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 +3 -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 -14
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
- data/lib/braintree/payment_method_gateway.rb +15 -17
- data/lib/braintree/payment_method_nonce.rb +7 -4
- 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/payment_method_parser.rb +1 -8
- data/lib/braintree/plan.rb +21 -1
- data/lib/braintree/plan_gateway.rb +100 -0
- 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/liability_shift.rb +22 -0
- data/lib/braintree/risk_data.rb +5 -1
- data/lib/braintree/samsung_pay_card.rb +1 -1
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/subscription.rb +11 -11
- data/lib/braintree/successful_result.rb +3 -2
- data/lib/braintree/test/credit_card.rb +1 -0
- data/lib/braintree/test/nonce.rb +4 -23
- data/lib/braintree/three_d_secure_info.rb +22 -12
- data/lib/braintree/transaction/disbursement_details.rb +1 -0
- data/lib/braintree/transaction/{android_pay_details.rb → google_pay_details.rb} +1 -1
- data/lib/braintree/transaction/installment/adjustment.rb +33 -0
- data/lib/braintree/transaction/installment.rb +28 -0
- data/lib/braintree/transaction/paypal_details.rb +3 -0
- data/lib/braintree/transaction/subscription_details.rb +2 -0
- data/lib/braintree/transaction.rb +65 -120
- data/lib/braintree/transaction_gateway.rb +39 -27
- data/lib/braintree/transaction_line_item.rb +1 -1
- data/lib/braintree/transaction_review.rb +18 -0
- data/lib/braintree/transaction_search.rb +5 -3
- 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 +21 -6
- data/lib/braintree/venmo_account.rb +1 -1
- data/lib/braintree/venmo_profile_data.rb +23 -0
- data/lib/braintree/version.rb +2 -2
- data/lib/braintree/visa_checkout_card.rb +2 -2
- data/lib/braintree/webhook_notification.rb +44 -30
- data/lib/braintree/webhook_notification_gateway.rb +5 -5
- data/lib/braintree/webhook_testing_gateway.rb +104 -43
- data/lib/braintree/xml/generator.rb +5 -4
- data/lib/braintree/xml/parser.rb +22 -35
- data/lib/braintree/xml/rexml.rb +4 -5
- data/lib/braintree.rb +28 -23
- data/spec/integration/braintree/add_on_spec.rb +1 -1
- data/spec/integration/braintree/address_spec.rb +30 -113
- 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 -31
- data/spec/integration/braintree/credit_card_spec.rb +219 -593
- 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 +484 -513
- data/spec/integration/braintree/dispute_search_spec.rb +35 -6
- data/spec/integration/braintree/dispute_spec.rb +6 -7
- data/spec/integration/braintree/error_codes_spec.rb +1 -1
- data/spec/integration/braintree/exchange_rate_quote_spec.rb +97 -0
- data/spec/integration/braintree/graphql_client_spec.rb +0 -2
- data/spec/integration/braintree/http_spec.rb +2 -2
- data/spec/integration/braintree/merchant_account_spec.rb +28 -29
- 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 +29 -35
- data/spec/integration/braintree/payment_method_spec.rb +535 -270
- 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/plan_spec.rb +82 -0
- 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 +144 -149
- 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 +175 -70
- data/spec/integration/braintree/transaction_spec.rb +955 -894
- 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 +16 -7
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +8 -14
- data/spec/unit/braintree/address_spec.rb +1 -9
- data/spec/unit/braintree/apple_pay_card_spec.rb +7 -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 -32
- 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 -22
- data/spec/unit/braintree/disbursement_spec.rb +7 -7
- data/spec/unit/braintree/dispute_search_spec.rb +3 -0
- data/spec/unit/braintree/dispute_spec.rb +75 -21
- data/spec/unit/braintree/enriched_customer_data_spec.rb +32 -0
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +8 -8
- data/spec/unit/braintree/exchange_rate_quote_input_spec.rb +42 -0
- data/spec/unit/braintree/exchange_rate_quote_request_spec.rb +82 -0
- data/spec/unit/braintree/exchange_rate_quote_response_spec.rb +52 -0
- data/spec/unit/braintree/exchange_rate_quote_spec.rb +42 -0
- data/spec/unit/braintree/exchange_rate_spec.rb +23 -0
- data/spec/unit/braintree/http_spec.rb +10 -8
- data/spec/unit/braintree/local_payment_completed_spec.rb +14 -0
- data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
- data/spec/unit/braintree/local_payment_funded_spec.rb +34 -0
- data/spec/unit/braintree/merchant_account_spec.rb +1 -1
- data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +45 -0
- 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_nonce_spec.rb +40 -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/liability_shift.rb +26 -0
- data/spec/unit/braintree/risk_data_spec.rb +38 -8
- 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 +7 -1
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +36 -54
- data/spec/unit/braintree/util_spec.rb +55 -21
- data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
- data/spec/unit/braintree/venmo_profile_data_spec.rb +32 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +166 -57
- data/spec/unit/braintree/xml/parser_spec.rb +21 -16
- data/spec/unit/braintree/xml_spec.rb +31 -31
- metadata +62 -30
- data/lib/braintree/amex_express_checkout_card.rb +0 -40
- data/lib/braintree/coinbase_account.rb +0 -34
- data/lib/braintree/europe_bank_account.rb +0 -36
- data/lib/braintree/europe_bank_account_gateway.rb +0 -17
- data/lib/braintree/ideal_payment.rb +0 -61
- data/lib/braintree/ideal_payment_gateway.rb +0 -19
- data/lib/braintree/masterpass_card.rb +0 -83
- data/lib/braintree/settlement_batch.rb +0 -0
- data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -21
- data/lib/braintree/transaction/ideal_payment_details.rb +0 -19
- data/lib/braintree/transaction/masterpass_card_details.rb +0 -49
- data/lib/braintree/transparent_redirect.rb +0 -40
- data/lib/braintree/transparent_redirect_gateway.rb +0 -105
- data/spec/hacks/tcp_socket.rb +0 -18
- data/spec/integration/braintree/coinbase_spec.rb +0 -34
- data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
- data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
- data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
@@ -18,16 +18,16 @@ describe Braintree::Dispute, "search" do
|
|
18
18
|
|
19
19
|
let(:transaction) do
|
20
20
|
result = Braintree::Transaction.sale(
|
21
|
-
:amount =>
|
21
|
+
:amount => "10.00",
|
22
22
|
:credit_card => {
|
23
|
-
:expiration_date =>
|
23
|
+
:expiration_date => "01/2020",
|
24
24
|
:number => Braintree::Test::CreditCardNumbers::Disputes::Chargeback,
|
25
25
|
},
|
26
26
|
:customer_id => customer.id,
|
27
27
|
:merchant_account_id => "14LaddersLLC_instant",
|
28
28
|
:options => {
|
29
29
|
:submit_for_settlement => true,
|
30
|
-
}
|
30
|
+
},
|
31
31
|
)
|
32
32
|
|
33
33
|
result.transaction
|
@@ -78,11 +78,40 @@ describe Braintree::Dispute, "search" do
|
|
78
78
|
dispute = collection.disputes.first
|
79
79
|
end
|
80
80
|
|
81
|
+
it "correctly returns chargeback protected disputes" do
|
82
|
+
collection = Braintree::Dispute.search do |search|
|
83
|
+
search.case_number.is "CASE-CHARGEBACK-PROTECTED"
|
84
|
+
end
|
85
|
+
|
86
|
+
expect(collection.disputes.count).to eq(1)
|
87
|
+
dispute = collection.disputes.first
|
88
|
+
|
89
|
+
# NEXT_MAJOR_VERSION Remove this assertion when chargeback_protection_level is removed from the SDK
|
90
|
+
expect(dispute.chargeback_protection_level).to eq(Braintree::Dispute::ChargebackProtectionLevel::Effortless)
|
91
|
+
expect(dispute.protection_level).to eq(Braintree::Dispute::ProtectionLevel::EffortlessCBP)
|
92
|
+
expect(dispute.reason).to eq(Braintree::Dispute::Reason::Fraud)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "correctly returns disputes by chargeback protection level flag" do
|
96
|
+
collection = Braintree::Dispute.search do |search|
|
97
|
+
search.chargeback_protection_level.in [
|
98
|
+
Braintree::Dispute::ChargebackProtectionLevel::Effortless
|
99
|
+
]
|
100
|
+
end
|
101
|
+
expect(collection.disputes.count).to eq(1)
|
102
|
+
dispute = collection.disputes.first
|
103
|
+
|
104
|
+
# NEXT_MAJOR_VERSION Remove this assertion when chargeback_protection_level is removed from the SDK
|
105
|
+
expect(dispute.chargeback_protection_level).to eq(Braintree::Dispute::ChargebackProtectionLevel::Effortless)
|
106
|
+
expect(dispute.protection_level).to eq(Braintree::Dispute::ProtectionLevel::EffortlessCBP)
|
107
|
+
expect(dispute.reason).to eq(Braintree::Dispute::Reason::Fraud)
|
108
|
+
end
|
109
|
+
|
81
110
|
it "correctly returns disputes by effective_date range" do
|
82
111
|
effective_date = transaction.disputes.first.status_history.first.effective_date
|
83
112
|
|
84
113
|
collection = Braintree::Dispute.search do |search|
|
85
|
-
search.effective_date.between(effective_date,
|
114
|
+
search.effective_date.between(effective_date, effective_date.next_day)
|
86
115
|
end
|
87
116
|
|
88
117
|
expect(collection.disputes.count).to be >= 1
|
@@ -95,7 +124,7 @@ describe Braintree::Dispute, "search" do
|
|
95
124
|
disbursement_date = transaction.disputes.first.status_history.first.disbursement_date
|
96
125
|
|
97
126
|
collection = Braintree::Dispute.search do |search|
|
98
|
-
search.disbursement_date.between(disbursement_date,
|
127
|
+
search.disbursement_date.between(disbursement_date, disbursement_date.next_day)
|
99
128
|
end
|
100
129
|
|
101
130
|
expect(collection.disputes.count).to be >= 1
|
@@ -109,7 +138,7 @@ describe Braintree::Dispute, "search" do
|
|
109
138
|
search.received_date.between("03/03/2014", "03/05/2014")
|
110
139
|
end
|
111
140
|
|
112
|
-
expect(collection.disputes.count).to
|
141
|
+
expect(collection.disputes.count).to be >= 1
|
113
142
|
dispute = collection.disputes.first
|
114
143
|
|
115
144
|
expect(dispute.received_date).to eq(Date.new(2014, 3, 4))
|
@@ -11,14 +11,14 @@ describe Braintree::Dispute do
|
|
11
11
|
|
12
12
|
let(:transaction) do
|
13
13
|
result = Braintree::Transaction.sale(
|
14
|
-
:amount =>
|
14
|
+
:amount => "10.00",
|
15
15
|
:credit_card => {
|
16
|
-
:expiration_date =>
|
16
|
+
:expiration_date => "01/2020",
|
17
17
|
:number => Braintree::Test::CreditCardNumbers::Disputes::Chargeback
|
18
18
|
},
|
19
19
|
:options => {
|
20
20
|
:submit_for_settlement => true
|
21
|
-
}
|
21
|
+
},
|
22
22
|
)
|
23
23
|
|
24
24
|
result.transaction
|
@@ -50,7 +50,7 @@ describe Braintree::Dispute do
|
|
50
50
|
it "raises a NotFound exception if the dispute cannot be found" do
|
51
51
|
expect do
|
52
52
|
Braintree::Dispute.accept("invalid-id")
|
53
|
-
end.to raise_error(Braintree::NotFoundError,
|
53
|
+
end.to raise_error(Braintree::NotFoundError, "dispute with id invalid-id not found")
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -141,7 +141,7 @@ describe Braintree::Dispute do
|
|
141
141
|
end
|
142
142
|
|
143
143
|
it "creates text evidence for the dispute with optional parameters" do
|
144
|
-
result = Braintree::Dispute.add_text_evidence(dispute.id, {
|
144
|
+
result = Braintree::Dispute.add_text_evidence(dispute.id, {content: "123456789", category: "REFUND_ID", sequence_number: 7})
|
145
145
|
|
146
146
|
result.success?.should == true
|
147
147
|
result.evidence.category.should == "REFUND_ID"
|
@@ -149,7 +149,6 @@ describe Braintree::Dispute do
|
|
149
149
|
result.evidence.created_at.between?(Time.now - 10, Time.now).should == true
|
150
150
|
result.evidence.id.should =~ /^\w{16,}$/
|
151
151
|
result.evidence.sent_to_processor_at.should == nil
|
152
|
-
result.evidence.tag.should == "REFUND_ID"
|
153
152
|
result.evidence.sequence_number.should == 7
|
154
153
|
end
|
155
154
|
end
|
@@ -175,7 +174,7 @@ describe Braintree::Dispute do
|
|
175
174
|
it "raises a NotFound exception if the dispute cannot be found" do
|
176
175
|
expect do
|
177
176
|
Braintree::Dispute.finalize("invalid-id")
|
178
|
-
end.to raise_error(Braintree::NotFoundError,
|
177
|
+
end.to raise_error(Braintree::NotFoundError, "dispute with id invalid-id not found")
|
179
178
|
end
|
180
179
|
end
|
181
180
|
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")
|
3
|
+
|
4
|
+
describe Braintree::ExchangeRateQuoteGateway do
|
5
|
+
let(:gateway) do
|
6
|
+
Braintree::Gateway.new(
|
7
|
+
:environment => :development,
|
8
|
+
:merchant_id => "integration_merchant_id",
|
9
|
+
:public_key => "integration_public_key",
|
10
|
+
:private_key => "integration_private_key",
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "generate" do
|
15
|
+
def quote_input_request
|
16
|
+
gateway.exchange_rate_quote.generate({quotes: [quote_input]})
|
17
|
+
end
|
18
|
+
|
19
|
+
let(:quote_input) do
|
20
|
+
{
|
21
|
+
:baseCurrency => "EUR",
|
22
|
+
:quoteCurrency => "GBP",
|
23
|
+
:baseAmount => "20.00",
|
24
|
+
:markup => "4.00"
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
it "generates exchange rate quotes" do
|
29
|
+
result = quote_input_request
|
30
|
+
quotes = result[:quotes]
|
31
|
+
|
32
|
+
expect(quotes[0][:id]).not_to be_nil
|
33
|
+
expect(quotes[0][:baseAmount]).not_to be_nil
|
34
|
+
expect(quotes[0][:quoteAmount]).not_to be_nil
|
35
|
+
expect(quotes[0][:exchangeRate]).not_to be_nil
|
36
|
+
expect(quotes[0][:expiresAt]).not_to be_nil
|
37
|
+
expect(quotes[0][:refreshesAt]).not_to be_nil
|
38
|
+
|
39
|
+
expect(quotes[1][:id]).not_to be_nil
|
40
|
+
expect(quotes[1][:baseAmount]).not_to be_nil
|
41
|
+
expect(quotes[1][:quoteAmount]).not_to be_nil
|
42
|
+
expect(quotes[1][:exchangeRate]).not_to be_nil
|
43
|
+
expect(quotes[1][:expiresAt]).not_to be_nil
|
44
|
+
expect(quotes[1][:refreshesAt]).not_to be_nil
|
45
|
+
end
|
46
|
+
|
47
|
+
context "when base currency input param is not passed" do
|
48
|
+
let(:quote_input) do
|
49
|
+
{
|
50
|
+
:quoteCurrency => "GBP",
|
51
|
+
:baseAmount => "20.00",
|
52
|
+
:markup => "4.00"
|
53
|
+
}
|
54
|
+
end
|
55
|
+
let(:error_message) { "baseCurrency" }
|
56
|
+
|
57
|
+
it "raises an UnexpectedError" do
|
58
|
+
expect do
|
59
|
+
quote_input_request
|
60
|
+
end.to raise_error(Braintree::UnexpectedError, /#{error_message}/)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "when quote currency input param is not passed" do
|
65
|
+
let(:quote_input) do
|
66
|
+
{
|
67
|
+
:baseCurrency => "GBP",
|
68
|
+
:baseAmount => "20.00",
|
69
|
+
:markup => "4.00"
|
70
|
+
}
|
71
|
+
end
|
72
|
+
let(:error_message) { "quoteCurrency" }
|
73
|
+
|
74
|
+
it "raises an UnexpectedError" do
|
75
|
+
expect do
|
76
|
+
quote_input_request
|
77
|
+
end.to raise_error(Braintree::UnexpectedError, /#{error_message}/)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context "when base and quote currency input params are not passed" do
|
82
|
+
let(:quote_input) do
|
83
|
+
{
|
84
|
+
:baseAmount => "20.00",
|
85
|
+
:markup => "4.00"
|
86
|
+
}
|
87
|
+
end
|
88
|
+
let(:error_message) { "baseCurrency" }
|
89
|
+
|
90
|
+
it "raises an UnexpectedError" do
|
91
|
+
expect do
|
92
|
+
quote_input_request
|
93
|
+
end.to raise_error(Braintree::UnexpectedError, /#{error_message}/)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -28,7 +28,6 @@ describe Braintree::GraphQLClient do
|
|
28
28
|
definition = <<-GRAPHQL
|
29
29
|
mutation CreateClientToken($input: CreateClientTokenInput!) {
|
30
30
|
createClientToken(input: $input) {
|
31
|
-
clientMutationId
|
32
31
|
clientToken
|
33
32
|
}
|
34
33
|
}
|
@@ -36,7 +35,6 @@ mutation CreateClientToken($input: CreateClientTokenInput!) {
|
|
36
35
|
|
37
36
|
variables = {
|
38
37
|
input: {
|
39
|
-
clientMutationId: "abc123",
|
40
38
|
clientToken: {
|
41
39
|
merchantAccountId: "ABC123"
|
42
40
|
}
|
@@ -54,7 +54,7 @@ describe Braintree::Http do
|
|
54
54
|
:customer_id => customer.id,
|
55
55
|
:cardholder_name => "Sam Jones",
|
56
56
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
57
|
-
:expiration_date => "05/2009"
|
57
|
+
:expiration_date => "05/2009",
|
58
58
|
)
|
59
59
|
result.success?.should == true
|
60
60
|
utc_or_gmt = Time.now.utc.strftime("%Z")
|
@@ -156,7 +156,7 @@ describe Braintree::Http do
|
|
156
156
|
# Random CA root file from a different certificate authority
|
157
157
|
config = Braintree::Configuration.instantiate
|
158
158
|
config.stub(:ca_file).and_return(
|
159
|
-
File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "ssl", "geotrust_global.crt"))
|
159
|
+
File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "ssl", "geotrust_global.crt")),
|
160
160
|
)
|
161
161
|
config.stub(:ssl?).and_return(true)
|
162
162
|
config.stub(:port).and_return(SSL_TEST_PORT)
|
@@ -41,7 +41,7 @@ VALID_APPLICATION_PARAMS = {
|
|
41
41
|
:business => {
|
42
42
|
:legal_name => "Joe's Bloggs",
|
43
43
|
:dba_name => "Joe's Junkyard",
|
44
|
-
:tax_id => "
|
44
|
+
:tax_id => "423456789",
|
45
45
|
:address => {
|
46
46
|
:street_address => "456 Fake St",
|
47
47
|
:postal_code => "48104",
|
@@ -65,7 +65,7 @@ describe Braintree::MerchantAccount do
|
|
65
65
|
gateway = Braintree::Gateway.new(
|
66
66
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
67
67
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
68
|
-
:logger => Logger.new("/dev/null")
|
68
|
+
:logger => Logger.new("/dev/null"),
|
69
69
|
)
|
70
70
|
|
71
71
|
code = Braintree::OAuthTestHelper.create_grant(gateway, {
|
@@ -75,12 +75,12 @@ describe Braintree::MerchantAccount do
|
|
75
75
|
|
76
76
|
result = gateway.oauth.create_token_from_code(
|
77
77
|
:code => code,
|
78
|
-
:scope => "read_write"
|
78
|
+
:scope => "read_write",
|
79
79
|
)
|
80
80
|
|
81
81
|
gateway = Braintree::Gateway.new(
|
82
82
|
:access_token => result.credentials.access_token,
|
83
|
-
:logger => Logger.new("/dev/null")
|
83
|
+
:logger => Logger.new("/dev/null"),
|
84
84
|
)
|
85
85
|
|
86
86
|
result = gateway.merchant_account.all
|
@@ -92,18 +92,18 @@ describe Braintree::MerchantAccount do
|
|
92
92
|
gateway = Braintree::Gateway.new(
|
93
93
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
94
94
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
95
|
-
:logger => Logger.new("/dev/null")
|
95
|
+
:logger => Logger.new("/dev/null"),
|
96
96
|
)
|
97
97
|
|
98
98
|
result = gateway.merchant.create(
|
99
99
|
:email => "name@email.com",
|
100
100
|
:country_code_alpha3 => "USA",
|
101
|
-
:payment_methods => ["credit_card", "paypal"]
|
101
|
+
:payment_methods => ["credit_card", "paypal"],
|
102
102
|
)
|
103
103
|
|
104
104
|
gateway = Braintree::Gateway.new(
|
105
105
|
:access_token => result.credentials.access_token,
|
106
|
-
:logger => Logger.new("/dev/null")
|
106
|
+
:logger => Logger.new("/dev/null"),
|
107
107
|
)
|
108
108
|
|
109
109
|
result = gateway.merchant_account.all
|
@@ -118,7 +118,7 @@ describe Braintree::MerchantAccount do
|
|
118
118
|
gateway = Braintree::Gateway.new(
|
119
119
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
120
120
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
121
|
-
:logger => Logger.new("/dev/null")
|
121
|
+
:logger => Logger.new("/dev/null"),
|
122
122
|
)
|
123
123
|
|
124
124
|
code = Braintree::OAuthTestHelper.create_grant(gateway, {
|
@@ -128,12 +128,12 @@ describe Braintree::MerchantAccount do
|
|
128
128
|
|
129
129
|
result = gateway.oauth.create_token_from_code(
|
130
130
|
:code => code,
|
131
|
-
:scope => "read_only"
|
131
|
+
:scope => "read_only",
|
132
132
|
)
|
133
133
|
|
134
134
|
gateway = Braintree::Gateway.new(
|
135
135
|
:access_token => result.credentials.access_token,
|
136
|
-
:logger => Logger.new("/dev/null")
|
136
|
+
:logger => Logger.new("/dev/null"),
|
137
137
|
)
|
138
138
|
|
139
139
|
result = gateway.merchant_account.all
|
@@ -164,8 +164,8 @@ describe Braintree::MerchantAccount do
|
|
164
164
|
sub_merchant_account_id = "sub_merchant_account_id#{random_number}"
|
165
165
|
result = Braintree::MerchantAccount.create(
|
166
166
|
VALID_APPLICATION_PARAMS.merge(
|
167
|
-
:id => sub_merchant_account_id
|
168
|
-
)
|
167
|
+
:id => sub_merchant_account_id,
|
168
|
+
),
|
169
169
|
)
|
170
170
|
|
171
171
|
result.should be_success
|
@@ -182,7 +182,7 @@ describe Braintree::MerchantAccount do
|
|
182
182
|
|
183
183
|
it "requires all fields" do
|
184
184
|
result = Braintree::MerchantAccount.create(
|
185
|
-
:master_merchant_account_id => "sandbox_master_merchant_account"
|
185
|
+
:master_merchant_account_id => "sandbox_master_merchant_account",
|
186
186
|
)
|
187
187
|
result.should_not be_success
|
188
188
|
result.errors.for(:merchant_account).on(:tos_accepted).first.code.should == Braintree::ErrorCodes::MerchantAccount::TosAcceptedIsRequired
|
@@ -233,11 +233,11 @@ describe Braintree::MerchantAccount do
|
|
233
233
|
|
234
234
|
gateway = Braintree::Gateway.new(
|
235
235
|
:access_token => result.credentials.access_token,
|
236
|
-
:logger => Logger.new("/dev/null")
|
236
|
+
:logger => Logger.new("/dev/null"),
|
237
237
|
)
|
238
238
|
|
239
239
|
result = gateway.merchant_account.create_for_currency(
|
240
|
-
:currency => "JPY"
|
240
|
+
:currency => "JPY",
|
241
241
|
)
|
242
242
|
result.should be_success
|
243
243
|
result.merchant_account.currency_iso_code.should == "JPY"
|
@@ -249,16 +249,16 @@ describe Braintree::MerchantAccount do
|
|
249
249
|
|
250
250
|
gateway = Braintree::Gateway.new(
|
251
251
|
:access_token => result.credentials.access_token,
|
252
|
-
:logger => Logger.new("/dev/null")
|
252
|
+
:logger => Logger.new("/dev/null"),
|
253
253
|
)
|
254
254
|
|
255
255
|
result = gateway.merchant_account.create_for_currency(
|
256
|
-
:currency => "USD"
|
256
|
+
:currency => "USD",
|
257
257
|
)
|
258
258
|
result.should be_success
|
259
259
|
|
260
260
|
result = gateway.merchant_account.create_for_currency(
|
261
|
-
:currency => "USD"
|
261
|
+
:currency => "USD",
|
262
262
|
)
|
263
263
|
result.should_not be_success
|
264
264
|
|
@@ -272,11 +272,11 @@ describe Braintree::MerchantAccount do
|
|
272
272
|
|
273
273
|
gateway = Braintree::Gateway.new(
|
274
274
|
:access_token => result.credentials.access_token,
|
275
|
-
:logger => Logger.new("/dev/null")
|
275
|
+
:logger => Logger.new("/dev/null"),
|
276
276
|
)
|
277
277
|
|
278
278
|
result = gateway.merchant_account.create_for_currency(
|
279
|
-
:currency => nil
|
279
|
+
:currency => nil,
|
280
280
|
)
|
281
281
|
result.should_not be_success
|
282
282
|
|
@@ -296,11 +296,11 @@ describe Braintree::MerchantAccount do
|
|
296
296
|
|
297
297
|
gateway = Braintree::Gateway.new(
|
298
298
|
:access_token => result.credentials.access_token,
|
299
|
-
:logger => Logger.new("/dev/null")
|
299
|
+
:logger => Logger.new("/dev/null"),
|
300
300
|
)
|
301
301
|
|
302
302
|
result = gateway.merchant_account.create_for_currency(
|
303
|
-
:currency => "FAKE_CURRENCY"
|
303
|
+
:currency => "FAKE_CURRENCY",
|
304
304
|
)
|
305
305
|
result.should_not be_success
|
306
306
|
|
@@ -314,13 +314,13 @@ describe Braintree::MerchantAccount do
|
|
314
314
|
|
315
315
|
gateway = Braintree::Gateway.new(
|
316
316
|
:access_token => result.credentials.access_token,
|
317
|
-
:logger => Logger.new("/dev/null")
|
317
|
+
:logger => Logger.new("/dev/null"),
|
318
318
|
)
|
319
319
|
|
320
320
|
merchant = result.merchant
|
321
321
|
result = gateway.merchant_account.create_for_currency(
|
322
322
|
:currency => "USD",
|
323
|
-
:id => merchant.merchant_accounts.first.id
|
323
|
+
:id => merchant.merchant_accounts.first.id,
|
324
324
|
)
|
325
325
|
result.should_not be_success
|
326
326
|
|
@@ -338,7 +338,6 @@ describe Braintree::MerchantAccount do
|
|
338
338
|
id = result.merchant_account.id
|
339
339
|
merchant_account = Braintree::MerchantAccount.find(id)
|
340
340
|
|
341
|
-
merchant_account.status.should == Braintree::MerchantAccount::Status::Active
|
342
341
|
merchant_account.individual_details.first_name.should == VALID_APPLICATION_PARAMS[:individual][:first_name]
|
343
342
|
merchant_account.individual_details.last_name.should == VALID_APPLICATION_PARAMS[:individual][:last_name]
|
344
343
|
end
|
@@ -352,7 +351,7 @@ describe Braintree::MerchantAccount do
|
|
352
351
|
it "raises a NotFoundError exception if merchant account cannot be found" do
|
353
352
|
expect do
|
354
353
|
Braintree::MerchantAccount.find("non-existant")
|
355
|
-
end.to raise_error(Braintree::NotFoundError,
|
354
|
+
end.to raise_error(Braintree::NotFoundError, "Merchant account with id non-existant not found")
|
356
355
|
end
|
357
356
|
end
|
358
357
|
|
@@ -372,7 +371,7 @@ describe Braintree::MerchantAccount do
|
|
372
371
|
params[:individual][:address][:postal_code] = "60622"
|
373
372
|
params[:business][:dba_name] = "James's Bloggs"
|
374
373
|
params[:business][:legal_name] = "James's Bloggs Inc"
|
375
|
-
params[:business][:tax_id] = "
|
374
|
+
params[:business][:tax_id] = "423456789"
|
376
375
|
params[:business][:address][:street_address] = "999 Fake St"
|
377
376
|
params[:business][:address][:locality] = "Miami"
|
378
377
|
params[:business][:address][:region] = "FL"
|
@@ -398,7 +397,7 @@ describe Braintree::MerchantAccount do
|
|
398
397
|
result.merchant_account.individual_details.address_details.postal_code.should == "60622"
|
399
398
|
result.merchant_account.business_details.dba_name.should == "James's Bloggs"
|
400
399
|
result.merchant_account.business_details.legal_name.should == "James's Bloggs Inc"
|
401
|
-
result.merchant_account.business_details.tax_id.should == "
|
400
|
+
result.merchant_account.business_details.tax_id.should == "423456789"
|
402
401
|
result.merchant_account.business_details.address_details.street_address.should == "999 Fake St"
|
403
402
|
result.merchant_account.business_details.address_details.locality.should == "Miami"
|
404
403
|
result.merchant_account.business_details.address_details.region.should == "FL"
|
@@ -412,7 +411,7 @@ describe Braintree::MerchantAccount do
|
|
412
411
|
end
|
413
412
|
|
414
413
|
it "does not require all fields" do
|
415
|
-
result = Braintree::MerchantAccount.update("sandbox_sub_merchant_account", {
|
414
|
+
result = Braintree::MerchantAccount.update("sandbox_sub_merchant_account", {:individual => {:first_name => "Jose"}})
|
416
415
|
result.should be_success
|
417
416
|
end
|
418
417
|
|
@@ -6,13 +6,13 @@ describe Braintree::MerchantGateway do
|
|
6
6
|
gateway = Braintree::Gateway.new(
|
7
7
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
8
8
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
9
|
-
:logger => Logger.new("/dev/null")
|
9
|
+
:logger => Logger.new("/dev/null"),
|
10
10
|
)
|
11
11
|
|
12
12
|
result = gateway.merchant.create(
|
13
13
|
:email => "name@email.com",
|
14
14
|
:country_code_alpha3 => "USA",
|
15
|
-
:payment_methods => ["credit_card", "paypal"]
|
15
|
+
:payment_methods => ["credit_card", "paypal"],
|
16
16
|
)
|
17
17
|
|
18
18
|
result.should be_success
|
@@ -37,13 +37,13 @@ describe Braintree::MerchantGateway do
|
|
37
37
|
gateway = Braintree::Gateway.new(
|
38
38
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
39
39
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
40
|
-
:logger => Logger.new("/dev/null")
|
40
|
+
:logger => Logger.new("/dev/null"),
|
41
41
|
)
|
42
42
|
|
43
43
|
result = gateway.merchant.create(
|
44
44
|
:email => "name@email.com",
|
45
45
|
:country_code_alpha3 => "USA",
|
46
|
-
:payment_methods => ["fake_money"]
|
46
|
+
:payment_methods => ["fake_money"],
|
47
47
|
)
|
48
48
|
|
49
49
|
result.should_not be_success
|
@@ -71,7 +71,7 @@ describe Braintree::MerchantGateway do
|
|
71
71
|
result = gateway.merchant.create(
|
72
72
|
:email => "name@email.com",
|
73
73
|
:country_code_alpha3 => "USA",
|
74
|
-
:payment_methods => ["credit_card", "paypal"]
|
74
|
+
:payment_methods => ["credit_card", "paypal"],
|
75
75
|
)
|
76
76
|
|
77
77
|
result.should be_success
|
@@ -83,7 +83,7 @@ describe Braintree::MerchantGateway do
|
|
83
83
|
@gateway = Braintree::Gateway.new(
|
84
84
|
:client_id => "client_id$development$signup_client_id",
|
85
85
|
:client_secret => "client_secret$development$signup_client_secret",
|
86
|
-
:logger => Logger.new("/dev/null")
|
86
|
+
:logger => Logger.new("/dev/null"),
|
87
87
|
)
|
88
88
|
end
|
89
89
|
|
@@ -92,7 +92,7 @@ describe Braintree::MerchantGateway do
|
|
92
92
|
:email => "name@email.com",
|
93
93
|
:country_code_alpha3 => "USA",
|
94
94
|
:payment_methods => ["credit_card", "paypal"],
|
95
|
-
:currencies => ["GBP", "USD"]
|
95
|
+
:currencies => ["GBP", "USD"],
|
96
96
|
)
|
97
97
|
|
98
98
|
merchant = result.merchant
|
@@ -127,7 +127,7 @@ describe Braintree::MerchantGateway do
|
|
127
127
|
:email => "name@email.com",
|
128
128
|
:country_code_alpha3 => "GBR",
|
129
129
|
:payment_methods => ["credit_card", "paypal"],
|
130
|
-
:currencies => ["GBP", "USD"]
|
130
|
+
:currencies => ["GBP", "USD"],
|
131
131
|
)
|
132
132
|
|
133
133
|
merchant = result.merchant
|
@@ -167,7 +167,7 @@ describe Braintree::MerchantGateway do
|
|
167
167
|
:paypal_account => {
|
168
168
|
:client_id => "paypal_client_id",
|
169
169
|
:client_secret => "paypal_client_secret",
|
170
|
-
}
|
170
|
+
},
|
171
171
|
)
|
172
172
|
|
173
173
|
result.should be_success
|
@@ -207,7 +207,7 @@ describe Braintree::MerchantGateway do
|
|
207
207
|
:paypal_account => {
|
208
208
|
:client_id => "paypal_client_id",
|
209
209
|
:client_secret => "paypal_client_secret",
|
210
|
-
}
|
210
|
+
},
|
211
211
|
)
|
212
212
|
|
213
213
|
result.should be_success
|
@@ -243,7 +243,7 @@ describe Braintree::MerchantGateway do
|
|
243
243
|
:paypal_account => {
|
244
244
|
:client_id => "paypal_client_id",
|
245
245
|
:client_secret => "paypal_client_secret",
|
246
|
-
}
|
246
|
+
},
|
247
247
|
)
|
248
248
|
|
249
249
|
result.should be_success
|
@@ -280,7 +280,7 @@ describe Braintree::MerchantGateway do
|
|
280
280
|
:paypal_account => {
|
281
281
|
:client_id => "paypal_client_id",
|
282
282
|
:client_secret => "paypal_client_secret",
|
283
|
-
}
|
283
|
+
},
|
284
284
|
)
|
285
285
|
|
286
286
|
result.should_not be_success
|
@@ -305,7 +305,7 @@ describe Braintree::MerchantGateway do
|
|
305
305
|
it "succeeds" do
|
306
306
|
result = Braintree::Merchant.provision_raw_apple_pay
|
307
307
|
result.should be_success
|
308
|
-
result.supported_networks.should == ["visa", "mastercard", "amex", "discover", "maestro"]
|
308
|
+
result.supported_networks.should == ["visa", "mastercard", "amex", "discover", "maestro", "elo"]
|
309
309
|
end
|
310
310
|
|
311
311
|
it "is repeatable" do
|
@@ -313,7 +313,7 @@ describe Braintree::MerchantGateway do
|
|
313
313
|
result.should be_success
|
314
314
|
result = Braintree::Merchant.provision_raw_apple_pay
|
315
315
|
result.should be_success
|
316
|
-
result.supported_networks.should == ["visa", "mastercard", "amex", "discover", "maestro"]
|
316
|
+
result.supported_networks.should == ["visa", "mastercard", "amex", "discover", "maestro", "elo"]
|
317
317
|
end
|
318
318
|
end
|
319
319
|
|