braintree 3.2.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/braintree.gemspec +3 -3
- data/lib/braintree.rb +6 -1
- data/lib/braintree/account_updater_daily_report.rb +1 -1
- data/lib/braintree/address.rb +2 -1
- data/lib/braintree/apple_pay.rb +1 -1
- data/lib/braintree/apple_pay_card.rb +1 -1
- data/lib/braintree/apple_pay_options.rb +1 -1
- data/lib/braintree/authorization_adjustment.rb +1 -1
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/configuration.rb +11 -11
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
- data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
- data/lib/braintree/credit_card.rb +2 -2
- data/lib/braintree/credit_card_gateway.rb +14 -4
- data/lib/braintree/credit_card_verification.rb +5 -5
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +6 -4
- data/lib/braintree/customer_gateway.rb +2 -0
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/disbursement.rb +1 -1
- data/lib/braintree/dispute.rb +15 -1
- data/lib/braintree/dispute/paypal_message.rb +15 -0
- data/lib/braintree/dispute_gateway.rb +2 -2
- data/lib/braintree/dispute_search.rb +3 -2
- data/lib/braintree/document_upload.rb +1 -1
- data/lib/braintree/error_codes.rb +10 -6
- data/lib/braintree/google_pay_card.rb +1 -1
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +7 -7
- data/lib/braintree/http.rb +3 -3
- data/lib/braintree/local_payment_completed.rb +1 -1
- data/lib/braintree/local_payment_reversed.rb +19 -0
- data/lib/braintree/merchant.rb +1 -1
- data/lib/braintree/merchant_account.rb +1 -1
- data/lib/braintree/merchant_account_gateway.rb +1 -1
- data/lib/braintree/merchant_gateway.rb +1 -1
- data/lib/braintree/modification.rb +1 -1
- data/lib/braintree/oauth_credentials.rb +1 -1
- data/lib/braintree/oauth_gateway.rb +5 -5
- data/lib/braintree/payment_instrument_type.rb +10 -10
- data/lib/braintree/payment_method_gateway.rb +10 -7
- 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/plan.rb +1 -1
- data/lib/braintree/processor_response_types.rb +3 -3
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data.rb +3 -1
- data/lib/braintree/samsung_pay_card.rb +1 -1
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/subscription.rb +6 -6
- data/lib/braintree/three_d_secure_info.rb +22 -12
- data/lib/braintree/transaction.rb +32 -24
- data/lib/braintree/transaction_gateway.rb +24 -5
- data/lib/braintree/transaction_line_item.rb +1 -1
- data/lib/braintree/transaction_search.rb +3 -1
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +3 -3
- data/lib/braintree/us_bank_account_verification.rb +1 -1
- data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
- data/lib/braintree/util.rb +4 -4
- data/lib/braintree/venmo_account.rb +1 -1
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +2 -2
- data/lib/braintree/webhook_notification.rb +30 -20
- data/lib/braintree/webhook_notification_gateway.rb +5 -5
- data/lib/braintree/webhook_testing_gateway.rb +30 -0
- data/lib/braintree/xml/generator.rb +5 -4
- data/lib/braintree/xml/libxml.rb +0 -1
- data/lib/braintree/xml/parser.rb +22 -12
- data/lib/braintree/xml/rexml.rb +70 -0
- data/spec/integration/braintree/add_on_spec.rb +1 -1
- data/spec/integration/braintree/address_spec.rb +28 -24
- data/spec/integration/braintree/advanced_search_spec.rb +45 -45
- data/spec/integration/braintree/apple_pay_spec.rb +3 -3
- data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
- data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
- data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
- data/spec/integration/braintree/credit_card_spec.rb +213 -122
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
- data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
- data/spec/integration/braintree/customer_search_spec.rb +8 -8
- data/spec/integration/braintree/customer_spec.rb +282 -165
- data/spec/integration/braintree/dispute_search_spec.rb +28 -3
- data/spec/integration/braintree/dispute_spec.rb +6 -6
- data/spec/integration/braintree/error_codes_spec.rb +1 -1
- data/spec/integration/braintree/http_spec.rb +2 -2
- data/spec/integration/braintree/merchant_account_spec.rb +25 -26
- data/spec/integration/braintree/merchant_spec.rb +14 -14
- data/spec/integration/braintree/oauth_spec.rb +11 -11
- data/spec/integration/braintree/payment_method_nonce_spec.rb +28 -35
- data/spec/integration/braintree/payment_method_spec.rb +269 -165
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +9 -9
- data/spec/integration/braintree/paypal_account_spec.rb +28 -28
- data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
- data/spec/integration/braintree/subscription_spec.rb +133 -133
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +10 -10
- data/spec/integration/braintree/transaction_search_spec.rb +93 -67
- data/spec/integration/braintree/transaction_spec.rb +574 -360
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +20 -20
- data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
- data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
- data/spec/integration/spec_helper.rb +9 -3
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +6 -3
- data/spec/unit/braintree/address_spec.rb +1 -1
- data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +42 -42
- data/spec/unit/braintree/credit_card_spec.rb +13 -13
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
- data/spec/unit/braintree/customer_spec.rb +20 -10
- data/spec/unit/braintree/disbursement_spec.rb +7 -7
- data/spec/unit/braintree/dispute_search_spec.rb +1 -0
- data/spec/unit/braintree/dispute_spec.rb +34 -9
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +8 -8
- data/spec/unit/braintree/http_spec.rb +5 -5
- data/spec/unit/braintree/merchant_account_spec.rb +1 -1
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
- data/spec/unit/braintree/payment_method_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 +9 -9
- data/spec/unit/braintree/risk_data_spec.rb +9 -5
- data/spec/unit/braintree/subscription_search_spec.rb +1 -1
- data/spec/unit/braintree/successful_result_spec.rb +1 -1
- data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
- data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +25 -17
- data/spec/unit/braintree/util_spec.rb +18 -18
- data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
- data/spec/unit/braintree/webhook_notification_spec.rb +88 -56
- data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
- data/spec/unit/braintree/xml_spec.rb +31 -31
- metadata +16 -8
- data/lib/braintree/settlement_batch.rb +0 -0
@@ -108,7 +108,7 @@ describe Braintree::CreditCardVerification, "search" do
|
|
108
108
|
search.id.is verification.id
|
109
109
|
search.created_at.between(
|
110
110
|
created_at - 60,
|
111
|
-
created_at + 60
|
111
|
+
created_at + 60,
|
112
112
|
)
|
113
113
|
end
|
114
114
|
|
@@ -135,7 +135,7 @@ describe Braintree::CreditCardVerification, "search" do
|
|
135
135
|
search.id.is verification.id
|
136
136
|
search.created_at.between(
|
137
137
|
created_at - 300,
|
138
|
-
created_at - 100
|
138
|
+
created_at - 100,
|
139
139
|
)
|
140
140
|
end
|
141
141
|
|
@@ -242,7 +242,7 @@ describe Braintree::CreditCardVerification, "search" do
|
|
242
242
|
:cardholder_name => cardholder_name,
|
243
243
|
:expiration_date => "05/2012",
|
244
244
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Prepaid,
|
245
|
-
:cvv =>
|
245
|
+
:cvv => "200",
|
246
246
|
:options => {
|
247
247
|
:verify_card => true
|
248
248
|
}
|
@@ -36,7 +36,7 @@ describe Braintree::Transaction, "search" do
|
|
36
36
|
:postal_code => "60622",
|
37
37
|
:country_name => "United States of America"
|
38
38
|
}
|
39
|
-
}
|
39
|
+
},
|
40
40
|
)
|
41
41
|
|
42
42
|
customer = Braintree::Customer.find(customer.id)
|
@@ -96,7 +96,7 @@ describe Braintree::Transaction, "search" do
|
|
96
96
|
:credit_card => {
|
97
97
|
:number => Braintree::Test::CreditCardNumbers::Maestro,
|
98
98
|
:expiration_date => "05/2012"
|
99
|
-
}
|
99
|
+
},
|
100
100
|
).customer
|
101
101
|
|
102
102
|
joe = Braintree::Customer.create(
|
@@ -104,7 +104,7 @@ describe Braintree::Transaction, "search" do
|
|
104
104
|
:credit_card => {
|
105
105
|
:number => Braintree::Test::CreditCardNumbers::Maestro,
|
106
106
|
:expiration_date => "05/2012"
|
107
|
-
}
|
107
|
+
},
|
108
108
|
).customer
|
109
109
|
|
110
110
|
collection = Braintree::Customer.search do |search|
|
@@ -118,7 +118,7 @@ describe Braintree::Transaction, "search" do
|
|
118
118
|
it "can search by created_at" do
|
119
119
|
company = "Company #{rand(1_000_000)}"
|
120
120
|
customer = Braintree::Customer.create!(
|
121
|
-
:company => company
|
121
|
+
:company => company,
|
122
122
|
)
|
123
123
|
|
124
124
|
created_at = customer.created_at
|
@@ -128,7 +128,7 @@ describe Braintree::Transaction, "search" do
|
|
128
128
|
search.company.is company
|
129
129
|
search.created_at.between(
|
130
130
|
created_at - 60,
|
131
|
-
created_at + 60
|
131
|
+
created_at + 60,
|
132
132
|
)
|
133
133
|
end
|
134
134
|
|
@@ -155,7 +155,7 @@ describe Braintree::Transaction, "search" do
|
|
155
155
|
search.company.is customer.company
|
156
156
|
search.created_at.between(
|
157
157
|
created_at - 300,
|
158
|
-
created_at - 100
|
158
|
+
created_at - 100,
|
159
159
|
)
|
160
160
|
end
|
161
161
|
|
@@ -175,13 +175,13 @@ describe Braintree::Transaction, "search" do
|
|
175
175
|
paypal_token = rand(36**3).to_s(36)
|
176
176
|
nonce = nonce_for_paypal_account(
|
177
177
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
178
|
-
:token => paypal_token
|
178
|
+
:token => paypal_token,
|
179
179
|
)
|
180
180
|
|
181
181
|
customer_id = "UNIQUE_CUSTOMER_ID_" + rand(36**3).to_s(36)
|
182
182
|
customer = Braintree::Customer.create!(
|
183
183
|
:payment_method_nonce => nonce,
|
184
|
-
:id => customer_id
|
184
|
+
:id => customer_id,
|
185
185
|
)
|
186
186
|
|
187
187
|
collection = Braintree::Customer.search do |search|
|
@@ -8,7 +8,7 @@ describe Braintree::Customer do
|
|
8
8
|
customers = Braintree::Customer.all
|
9
9
|
customers.maximum_size.should > 100
|
10
10
|
|
11
|
-
customer_ids = customers.map {|c| c.id }.uniq.compact
|
11
|
+
customer_ids = customers.map { |c| c.id }.uniq.compact
|
12
12
|
customer_ids.size.should == customers.maximum_size
|
13
13
|
end
|
14
14
|
end
|
@@ -17,7 +17,7 @@ describe Braintree::Customer do
|
|
17
17
|
it "deletes the customer with the given id" do
|
18
18
|
create_result = Braintree::Customer.create(
|
19
19
|
:first_name => "Joe",
|
20
|
-
:last_name => "Cool"
|
20
|
+
:last_name => "Cool",
|
21
21
|
)
|
22
22
|
create_result.success?.should == true
|
23
23
|
customer = create_result.customer
|
@@ -39,7 +39,8 @@ describe Braintree::Customer do
|
|
39
39
|
:email => "bill@microsoft.com",
|
40
40
|
:phone => "312.555.1234",
|
41
41
|
:fax => "614.555.5678",
|
42
|
-
:website => "www.microsoft.com"
|
42
|
+
:website => "www.microsoft.com",
|
43
|
+
:tax_identifiers => [{:country_code => "US", :identifier => "987654321"}],
|
43
44
|
)
|
44
45
|
result.success?.should == true
|
45
46
|
result.customer.id.should =~ /^\d{6,}$/
|
@@ -58,7 +59,7 @@ describe Braintree::Customer do
|
|
58
59
|
oauth_gateway = Braintree::Gateway.new(
|
59
60
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
60
61
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
61
|
-
:logger => Logger.new("/dev/null")
|
62
|
+
:logger => Logger.new("/dev/null"),
|
62
63
|
)
|
63
64
|
access_token = Braintree::OAuthTestHelper.create_token(oauth_gateway, {
|
64
65
|
:merchant_public_id => "integration_merchant_id",
|
@@ -67,7 +68,7 @@ describe Braintree::Customer do
|
|
67
68
|
|
68
69
|
gateway = Braintree::Gateway.new(
|
69
70
|
:access_token => access_token,
|
70
|
-
:logger => Logger.new("/dev/null")
|
71
|
+
:logger => Logger.new("/dev/null"),
|
71
72
|
)
|
72
73
|
|
73
74
|
result = gateway.customer.create(
|
@@ -77,7 +78,7 @@ describe Braintree::Customer do
|
|
77
78
|
:email => "joe@example.com",
|
78
79
|
:phone => "312.555.1234",
|
79
80
|
:fax => "614.555.5678",
|
80
|
-
:website => "www.example.com"
|
81
|
+
:website => "www.example.com",
|
81
82
|
)
|
82
83
|
result.success?.should == true
|
83
84
|
result.customer.id.should =~ /^\d{6,}$/
|
@@ -92,7 +93,7 @@ describe Braintree::Customer do
|
|
92
93
|
:expiration_date => "05/2010",
|
93
94
|
:cvv => "100",
|
94
95
|
:device_data => "device_data",
|
95
|
-
}
|
96
|
+
},
|
96
97
|
)
|
97
98
|
|
98
99
|
result.should be_success
|
@@ -108,7 +109,58 @@ describe Braintree::Customer do
|
|
108
109
|
:risk_data => {
|
109
110
|
:customer_browser => "IE5",
|
110
111
|
:customer_ip => "192.168.0.1"
|
111
|
-
}
|
112
|
+
},
|
113
|
+
)
|
114
|
+
|
115
|
+
result.should be_success
|
116
|
+
end
|
117
|
+
|
118
|
+
it "includes risk data when skip_advanced_fraud_checking is false" do
|
119
|
+
with_fraud_protection_enterprise_merchant do
|
120
|
+
result = Braintree::Customer.create(
|
121
|
+
:credit_card => {
|
122
|
+
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
123
|
+
:expiration_date => "05/2010",
|
124
|
+
:cvv => "100",
|
125
|
+
:options => {
|
126
|
+
:skip_advanced_fraud_checking => false,
|
127
|
+
:verify_card => true,
|
128
|
+
},
|
129
|
+
},
|
130
|
+
)
|
131
|
+
|
132
|
+
expect(result).to be_success
|
133
|
+
verification = result.customer.credit_cards.first.verification
|
134
|
+
expect(verification.risk_data).not_to be_nil
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
it "does not include risk data when skip_advanced_fraud_checking is true" do
|
139
|
+
with_fraud_protection_enterprise_merchant do
|
140
|
+
result = Braintree::Customer.create(
|
141
|
+
:credit_card => {
|
142
|
+
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
143
|
+
:expiration_date => "05/2010",
|
144
|
+
:cvv => "100",
|
145
|
+
:options => {
|
146
|
+
:skip_advanced_fraud_checking => true,
|
147
|
+
:verify_card => true,
|
148
|
+
},
|
149
|
+
},
|
150
|
+
)
|
151
|
+
|
152
|
+
expect(result).to be_success
|
153
|
+
verification = result.customer.credit_cards.first.verification
|
154
|
+
expect(verification.risk_data).to be_nil
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
it "supports creation with tax_identifiers" do
|
159
|
+
result = Braintree::Customer.create(
|
160
|
+
:tax_identifiers => [
|
161
|
+
{:country_code => "US", :identifier => "987654321"},
|
162
|
+
{:country_code => "CL", :identifier => "123456789"}
|
163
|
+
],
|
112
164
|
)
|
113
165
|
|
114
166
|
result.should be_success
|
@@ -134,21 +186,21 @@ describe Braintree::Customer do
|
|
134
186
|
found_customer.last_name.should == last_name
|
135
187
|
else
|
136
188
|
result.customer.first_name.should == "José"
|
137
|
-
result.customer.first_name.bytes.map {|b| b.to_s(8)}.should == ["112", "157", "163", "303", "251"]
|
189
|
+
result.customer.first_name.bytes.map { |b| b.to_s(8) }.should == ["112", "157", "163", "303", "251"]
|
138
190
|
result.customer.last_name.should == "Muñoz"
|
139
|
-
result.customer.last_name.bytes.map {|b| b.to_s(8)}.should == ["115", "165", "303", "261", "157", "172"]
|
191
|
+
result.customer.last_name.bytes.map { |b| b.to_s(8) }.should == ["115", "165", "303", "261", "157", "172"]
|
140
192
|
|
141
193
|
found_customer = Braintree::Customer.find(result.customer.id)
|
142
194
|
found_customer.first_name.should == "José"
|
143
|
-
found_customer.first_name.bytes.map {|b| b.to_s(8)}.should == ["112", "157", "163", "303", "251"]
|
195
|
+
found_customer.first_name.bytes.map { |b| b.to_s(8) }.should == ["112", "157", "163", "303", "251"]
|
144
196
|
found_customer.last_name.should == "Muñoz"
|
145
|
-
found_customer.last_name.bytes.map {|b| b.to_s(8)}.should == ["115", "165", "303", "261", "157", "172"]
|
197
|
+
found_customer.last_name.bytes.map { |b| b.to_s(8) }.should == ["115", "165", "303", "261", "157", "172"]
|
146
198
|
end
|
147
199
|
end
|
148
200
|
|
149
201
|
it "returns an error response if invalid" do
|
150
202
|
result = Braintree::Customer.create(
|
151
|
-
:email => "@invalid.com"
|
203
|
+
:email => "@invalid.com",
|
152
204
|
)
|
153
205
|
result.success?.should == false
|
154
206
|
result.errors.for(:customer).on(:email)[0].message.should == "Email is an invalid format."
|
@@ -162,7 +214,7 @@ describe Braintree::Customer do
|
|
162
214
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
163
215
|
:expiration_date => "05/2010",
|
164
216
|
:cvv => "100"
|
165
|
-
}
|
217
|
+
},
|
166
218
|
)
|
167
219
|
|
168
220
|
result.success?.should == true
|
@@ -182,7 +234,7 @@ describe Braintree::Customer do
|
|
182
234
|
:email => "other@example.com",
|
183
235
|
:billing_agreement_id => "B-123456",
|
184
236
|
:options => {:make_default => true}
|
185
|
-
}
|
237
|
+
},
|
186
238
|
)
|
187
239
|
|
188
240
|
result.success?.should == true
|
@@ -200,7 +252,7 @@ describe Braintree::Customer do
|
|
200
252
|
:number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::MasterCard,
|
201
253
|
:expiration_date => "05/2010",
|
202
254
|
:options => {:verify_card => true}
|
203
|
-
}
|
255
|
+
},
|
204
256
|
)
|
205
257
|
result.success?.should == false
|
206
258
|
result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
|
@@ -214,7 +266,7 @@ describe Braintree::Customer do
|
|
214
266
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
215
267
|
:expiration_date => "05/2019",
|
216
268
|
:options => {:verify_card => true, :verification_amount => "2.00"}
|
217
|
-
}
|
269
|
+
},
|
218
270
|
)
|
219
271
|
result.success?.should == true
|
220
272
|
end
|
@@ -224,7 +276,7 @@ describe Braintree::Customer do
|
|
224
276
|
Braintree::CreditCard.create(
|
225
277
|
:customer_id => customer.id,
|
226
278
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
227
|
-
:expiration_date => "05/2015"
|
279
|
+
:expiration_date => "05/2015",
|
228
280
|
)
|
229
281
|
|
230
282
|
result = Braintree::Customer.create(
|
@@ -234,7 +286,7 @@ describe Braintree::Customer do
|
|
234
286
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
235
287
|
:expiration_date => "05/2015",
|
236
288
|
:options => {:fail_on_duplicate_payment_method => true}
|
237
|
-
}
|
289
|
+
},
|
238
290
|
)
|
239
291
|
result.success?.should == false
|
240
292
|
result.errors.for(:customer).for(:credit_card).on(:number)[0].message.should == "Duplicate card exists in the vault."
|
@@ -251,7 +303,7 @@ describe Braintree::Customer do
|
|
251
303
|
:verify_card => true,
|
252
304
|
:verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId
|
253
305
|
}
|
254
|
-
}
|
306
|
+
},
|
255
307
|
)
|
256
308
|
result.success?.should == false
|
257
309
|
result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
|
@@ -269,7 +321,7 @@ describe Braintree::Customer do
|
|
269
321
|
:verify_card => true,
|
270
322
|
:verification_currency_iso_code => "USD"
|
271
323
|
}
|
272
|
-
}
|
324
|
+
},
|
273
325
|
)
|
274
326
|
|
275
327
|
result.success?.should == true
|
@@ -294,7 +346,7 @@ describe Braintree::Customer do
|
|
294
346
|
:verify_card => true,
|
295
347
|
:verification_currency_iso_code => "GBP"
|
296
348
|
}
|
297
|
-
}
|
349
|
+
},
|
298
350
|
)
|
299
351
|
expect(result).to_not be_success
|
300
352
|
expect(result.errors.for(:customer).for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code).to eq Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
|
@@ -312,7 +364,7 @@ describe Braintree::Customer do
|
|
312
364
|
:verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
313
365
|
:verification_currency_iso_code => "USD"
|
314
366
|
}
|
315
|
-
}
|
367
|
+
},
|
316
368
|
)
|
317
369
|
result.success?.should == true
|
318
370
|
result.customer.credit_cards[0].verification.currency_iso_code == "USD"
|
@@ -336,7 +388,7 @@ describe Braintree::Customer do
|
|
336
388
|
:verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
337
389
|
:verification_currency_iso_code => "GBP"
|
338
390
|
}
|
339
|
-
}
|
391
|
+
},
|
340
392
|
)
|
341
393
|
expect(result).to_not be_success
|
342
394
|
expect(result.errors.for(:customer).for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code).to eq Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
|
@@ -358,7 +410,7 @@ describe Braintree::Customer do
|
|
358
410
|
:postal_code => "60622",
|
359
411
|
:country_name => "United States of America"
|
360
412
|
}
|
361
|
-
}
|
413
|
+
},
|
362
414
|
)
|
363
415
|
result.success?.should == true
|
364
416
|
result.customer.first_name.should == "Mike"
|
@@ -389,7 +441,7 @@ describe Braintree::Customer do
|
|
389
441
|
:country_code_alpha3 => "COM",
|
390
442
|
:country_code_numeric => "174"
|
391
443
|
}
|
392
|
-
}
|
444
|
+
},
|
393
445
|
)
|
394
446
|
result.success?.should == true
|
395
447
|
result.customer.addresses[0].country_name.should == "Comoros"
|
@@ -404,7 +456,7 @@ describe Braintree::Customer do
|
|
404
456
|
:last_name => "Gates",
|
405
457
|
:custom_fields => {
|
406
458
|
:store_me => "custom value"
|
407
|
-
}
|
459
|
+
},
|
408
460
|
)
|
409
461
|
result.success?.should == true
|
410
462
|
result.customer.custom_fields[:store_me].should == "custom value"
|
@@ -414,7 +466,7 @@ describe Braintree::Customer do
|
|
414
466
|
result = Braintree::Customer.create(
|
415
467
|
:first_name => "Bill",
|
416
468
|
:last_name => "Gates",
|
417
|
-
:custom_fields => {
|
469
|
+
:custom_fields => {:store_me => ""},
|
418
470
|
)
|
419
471
|
result.success?.should == true
|
420
472
|
result.customer.custom_fields.should == {}
|
@@ -428,7 +480,7 @@ describe Braintree::Customer do
|
|
428
480
|
:billing_address => {
|
429
481
|
:country_name => "invalid"
|
430
482
|
}
|
431
|
-
}
|
483
|
+
},
|
432
484
|
)
|
433
485
|
result.success?.should == false
|
434
486
|
result.errors.for(:customer).on(:email)[0].message.should == "Email is an invalid format."
|
@@ -448,10 +500,10 @@ describe Braintree::Customer do
|
|
448
500
|
:country_code_alpha2 => "US",
|
449
501
|
:country_code_alpha3 => "COM",
|
450
502
|
}
|
451
|
-
}
|
503
|
+
},
|
452
504
|
)
|
453
505
|
result.success?.should == false
|
454
|
-
result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:base).map {|e| e.code}.should include(Braintree::ErrorCodes::Address::InconsistentCountry)
|
506
|
+
result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:base).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::InconsistentCountry)
|
455
507
|
end
|
456
508
|
|
457
509
|
it "returns an error if country code alpha2 is invalid" do
|
@@ -464,10 +516,10 @@ describe Braintree::Customer do
|
|
464
516
|
:billing_address => {
|
465
517
|
:country_code_alpha2 => "zz",
|
466
518
|
}
|
467
|
-
}
|
519
|
+
},
|
468
520
|
)
|
469
521
|
result.success?.should == false
|
470
|
-
result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_code_alpha2).map {|e| e.code}.should include(Braintree::ErrorCodes::Address::CountryCodeAlpha2IsNotAccepted)
|
522
|
+
result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_code_alpha2).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::CountryCodeAlpha2IsNotAccepted)
|
471
523
|
end
|
472
524
|
|
473
525
|
it "returns an error if country code alpha3 is invalid" do
|
@@ -480,10 +532,10 @@ describe Braintree::Customer do
|
|
480
532
|
:billing_address => {
|
481
533
|
:country_code_alpha3 => "zzz",
|
482
534
|
}
|
483
|
-
}
|
535
|
+
},
|
484
536
|
)
|
485
537
|
result.success?.should == false
|
486
|
-
result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_code_alpha3).map {|e| e.code}.should include(Braintree::ErrorCodes::Address::CountryCodeAlpha3IsNotAccepted)
|
538
|
+
result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_code_alpha3).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::CountryCodeAlpha3IsNotAccepted)
|
487
539
|
end
|
488
540
|
|
489
541
|
it "returns an error if country code numeric is invalid" do
|
@@ -496,10 +548,10 @@ describe Braintree::Customer do
|
|
496
548
|
:billing_address => {
|
497
549
|
:country_code_numeric => "zzz",
|
498
550
|
}
|
499
|
-
}
|
551
|
+
},
|
500
552
|
)
|
501
553
|
result.success?.should == false
|
502
|
-
result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_code_numeric).map {|e| e.code}.should include(Braintree::ErrorCodes::Address::CountryCodeNumericIsNotAccepted)
|
554
|
+
result.errors.for(:customer).for(:credit_card).for(:billing_address).on(:country_code_numeric).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::CountryCodeNumericIsNotAccepted)
|
503
555
|
end
|
504
556
|
|
505
557
|
it "returns errors if custom_fields are not registered" do
|
@@ -508,7 +560,7 @@ describe Braintree::Customer do
|
|
508
560
|
:last_name => "Kennedy",
|
509
561
|
:custom_fields => {
|
510
562
|
:spouse_name => "Jacqueline"
|
511
|
-
}
|
563
|
+
},
|
512
564
|
)
|
513
565
|
result.success?.should == false
|
514
566
|
result.errors.for(:customer).on(:custom_fields)[0].message.should == "Custom field is invalid: spouse_name."
|
@@ -521,7 +573,7 @@ describe Braintree::Customer do
|
|
521
573
|
:last_name => "Hamlin",
|
522
574
|
:credit_card => {
|
523
575
|
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::VisaPaymentMethodCode
|
524
|
-
}
|
576
|
+
},
|
525
577
|
)
|
526
578
|
result.success?.should == true
|
527
579
|
result.customer.credit_cards.first.bin.should == "400934"
|
@@ -538,7 +590,7 @@ describe Braintree::Customer do
|
|
538
590
|
:options => {
|
539
591
|
:venmo_sdk_session => Braintree::Test::VenmoSDK::Session
|
540
592
|
}
|
541
|
-
}
|
593
|
+
},
|
542
594
|
)
|
543
595
|
result.success?.should == true
|
544
596
|
result.customer.credit_cards.first.venmo_sdk?.should == false
|
@@ -553,13 +605,13 @@ describe Braintree::Customer do
|
|
553
605
|
:expiration_month => "11",
|
554
606
|
:expiration_year => "2099",
|
555
607
|
},
|
556
|
-
:share => true
|
608
|
+
:share => true,
|
557
609
|
)
|
558
610
|
|
559
611
|
result = Braintree::Customer.create(
|
560
612
|
:credit_card => {
|
561
613
|
:payment_method_nonce => nonce
|
562
|
-
}
|
614
|
+
},
|
563
615
|
)
|
564
616
|
|
565
617
|
result.success?.should == true
|
@@ -589,7 +641,7 @@ describe Braintree::Customer do
|
|
589
641
|
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
590
642
|
:expiration_month => "11",
|
591
643
|
:expiration_year => "2099",
|
592
|
-
}
|
644
|
+
},
|
593
645
|
)
|
594
646
|
result = Braintree::Customer.create(
|
595
647
|
:payment_method_nonce => nonce,
|
@@ -599,7 +651,7 @@ describe Braintree::Customer do
|
|
599
651
|
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
600
652
|
:verification_account_type => "debit",
|
601
653
|
}
|
602
|
-
}
|
654
|
+
},
|
603
655
|
)
|
604
656
|
|
605
657
|
expect(result).to be_success
|
@@ -611,7 +663,7 @@ describe Braintree::Customer do
|
|
611
663
|
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
612
664
|
:expiration_month => "11",
|
613
665
|
:expiration_year => "2099",
|
614
|
-
}
|
666
|
+
},
|
615
667
|
)
|
616
668
|
result = Braintree::Customer.create(
|
617
669
|
:payment_method_nonce => nonce,
|
@@ -621,7 +673,7 @@ describe Braintree::Customer do
|
|
621
673
|
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
622
674
|
:verification_account_type => "credit",
|
623
675
|
}
|
624
|
-
}
|
676
|
+
},
|
625
677
|
)
|
626
678
|
|
627
679
|
expect(result).to be_success
|
@@ -633,7 +685,7 @@ describe Braintree::Customer do
|
|
633
685
|
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
634
686
|
:expiration_month => "11",
|
635
687
|
:expiration_year => "2099",
|
636
|
-
}
|
688
|
+
},
|
637
689
|
)
|
638
690
|
result = Braintree::Customer.create(
|
639
691
|
:payment_method_nonce => nonce,
|
@@ -643,7 +695,7 @@ describe Braintree::Customer do
|
|
643
695
|
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
644
696
|
:verification_account_type => "ach",
|
645
697
|
}
|
646
|
-
}
|
698
|
+
},
|
647
699
|
)
|
648
700
|
|
649
701
|
expect(result).to_not be_success
|
@@ -656,7 +708,7 @@ describe Braintree::Customer do
|
|
656
708
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
657
709
|
:expiration_month => "11",
|
658
710
|
:expiration_year => "2099",
|
659
|
-
}
|
711
|
+
},
|
660
712
|
)
|
661
713
|
result = Braintree::Customer.create(
|
662
714
|
:payment_method_nonce => nonce,
|
@@ -665,7 +717,7 @@ describe Braintree::Customer do
|
|
665
717
|
:verify_card => true,
|
666
718
|
:verification_account_type => "credit",
|
667
719
|
}
|
668
|
-
}
|
720
|
+
},
|
669
721
|
)
|
670
722
|
|
671
723
|
expect(result).to_not be_success
|
@@ -678,7 +730,7 @@ describe Braintree::Customer do
|
|
678
730
|
it "returns the customer if successful" do
|
679
731
|
customer = Braintree::Customer.create!(
|
680
732
|
:first_name => "Jim",
|
681
|
-
:last_name => "Smith"
|
733
|
+
:last_name => "Smith",
|
682
734
|
)
|
683
735
|
customer.id.should =~ /\d+/
|
684
736
|
customer.first_name.should == "Jim"
|
@@ -703,7 +755,7 @@ describe Braintree::Customer do
|
|
703
755
|
:credit_card => {
|
704
756
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
705
757
|
:expiration_date => "05/2010"
|
706
|
-
}
|
758
|
+
},
|
707
759
|
)
|
708
760
|
result = Braintree::Customer.credit(customer.id, :amount => "100.00")
|
709
761
|
result.success?.should == true
|
@@ -723,7 +775,7 @@ describe Braintree::Customer do
|
|
723
775
|
:credit_card => {
|
724
776
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
725
777
|
:expiration_date => "05/2010"
|
726
|
-
}
|
778
|
+
},
|
727
779
|
)
|
728
780
|
transaction = Braintree::Customer.credit!(customer.id, :amount => "100.00")
|
729
781
|
transaction.amount.should == BigDecimal("100.00")
|
@@ -742,7 +794,7 @@ describe Braintree::Customer do
|
|
742
794
|
:credit_card => {
|
743
795
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
744
796
|
:expiration_date => "05/2010"
|
745
|
-
}
|
797
|
+
},
|
746
798
|
)
|
747
799
|
result = Braintree::Customer.sale(customer.id, :amount => "100.00")
|
748
800
|
result.success?.should == true
|
@@ -762,7 +814,7 @@ describe Braintree::Customer do
|
|
762
814
|
:credit_card => {
|
763
815
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
764
816
|
:expiration_date => "05/2010"
|
765
|
-
}
|
817
|
+
},
|
766
818
|
)
|
767
819
|
transaction = Braintree::Customer.sale!(customer.id, :amount => "100.00")
|
768
820
|
transaction.amount.should == BigDecimal("100.00")
|
@@ -781,7 +833,7 @@ describe Braintree::Customer do
|
|
781
833
|
:credit_card => {
|
782
834
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
783
835
|
:expiration_date => "05/2010"
|
784
|
-
}
|
836
|
+
},
|
785
837
|
)
|
786
838
|
transaction = Braintree::Customer.sale!(customer.id, :amount => "100.00")
|
787
839
|
collection = Braintree::Customer.transactions(customer.id)
|
@@ -795,10 +847,10 @@ describe Braintree::Customer do
|
|
795
847
|
:credit_card => {
|
796
848
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
797
849
|
:expiration_date => "05/2010"
|
798
|
-
}
|
850
|
+
},
|
799
851
|
)
|
800
852
|
result = customer.credit(
|
801
|
-
:amount => "100.00"
|
853
|
+
:amount => "100.00",
|
802
854
|
)
|
803
855
|
result.success?.should == true
|
804
856
|
result.transaction.amount.should == BigDecimal("100.00")
|
@@ -817,7 +869,7 @@ describe Braintree::Customer do
|
|
817
869
|
:credit_card => {
|
818
870
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
819
871
|
:expiration_date => "05/2010"
|
820
|
-
}
|
872
|
+
},
|
821
873
|
)
|
822
874
|
transaction = customer.credit!(:amount => "100.00")
|
823
875
|
transaction.amount.should == BigDecimal("100.00")
|
@@ -834,7 +886,7 @@ describe Braintree::Customer do
|
|
834
886
|
it "deletes the customer" do
|
835
887
|
result = Braintree::Customer.create(
|
836
888
|
:first_name => "Joe",
|
837
|
-
:last_name => "Cool"
|
889
|
+
:last_name => "Cool",
|
838
890
|
)
|
839
891
|
result.success?.should == true
|
840
892
|
|
@@ -851,7 +903,7 @@ describe Braintree::Customer do
|
|
851
903
|
it "finds the customer with the given id" do
|
852
904
|
result = Braintree::Customer.create(
|
853
905
|
:first_name => "Joe",
|
854
|
-
:last_name => "Cool"
|
906
|
+
:last_name => "Cool",
|
855
907
|
)
|
856
908
|
result.success?.should == true
|
857
909
|
|
@@ -867,13 +919,13 @@ describe Braintree::Customer do
|
|
867
919
|
credit_card = Braintree::CreditCard.create(
|
868
920
|
:customer_id => customer.id,
|
869
921
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
870
|
-
:expiration_date => "05/2012"
|
922
|
+
:expiration_date => "05/2012",
|
871
923
|
).credit_card
|
872
924
|
|
873
925
|
subscription = Braintree::Subscription.create(
|
874
926
|
:payment_method_token => credit_card.token,
|
875
927
|
:plan_id => "integration_trialless_plan",
|
876
|
-
:price => "1.00"
|
928
|
+
:price => "1.00",
|
877
929
|
).subscription
|
878
930
|
|
879
931
|
found_customer = Braintree::Customer.find(customer.id)
|
@@ -888,7 +940,7 @@ describe Braintree::Customer do
|
|
888
940
|
customer = Braintree::Customer.create(
|
889
941
|
:custom_fields => {
|
890
942
|
:store_me => "custom value"
|
891
|
-
}
|
943
|
+
},
|
892
944
|
).customer
|
893
945
|
credit_card = Braintree::CreditCard.create(
|
894
946
|
:customer_id => customer.id,
|
@@ -900,13 +952,13 @@ describe Braintree::Customer do
|
|
900
952
|
:region => "Illinois",
|
901
953
|
:postal_code => "60622",
|
902
954
|
:country_name => "United States of America"
|
903
|
-
}
|
955
|
+
},
|
904
956
|
).credit_card
|
905
957
|
|
906
958
|
subscription = Braintree::Subscription.create(
|
907
959
|
:payment_method_token => credit_card.token,
|
908
960
|
:plan_id => "integration_trialless_plan",
|
909
|
-
:price => "1.00"
|
961
|
+
:price => "1.00",
|
910
962
|
).subscription
|
911
963
|
|
912
964
|
found_customer = Braintree::Customer.find(customer.id, {
|
@@ -922,7 +974,7 @@ describe Braintree::Customer do
|
|
922
974
|
customer = Braintree::Customer.create(
|
923
975
|
:custom_fields => {
|
924
976
|
:store_me => "custom value"
|
925
|
-
}
|
977
|
+
},
|
926
978
|
).customer
|
927
979
|
credit_card = Braintree::CreditCard.create(
|
928
980
|
:customer_id => customer.id,
|
@@ -934,13 +986,13 @@ describe Braintree::Customer do
|
|
934
986
|
:region => "Illinois",
|
935
987
|
:postal_code => "60622",
|
936
988
|
:country_name => "United States of America"
|
937
|
-
}
|
989
|
+
},
|
938
990
|
).credit_card
|
939
991
|
|
940
992
|
subscription = Braintree::Subscription.create(
|
941
993
|
:payment_method_token => credit_card.token,
|
942
994
|
:plan_id => "integration_trialless_plan",
|
943
|
-
:price => "1.00"
|
995
|
+
:price => "1.00",
|
944
996
|
).subscription
|
945
997
|
|
946
998
|
found_customer = Braintree::Customer.find(customer.id, {
|
@@ -958,7 +1010,7 @@ describe Braintree::Customer do
|
|
958
1010
|
|
959
1011
|
it "returns associated ApplePayCards" do
|
960
1012
|
result = Braintree::Customer.create(
|
961
|
-
:payment_method_nonce => Braintree::Test::Nonce::ApplePayAmEx
|
1013
|
+
:payment_method_nonce => Braintree::Test::Nonce::ApplePayAmEx,
|
962
1014
|
)
|
963
1015
|
result.success?.should == true
|
964
1016
|
|
@@ -973,7 +1025,7 @@ describe Braintree::Customer do
|
|
973
1025
|
|
974
1026
|
it "returns associated google pay proxy cards" do
|
975
1027
|
result = Braintree::Customer.create(
|
976
|
-
:payment_method_nonce => Braintree::Test::Nonce::GooglePayDiscover
|
1028
|
+
:payment_method_nonce => Braintree::Test::Nonce::GooglePayDiscover,
|
977
1029
|
)
|
978
1030
|
result.success?.should == true
|
979
1031
|
|
@@ -989,7 +1041,7 @@ describe Braintree::Customer do
|
|
989
1041
|
|
990
1042
|
it "returns associated google pay network tokens" do
|
991
1043
|
result = Braintree::Customer.create(
|
992
|
-
:payment_method_nonce => Braintree::Test::Nonce::GooglePayMasterCard
|
1044
|
+
:payment_method_nonce => Braintree::Test::Nonce::GooglePayMasterCard,
|
993
1045
|
)
|
994
1046
|
result.success?.should == true
|
995
1047
|
|
@@ -1005,7 +1057,7 @@ describe Braintree::Customer do
|
|
1005
1057
|
|
1006
1058
|
it "returns associated venmo accounts" do
|
1007
1059
|
result = Braintree::Customer.create(
|
1008
|
-
:payment_method_nonce => Braintree::Test::Nonce::VenmoAccount
|
1060
|
+
:payment_method_nonce => Braintree::Test::Nonce::VenmoAccount,
|
1009
1061
|
)
|
1010
1062
|
result.success?.should == true
|
1011
1063
|
|
@@ -1025,7 +1077,7 @@ describe Braintree::Customer do
|
|
1025
1077
|
:options => {
|
1026
1078
|
:verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
1027
1079
|
}
|
1028
|
-
}
|
1080
|
+
},
|
1029
1081
|
)
|
1030
1082
|
result.should be_success
|
1031
1083
|
|
@@ -1071,7 +1123,7 @@ describe Braintree::Customer do
|
|
1071
1123
|
it "updates the credit card with three_d_secure pass thru params" do
|
1072
1124
|
customer = Braintree::Customer.create!(
|
1073
1125
|
:first_name => "Joe",
|
1074
|
-
:last_name => "Cool"
|
1126
|
+
:last_name => "Cool",
|
1075
1127
|
)
|
1076
1128
|
result = Braintree::Customer.update(
|
1077
1129
|
customer.id,
|
@@ -1084,17 +1136,17 @@ describe Braintree::Customer do
|
|
1084
1136
|
:number => 4111111111111111,
|
1085
1137
|
:expiration_date => "05/2060",
|
1086
1138
|
:three_d_secure_pass_thru => {
|
1087
|
-
:eci_flag =>
|
1088
|
-
:cavv =>
|
1089
|
-
:xid =>
|
1090
|
-
:three_d_secure_version =>
|
1091
|
-
:authentication_response =>
|
1092
|
-
:directory_response =>
|
1093
|
-
:cavv_algorithm =>
|
1094
|
-
:ds_transaction_id =>
|
1139
|
+
:eci_flag => "02",
|
1140
|
+
:cavv => "some_cavv",
|
1141
|
+
:xid => "some_xid",
|
1142
|
+
:three_d_secure_version => "1.0.2",
|
1143
|
+
:authentication_response => "Y",
|
1144
|
+
:directory_response => "Y",
|
1145
|
+
:cavv_algorithm => "2",
|
1146
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
1095
1147
|
},
|
1096
1148
|
:options => {:verify_card => true},
|
1097
|
-
}
|
1149
|
+
},
|
1098
1150
|
)
|
1099
1151
|
result.success?.should == true
|
1100
1152
|
result.customer.id.should == customer.id
|
@@ -1106,7 +1158,7 @@ describe Braintree::Customer do
|
|
1106
1158
|
it "validates the presence of three_d_secure_version while passing three_d_secure_pass_thru in update" do
|
1107
1159
|
customer = Braintree::Customer.create!(
|
1108
1160
|
:first_name => "Joe",
|
1109
|
-
:last_name => "Cool"
|
1161
|
+
:last_name => "Cool",
|
1110
1162
|
)
|
1111
1163
|
result = Braintree::Customer.update(
|
1112
1164
|
customer.id,
|
@@ -1119,16 +1171,16 @@ describe Braintree::Customer do
|
|
1119
1171
|
:number => 4111111111111111,
|
1120
1172
|
:expiration_date => "05/2060",
|
1121
1173
|
:three_d_secure_pass_thru => {
|
1122
|
-
:eci_flag =>
|
1123
|
-
:cavv =>
|
1124
|
-
:xid =>
|
1125
|
-
:authentication_response =>
|
1126
|
-
:directory_response =>
|
1127
|
-
:cavv_algorithm =>
|
1128
|
-
:ds_transaction_id =>
|
1174
|
+
:eci_flag => "02",
|
1175
|
+
:cavv => "some_cavv",
|
1176
|
+
:xid => "some_xid",
|
1177
|
+
:authentication_response => "Y",
|
1178
|
+
:directory_response => "Y",
|
1179
|
+
:cavv_algorithm => "2",
|
1180
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
1129
1181
|
},
|
1130
1182
|
options: {:verify_card => true}
|
1131
|
-
}
|
1183
|
+
},
|
1132
1184
|
)
|
1133
1185
|
expect(result).to_not be_success
|
1134
1186
|
error = result.errors.for(:verification).first
|
@@ -1139,7 +1191,7 @@ describe Braintree::Customer do
|
|
1139
1191
|
it "updates the customer with the given id if successful" do
|
1140
1192
|
customer = Braintree::Customer.create!(
|
1141
1193
|
:first_name => "Joe",
|
1142
|
-
:last_name => "Cool"
|
1194
|
+
:last_name => "Cool",
|
1143
1195
|
)
|
1144
1196
|
result = Braintree::Customer.update(
|
1145
1197
|
customer.id,
|
@@ -1147,7 +1199,7 @@ describe Braintree::Customer do
|
|
1147
1199
|
:last_name => "Super Cool",
|
1148
1200
|
:custom_fields => {
|
1149
1201
|
:store_me => "a value"
|
1150
|
-
}
|
1202
|
+
},
|
1151
1203
|
)
|
1152
1204
|
result.success?.should == true
|
1153
1205
|
result.customer.id.should == customer.id
|
@@ -1161,7 +1213,7 @@ describe Braintree::Customer do
|
|
1161
1213
|
:credit_card => {
|
1162
1214
|
:number => 4111111111111111,
|
1163
1215
|
:expiration_date => "05/2010",
|
1164
|
-
}
|
1216
|
+
},
|
1165
1217
|
)
|
1166
1218
|
result = Braintree::Customer.update(
|
1167
1219
|
customer.id,
|
@@ -1171,7 +1223,7 @@ describe Braintree::Customer do
|
|
1171
1223
|
:options=> {
|
1172
1224
|
:fail_on_duplicate_payment_method => true
|
1173
1225
|
}
|
1174
|
-
}
|
1226
|
+
},
|
1175
1227
|
)
|
1176
1228
|
result.success?.should == false
|
1177
1229
|
result.errors.for(:customer).for(:credit_card).on(:number)[0].message.should == "Duplicate card exists in the vault."
|
@@ -1180,7 +1232,7 @@ describe Braintree::Customer do
|
|
1180
1232
|
it "updates the default payment method" do
|
1181
1233
|
customer = Braintree::Customer.create!(
|
1182
1234
|
:first_name => "Joe",
|
1183
|
-
:last_name => "Brown"
|
1235
|
+
:last_name => "Brown",
|
1184
1236
|
)
|
1185
1237
|
|
1186
1238
|
token1 = random_payment_method_token
|
@@ -1188,7 +1240,7 @@ describe Braintree::Customer do
|
|
1188
1240
|
payment_method1 = Braintree::PaymentMethod.create(
|
1189
1241
|
:customer_id => customer.id,
|
1190
1242
|
:payment_method_nonce => Braintree::Test::Nonce::TransactableVisa,
|
1191
|
-
:token => token1
|
1243
|
+
:token => token1,
|
1192
1244
|
)
|
1193
1245
|
|
1194
1246
|
payment_method1 = Braintree::PaymentMethod.find(token1)
|
@@ -1199,11 +1251,11 @@ describe Braintree::Customer do
|
|
1199
1251
|
payment_method2 = Braintree::PaymentMethod.create(
|
1200
1252
|
:customer_id => customer.id,
|
1201
1253
|
:payment_method_nonce => Braintree::Test::Nonce::TransactableMasterCard,
|
1202
|
-
:token => token2
|
1254
|
+
:token => token2,
|
1203
1255
|
)
|
1204
1256
|
|
1205
1257
|
Braintree::Customer.update(customer.id,
|
1206
|
-
:default_payment_method_token => token2
|
1258
|
+
:default_payment_method_token => token2,
|
1207
1259
|
)
|
1208
1260
|
|
1209
1261
|
payment_method2 = Braintree::PaymentMethod.find(token2)
|
@@ -1213,7 +1265,7 @@ describe Braintree::Customer do
|
|
1213
1265
|
it "updates the default payment method in the options" do
|
1214
1266
|
customer = Braintree::Customer.create!(
|
1215
1267
|
:first_name => "Joe",
|
1216
|
-
:last_name => "Brown"
|
1268
|
+
:last_name => "Brown",
|
1217
1269
|
)
|
1218
1270
|
|
1219
1271
|
token1 = random_payment_method_token
|
@@ -1221,7 +1273,7 @@ describe Braintree::Customer do
|
|
1221
1273
|
payment_method1 = Braintree::PaymentMethod.create(
|
1222
1274
|
:customer_id => customer.id,
|
1223
1275
|
:payment_method_nonce => Braintree::Test::Nonce::TransactableVisa,
|
1224
|
-
:token => token1
|
1276
|
+
:token => token1,
|
1225
1277
|
)
|
1226
1278
|
|
1227
1279
|
payment_method1 = Braintree::PaymentMethod.find(token1)
|
@@ -1232,7 +1284,7 @@ describe Braintree::Customer do
|
|
1232
1284
|
payment_method2 = Braintree::PaymentMethod.create(
|
1233
1285
|
:customer_id => customer.id,
|
1234
1286
|
:payment_method_nonce => Braintree::Test::Nonce::TransactableMasterCard,
|
1235
|
-
:token => token2
|
1287
|
+
:token => token2,
|
1236
1288
|
)
|
1237
1289
|
|
1238
1290
|
Braintree::Customer.update(customer.id,
|
@@ -1241,7 +1293,7 @@ describe Braintree::Customer do
|
|
1241
1293
|
:update_existing_token => token2,
|
1242
1294
|
:make_default => true
|
1243
1295
|
}
|
1244
|
-
}
|
1296
|
+
},
|
1245
1297
|
)
|
1246
1298
|
|
1247
1299
|
payment_method2 = Braintree::PaymentMethod.find(token2)
|
@@ -1251,7 +1303,7 @@ describe Braintree::Customer do
|
|
1251
1303
|
it "can use any country code" do
|
1252
1304
|
customer = Braintree::Customer.create!(
|
1253
1305
|
:first_name => "Alex",
|
1254
|
-
:last_name => "Matterson"
|
1306
|
+
:last_name => "Matterson",
|
1255
1307
|
)
|
1256
1308
|
result = Braintree::Customer.update(
|
1257
1309
|
customer.id,
|
@@ -1266,7 +1318,7 @@ describe Braintree::Customer do
|
|
1266
1318
|
:country_code_alpha3 => "FJI",
|
1267
1319
|
:country_code_numeric => "242"
|
1268
1320
|
}
|
1269
|
-
}
|
1321
|
+
},
|
1270
1322
|
)
|
1271
1323
|
result.success?.should == true
|
1272
1324
|
result.customer.addresses[0].country_name.should == "Fiji"
|
@@ -1285,7 +1337,7 @@ describe Braintree::Customer do
|
|
1285
1337
|
:first_name => "Joe",
|
1286
1338
|
:postal_code => "60622"
|
1287
1339
|
}
|
1288
|
-
}
|
1340
|
+
},
|
1289
1341
|
)
|
1290
1342
|
|
1291
1343
|
result = Braintree::Customer.update(
|
@@ -1293,13 +1345,13 @@ describe Braintree::Customer do
|
|
1293
1345
|
:first_name => "New Joe",
|
1294
1346
|
:credit_card => {
|
1295
1347
|
:cardholder_name => "New Joe Cardholder",
|
1296
|
-
:options => {
|
1348
|
+
:options => {:update_existing_token => customer.credit_cards.first.token},
|
1297
1349
|
:billing_address => {
|
1298
1350
|
:last_name => "Cool",
|
1299
1351
|
:postal_code => "60666",
|
1300
|
-
:options => {
|
1352
|
+
:options => {:update_existing => true}
|
1301
1353
|
}
|
1302
|
-
}
|
1354
|
+
},
|
1303
1355
|
)
|
1304
1356
|
result.success?.should == true
|
1305
1357
|
result.customer.id.should == customer.id
|
@@ -1317,7 +1369,7 @@ describe Braintree::Customer do
|
|
1317
1369
|
|
1318
1370
|
it "can update the customer and verify_card with a specific verification_amount" do
|
1319
1371
|
customer = Braintree::Customer.create!(
|
1320
|
-
:first_name => "Joe"
|
1372
|
+
:first_name => "Joe",
|
1321
1373
|
)
|
1322
1374
|
|
1323
1375
|
result = Braintree::Customer.update(
|
@@ -1327,8 +1379,73 @@ describe Braintree::Customer do
|
|
1327
1379
|
:cardholder_name => "New Joe Cardholder",
|
1328
1380
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1329
1381
|
:expiration_date => "12/2009",
|
1330
|
-
:options => {
|
1331
|
-
}
|
1382
|
+
:options => {:verify_card => true, :verification_amount => "2.00"}
|
1383
|
+
},
|
1384
|
+
)
|
1385
|
+
result.success?.should == true
|
1386
|
+
end
|
1387
|
+
|
1388
|
+
it "includes risk data when skip_advanced_fraud_checking is false" do
|
1389
|
+
with_fraud_protection_enterprise_merchant do
|
1390
|
+
customer = Braintree::Customer.create!(
|
1391
|
+
:first_name => "Joe",
|
1392
|
+
)
|
1393
|
+
|
1394
|
+
updated_result = Braintree::Customer.update(
|
1395
|
+
customer.id,
|
1396
|
+
:credit_card => {
|
1397
|
+
:cardholder_name => "New Joe Cardholder",
|
1398
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1399
|
+
:expiration_date => "12/2009",
|
1400
|
+
:options => {
|
1401
|
+
:skip_advanced_fraud_checking => false,
|
1402
|
+
:verify_card => true,
|
1403
|
+
},
|
1404
|
+
},
|
1405
|
+
)
|
1406
|
+
|
1407
|
+
expect(updated_result).to be_success
|
1408
|
+
verification = updated_result.customer.credit_cards.first.verification
|
1409
|
+
expect(verification.risk_data).not_to be_nil
|
1410
|
+
end
|
1411
|
+
end
|
1412
|
+
|
1413
|
+
it "does not include risk data when skip_advanced_fraud_checking is true" do
|
1414
|
+
with_fraud_protection_enterprise_merchant do
|
1415
|
+
customer = Braintree::Customer.create!(
|
1416
|
+
:first_name => "Joe",
|
1417
|
+
)
|
1418
|
+
|
1419
|
+
updated_result = Braintree::Customer.update(
|
1420
|
+
customer.id,
|
1421
|
+
:credit_card => {
|
1422
|
+
:cardholder_name => "New Joe Cardholder",
|
1423
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1424
|
+
:expiration_date => "12/2009",
|
1425
|
+
:options => {
|
1426
|
+
:skip_advanced_fraud_checking => true,
|
1427
|
+
:verify_card => true,
|
1428
|
+
},
|
1429
|
+
},
|
1430
|
+
)
|
1431
|
+
|
1432
|
+
expect(updated_result).to be_success
|
1433
|
+
verification = updated_result.customer.credit_cards.first.verification
|
1434
|
+
expect(verification.risk_data).to be_nil
|
1435
|
+
end
|
1436
|
+
end
|
1437
|
+
|
1438
|
+
it "can update a tax_identifier" do
|
1439
|
+
customer = Braintree::Customer.create!(
|
1440
|
+
:tax_identifiers => [
|
1441
|
+
{:country_code => "US", :identifier => "987654321"},
|
1442
|
+
{:country_code => "CL", :identifier => "123456789"}
|
1443
|
+
],
|
1444
|
+
)
|
1445
|
+
|
1446
|
+
result = Braintree::Customer.update(
|
1447
|
+
customer.id,
|
1448
|
+
:tax_identifiers => [{:country_code => "US", :identifier => "567891234"}],
|
1332
1449
|
)
|
1333
1450
|
result.success?.should == true
|
1334
1451
|
end
|
@@ -1338,17 +1455,17 @@ describe Braintree::Customer do
|
|
1338
1455
|
:payment_method_nonce => Braintree::Test::Nonce::ThreeDSecureVisaFullAuthentication,
|
1339
1456
|
:credit_card => {
|
1340
1457
|
:three_d_secure_pass_thru => {
|
1341
|
-
:eci_flag =>
|
1342
|
-
:cavv =>
|
1343
|
-
:xid =>
|
1344
|
-
:three_d_secure_version =>
|
1345
|
-
:authentication_response =>
|
1346
|
-
:directory_response =>
|
1347
|
-
:cavv_algorithm =>
|
1348
|
-
:ds_transaction_id =>
|
1458
|
+
:eci_flag => "02",
|
1459
|
+
:cavv => "some_cavv",
|
1460
|
+
:xid => "some_xid",
|
1461
|
+
:three_d_secure_version => "xx",
|
1462
|
+
:authentication_response => "Y",
|
1463
|
+
:directory_response => "Y",
|
1464
|
+
:cavv_algorithm => "2",
|
1465
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
1349
1466
|
},
|
1350
1467
|
:options => {:verify_card => true}
|
1351
|
-
}
|
1468
|
+
},
|
1352
1469
|
)
|
1353
1470
|
|
1354
1471
|
expect(result).not_to be_success
|
@@ -1362,17 +1479,17 @@ describe Braintree::Customer do
|
|
1362
1479
|
:payment_method_nonce => Braintree::Test::Nonce::ThreeDSecureVisaFullAuthentication,
|
1363
1480
|
:credit_card => {
|
1364
1481
|
:three_d_secure_pass_thru => {
|
1365
|
-
:eci_flag =>
|
1366
|
-
:cavv =>
|
1367
|
-
:xid =>
|
1368
|
-
:three_d_secure_version =>
|
1369
|
-
:authentication_response =>
|
1370
|
-
:directory_response =>
|
1371
|
-
:cavv_algorithm =>
|
1372
|
-
:ds_transaction_id =>
|
1482
|
+
:eci_flag => "02",
|
1483
|
+
:cavv => "some_cavv",
|
1484
|
+
:xid => "some_xid",
|
1485
|
+
:three_d_secure_version => "2.2.1",
|
1486
|
+
:authentication_response => "Y",
|
1487
|
+
:directory_response => "Y",
|
1488
|
+
:cavv_algorithm => "2",
|
1489
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
1373
1490
|
},
|
1374
1491
|
:options => {:verify_card => true}
|
1375
|
-
}
|
1492
|
+
},
|
1376
1493
|
)
|
1377
1494
|
|
1378
1495
|
expect(result).to be_success
|
@@ -1383,7 +1500,7 @@ describe Braintree::Customer do
|
|
1383
1500
|
:payment_method_nonce => Braintree::Test::Nonce::ThreeDSecureVisaFullAuthentication,
|
1384
1501
|
:credit_card => {
|
1385
1502
|
:options => {:verify_card => true}
|
1386
|
-
}
|
1503
|
+
},
|
1387
1504
|
)
|
1388
1505
|
result.success?.should == true
|
1389
1506
|
|
@@ -1405,7 +1522,7 @@ describe Braintree::Customer do
|
|
1405
1522
|
address = Braintree::Address.create!(
|
1406
1523
|
:customer_id => customer.id,
|
1407
1524
|
:first_name => "John",
|
1408
|
-
:last_name => "Doe"
|
1525
|
+
:last_name => "Doe",
|
1409
1526
|
)
|
1410
1527
|
|
1411
1528
|
customer = Braintree::Customer.update(
|
@@ -1414,7 +1531,7 @@ describe Braintree::Customer do
|
|
1414
1531
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1415
1532
|
:expiration_date => "12/2009",
|
1416
1533
|
:billing_address_id => address.id
|
1417
|
-
}
|
1534
|
+
},
|
1418
1535
|
).customer
|
1419
1536
|
|
1420
1537
|
billing_address = customer.credit_cards.first.billing_address
|
@@ -1427,7 +1544,7 @@ describe Braintree::Customer do
|
|
1427
1544
|
customer = Braintree::Customer.create!(:email => "valid@email.com")
|
1428
1545
|
result = Braintree::Customer.update(
|
1429
1546
|
customer.id,
|
1430
|
-
:email => "@invalid.com"
|
1547
|
+
:email => "@invalid.com",
|
1431
1548
|
)
|
1432
1549
|
result.success?.should == false
|
1433
1550
|
result.errors.for(:customer).on(:email)[0].message.should == "Email is an invalid format."
|
@@ -1436,7 +1553,7 @@ describe Braintree::Customer do
|
|
1436
1553
|
context "verification_currency_iso_code" do
|
1437
1554
|
it "can update the customer after validating verification_currency_iso_code" do
|
1438
1555
|
customer = Braintree::Customer.create!(
|
1439
|
-
:first_name => "Joe"
|
1556
|
+
:first_name => "Joe",
|
1440
1557
|
)
|
1441
1558
|
|
1442
1559
|
result = Braintree::Customer.update(
|
@@ -1446,8 +1563,8 @@ describe Braintree::Customer do
|
|
1446
1563
|
:cardholder_name => "New Joe Cardholder",
|
1447
1564
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1448
1565
|
:expiration_date => "12/2009",
|
1449
|
-
:options => {
|
1450
|
-
}
|
1566
|
+
:options => {:verify_card => true, :verification_currency_iso_code => "USD"}
|
1567
|
+
},
|
1451
1568
|
)
|
1452
1569
|
result.success?.should == true
|
1453
1570
|
result.customer.credit_cards[0].verification.currency_iso_code == "USD"
|
@@ -1455,7 +1572,7 @@ describe Braintree::Customer do
|
|
1455
1572
|
|
1456
1573
|
it "can update the customer after validating verification_currency_iso_code against the given verification_merchant_account_id" do
|
1457
1574
|
customer = Braintree::Customer.create!(
|
1458
|
-
:first_name => "Joe"
|
1575
|
+
:first_name => "Joe",
|
1459
1576
|
)
|
1460
1577
|
|
1461
1578
|
result = Braintree::Customer.update(
|
@@ -1465,8 +1582,8 @@ describe Braintree::Customer do
|
|
1465
1582
|
:cardholder_name => "New Joe Cardholder",
|
1466
1583
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1467
1584
|
:expiration_date => "12/2009",
|
1468
|
-
:options => {
|
1469
|
-
}
|
1585
|
+
:options => {:verify_card => true, :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId, :verification_currency_iso_code => "USD"}
|
1586
|
+
},
|
1470
1587
|
)
|
1471
1588
|
result.success?.should == true
|
1472
1589
|
result.customer.credit_cards[0].verification.currency_iso_code == "USD"
|
@@ -1475,7 +1592,7 @@ describe Braintree::Customer do
|
|
1475
1592
|
|
1476
1593
|
it "throws error due to verification_currency_iso_code not matching against the currency configured in default merchant account" do
|
1477
1594
|
customer = Braintree::Customer.create!(
|
1478
|
-
:first_name => "Joe"
|
1595
|
+
:first_name => "Joe",
|
1479
1596
|
)
|
1480
1597
|
|
1481
1598
|
result = Braintree::Customer.update(
|
@@ -1485,8 +1602,8 @@ describe Braintree::Customer do
|
|
1485
1602
|
:cardholder_name => "New Joe Cardholder",
|
1486
1603
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1487
1604
|
:expiration_date => "12/2009",
|
1488
|
-
:options => {
|
1489
|
-
}
|
1605
|
+
:options => {:verify_card => true, :verification_currency_iso_code => "GBP"}
|
1606
|
+
},
|
1490
1607
|
)
|
1491
1608
|
result.success?.should == false
|
1492
1609
|
expect(result.errors.for(:customer).for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code).to eq Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
|
@@ -1495,7 +1612,7 @@ describe Braintree::Customer do
|
|
1495
1612
|
|
1496
1613
|
it "throws error due to verification_currency_iso_code not matching against the currency configured in the given verification merchant account" do
|
1497
1614
|
customer = Braintree::Customer.create!(
|
1498
|
-
:first_name => "Joe"
|
1615
|
+
:first_name => "Joe",
|
1499
1616
|
)
|
1500
1617
|
|
1501
1618
|
result = Braintree::Customer.update(
|
@@ -1505,8 +1622,8 @@ describe Braintree::Customer do
|
|
1505
1622
|
:cardholder_name => "New Joe Cardholder",
|
1506
1623
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1507
1624
|
:expiration_date => "12/2009",
|
1508
|
-
:options => {
|
1509
|
-
}
|
1625
|
+
:options => {:verify_card => true, :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId, :verification_currency_iso_code => "GBP"}
|
1626
|
+
},
|
1510
1627
|
)
|
1511
1628
|
result.success?.should == false
|
1512
1629
|
expect(result.errors.for(:customer).for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code).to eq Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
|
@@ -1529,7 +1646,7 @@ describe Braintree::Customer do
|
|
1529
1646
|
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
1530
1647
|
:verification_account_type => "credit",
|
1531
1648
|
},
|
1532
|
-
}
|
1649
|
+
},
|
1533
1650
|
)
|
1534
1651
|
expect(update_result).to be_success
|
1535
1652
|
end
|
@@ -1548,7 +1665,7 @@ describe Braintree::Customer do
|
|
1548
1665
|
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
1549
1666
|
:verification_account_type => "debit",
|
1550
1667
|
},
|
1551
|
-
}
|
1668
|
+
},
|
1552
1669
|
)
|
1553
1670
|
expect(update_result).to be_success
|
1554
1671
|
end
|
@@ -1559,12 +1676,12 @@ describe Braintree::Customer do
|
|
1559
1676
|
it "returns the updated customer if successful" do
|
1560
1677
|
customer = Braintree::Customer.create!(
|
1561
1678
|
:first_name => "Joe",
|
1562
|
-
:last_name => "Cool"
|
1679
|
+
:last_name => "Cool",
|
1563
1680
|
)
|
1564
1681
|
updated_customer = Braintree::Customer.update!(
|
1565
1682
|
customer.id,
|
1566
1683
|
:first_name => "Mr. Joe",
|
1567
|
-
:last_name => "Super Cool"
|
1684
|
+
:last_name => "Super Cool",
|
1568
1685
|
)
|
1569
1686
|
updated_customer.first_name.should == "Mr. Joe"
|
1570
1687
|
updated_customer.last_name.should == "Super Cool"
|
@@ -1588,7 +1705,7 @@ describe Braintree::Customer do
|
|
1588
1705
|
:options => {
|
1589
1706
|
:make_default => false
|
1590
1707
|
}
|
1591
|
-
}
|
1708
|
+
},
|
1592
1709
|
)
|
1593
1710
|
|
1594
1711
|
default_payment_method = Braintree::CreditCard.create!(
|
@@ -1597,7 +1714,7 @@ describe Braintree::Customer do
|
|
1597
1714
|
:expiration_date => "11/2015",
|
1598
1715
|
:options => {
|
1599
1716
|
:make_default => true
|
1600
|
-
}
|
1717
|
+
},
|
1601
1718
|
)
|
1602
1719
|
|
1603
1720
|
customer = Braintree::Customer.find(customer.id)
|
@@ -1610,7 +1727,7 @@ describe Braintree::Customer do
|
|
1610
1727
|
context "future" do
|
1611
1728
|
it "creates a customer with a future paypal account" do
|
1612
1729
|
result = Braintree::Customer.create(
|
1613
|
-
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment
|
1730
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
1614
1731
|
)
|
1615
1732
|
|
1616
1733
|
result.should be_success
|
@@ -1624,7 +1741,7 @@ describe Braintree::Customer do
|
|
1624
1741
|
:options => {
|
1625
1742
|
:make_default => true
|
1626
1743
|
}
|
1627
|
-
}
|
1744
|
+
},
|
1628
1745
|
)
|
1629
1746
|
|
1630
1747
|
paypal_account_token = "PAYPAL_ACCOUNT_TOKEN_#{rand(36**3).to_s(36)}"
|
@@ -1633,12 +1750,12 @@ describe Braintree::Customer do
|
|
1633
1750
|
:token => paypal_account_token,
|
1634
1751
|
:options => {
|
1635
1752
|
:make_default => true
|
1636
|
-
}
|
1753
|
+
},
|
1637
1754
|
)
|
1638
1755
|
|
1639
1756
|
result = Braintree::Customer.update(
|
1640
1757
|
customer.id,
|
1641
|
-
:payment_method_nonce => nonce
|
1758
|
+
:payment_method_nonce => nonce,
|
1642
1759
|
)
|
1643
1760
|
|
1644
1761
|
result.should be_success
|
@@ -1654,7 +1771,7 @@ describe Braintree::Customer do
|
|
1654
1771
|
:token => paypal_account_token,
|
1655
1772
|
:options => {
|
1656
1773
|
:make_default => true
|
1657
|
-
}
|
1774
|
+
},
|
1658
1775
|
)
|
1659
1776
|
|
1660
1777
|
result = Braintree::Customer.create(
|
@@ -1690,7 +1807,7 @@ describe Braintree::Customer do
|
|
1690
1807
|
:options => {
|
1691
1808
|
:make_default => true
|
1692
1809
|
}
|
1693
|
-
}
|
1810
|
+
},
|
1694
1811
|
)
|
1695
1812
|
|
1696
1813
|
paypal_account_token = "PAYPAL_ACCOUNT_TOKEN_#{rand(36**3).to_s(36)}"
|
@@ -1699,7 +1816,7 @@ describe Braintree::Customer do
|
|
1699
1816
|
:token => paypal_account_token,
|
1700
1817
|
:options => {
|
1701
1818
|
:make_default => true
|
1702
|
-
}
|
1819
|
+
},
|
1703
1820
|
)
|
1704
1821
|
|
1705
1822
|
result = Braintree::Customer.update(
|
@@ -1733,7 +1850,7 @@ describe Braintree::Customer do
|
|
1733
1850
|
context "onetime" do
|
1734
1851
|
it "does not create a customer with a onetime paypal account" do
|
1735
1852
|
result = Braintree::Customer.create(
|
1736
|
-
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment
|
1853
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalOneTimePayment,
|
1737
1854
|
)
|
1738
1855
|
|
1739
1856
|
result.should_not be_success
|
@@ -1749,7 +1866,7 @@ describe Braintree::Customer do
|
|
1749
1866
|
:options => {
|
1750
1867
|
:make_default => true
|
1751
1868
|
}
|
1752
|
-
}
|
1869
|
+
},
|
1753
1870
|
)
|
1754
1871
|
|
1755
1872
|
paypal_account_token = "PAYPAL_ACCOUNT_TOKEN_#{rand(36**3).to_s(36)}"
|
@@ -1758,12 +1875,12 @@ describe Braintree::Customer do
|
|
1758
1875
|
:token => paypal_account_token,
|
1759
1876
|
:options => {
|
1760
1877
|
:make_default => true
|
1761
|
-
}
|
1878
|
+
},
|
1762
1879
|
)
|
1763
1880
|
|
1764
1881
|
result = Braintree::Customer.update(
|
1765
1882
|
customer.id,
|
1766
|
-
:payment_method_nonce => nonce
|
1883
|
+
:payment_method_nonce => nonce,
|
1767
1884
|
)
|
1768
1885
|
|
1769
1886
|
result.should_not be_success
|