braintree 4.20.0 → 4.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/address.rb +1 -0
  3. data/lib/braintree/address_gateway.rb +3 -2
  4. data/lib/braintree/configuration.rb +1 -1
  5. data/lib/braintree/credit_card_verification.rb +16 -12
  6. data/lib/braintree/customer.rb +3 -2
  7. data/lib/braintree/customer_gateway.rb +6 -2
  8. data/lib/braintree/error_codes.rb +4 -0
  9. data/lib/braintree/local_payment_completed.rb +4 -1
  10. data/lib/braintree/paypal_account.rb +2 -0
  11. data/lib/braintree/transaction/address_details.rb +1 -0
  12. data/lib/braintree/transaction/customer_details.rb +2 -1
  13. data/lib/braintree/transaction/package_details.rb +4 -1
  14. data/lib/braintree/transaction.rb +2 -0
  15. data/lib/braintree/transaction_gateway.rb +55 -47
  16. data/lib/braintree/version.rb +1 -1
  17. data/lib/braintree/webhook_notification.rb +2 -0
  18. data/lib/braintree/webhook_testing_gateway.rb +22 -1
  19. data/spec/integration/braintree/address_spec.rb +6 -0
  20. data/spec/integration/braintree/apple_pay_spec.rb +1 -1
  21. data/spec/integration/braintree/credit_card_verification_spec.rb +19 -0
  22. data/spec/integration/braintree/customer_spec.rb +6 -0
  23. data/spec/integration/braintree/merchant_account_spec.rb +2 -2
  24. data/spec/integration/braintree/merchant_spec.rb +17 -138
  25. data/spec/integration/braintree/package_tracking_spec.rb +34 -15
  26. data/spec/integration/braintree/payment_method_spec.rb +7 -1
  27. data/spec/integration/braintree/paypal_account_spec.rb +2 -0
  28. data/spec/integration/braintree/transaction_spec.rb +140 -1
  29. data/spec/unit/braintree/configuration_spec.rb +1 -1
  30. data/spec/unit/braintree/credit_card_spec.rb +2 -0
  31. data/spec/unit/braintree/credit_card_verification_spec.rb +13 -2
  32. data/spec/unit/braintree/customer_spec.rb +8 -0
  33. data/spec/unit/braintree/error_result_spec.rb +1 -1
  34. data/spec/unit/braintree/local_payment_completed_spec.rb +17 -5
  35. data/spec/unit/braintree/package_tracking_spec.rb +5 -2
  36. data/spec/unit/braintree/paypal_account_spec.rb +9 -0
  37. data/spec/unit/braintree/transaction/customer_details_spec.rb +2 -1
  38. data/spec/unit/braintree/transaction_gateway_spec.rb +54 -48
  39. data/spec/unit/braintree/webhook_notification_spec.rb +12 -0
  40. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5738048bf9abc767f859d8f10d42baa075a3f5986dca2a1fe6bb86b744a2a29a
4
- data.tar.gz: 994d4b0dce9d1d6da5cbf929cb4debd0460b85087396c6400ca854af3c5fb882
3
+ metadata.gz: 3eefd7e093c28bf6167e2147719c79ddfde8823a01d2a5941d3b88b7ddb7b001
4
+ data.tar.gz: b61191ffd282fad509d02061f26f4fd61bdead52eaa33a11c165cc32cde8e9c9
5
5
  SHA512:
6
- metadata.gz: 96280a78f3e0fbabdbf95f950ca6bd417c7ab02c10e23169cb3a9b829dddc59b125fbb36d6164ef108a52aaba199b5677e1e9c3f2c95e8e6e4e1468ec6ce10b8
7
- data.tar.gz: 1a9ca31d02662aaa179da5e2031bf096ecebcdef55d0f9a514cb20693d44c378933f6430ae95cc395b57da0e7b026221ee2ac0ba9061142b595db866437a5db9
6
+ metadata.gz: 80b27a7c007729e9236d3f8b3ececb6eb89c207e2954bfad63d225d28e2984054b36c3f3193f8ee65596471b2682ddf72c10dfac25651288709142238c73e3da
7
+ data.tar.gz: b7bece4ac524d149d38bb311bb125a56b6b80d2198218bdabbbf993a5a7208bc1d35e9d863ea6b63ca002409a35fde7e47793f6471daea6b3aa5d0202d12fc8e
@@ -12,6 +12,7 @@ module Braintree
12
12
  attr_reader :extended_address
13
13
  attr_reader :first_name
14
14
  attr_reader :id
15
+ attr_reader :international_phone
15
16
  attr_reader :last_name
16
17
  attr_reader :locality
17
18
  attr_reader :phone_number
@@ -76,8 +76,9 @@ module Braintree
76
76
 
77
77
  def self._shared_signature
78
78
  [:company, :country_code_alpha2, :country_code_alpha3, :country_code_numeric,
79
- :country_name, :extended_address, :first_name, :last_name, :locality, :phone_number,
80
- :postal_code, :region, :street_address]
79
+ :country_name, :extended_address, :first_name,
80
+ {:international_phone => [:country_code, :national_number]},
81
+ :last_name, :locality, :phone_number, :postal_code, :region, :street_address]
81
82
  end
82
83
 
83
84
  def self._update_signature
@@ -239,7 +239,7 @@ module Braintree
239
239
  when :production
240
240
  "#{endpoint}.braintreegateway.com"
241
241
  when :qa
242
- "gateway.qa.braintreepayments.com"
242
+ "gateway.qa2.braintreepayments.com"
243
243
  when :sandbox
244
244
  "api.sandbox.braintreegateway.com"
245
245
  end
@@ -26,6 +26,8 @@ module Braintree
26
26
  end
27
27
 
28
28
  attr_reader :amount
29
+ attr_reader :ani_first_name_response_code
30
+ attr_reader :ani_last_name_response_code
29
31
  attr_reader :avs_error_response_code
30
32
  attr_reader :avs_postal_code_response_code
31
33
  attr_reader :avs_street_address_response_code
@@ -45,8 +47,8 @@ module Braintree
45
47
  attr_reader :processor_response_text
46
48
  attr_reader :processor_response_type
47
49
  attr_reader :risk_data
48
- attr_reader :three_d_secure_info
49
50
  attr_reader :status
51
+ attr_reader :three_d_secure_info
50
52
 
51
53
  def initialize(attributes)
52
54
  set_instance_variables_from_hash(attributes)
@@ -59,23 +61,25 @@ module Braintree
59
61
 
60
62
  def inspect
61
63
  attr_order = [
62
- :status,
63
- :processor_response_code,
64
- :processor_response_text,
65
64
  :amount,
66
- :currency_iso_code,
67
- :cvv_response_code,
65
+ :ani_first_name_response_code,
66
+ :ani_last_name_response_code,
68
67
  :avs_error_response_code,
69
68
  :avs_postal_code_response_code,
70
69
  :avs_street_address_response_code,
71
- :network_response_code,
72
- :network_response_text,
73
- :merchant_account_id,
70
+ :billing,
71
+ :created_at,
72
+ :credit_card,
73
+ :currency_iso_code,
74
+ :cvv_response_code,
74
75
  :gateway_rejection_reason,
75
76
  :id,
76
- :credit_card,
77
- :billing,
78
- :created_at
77
+ :merchant_account_id,
78
+ :network_response_code,
79
+ :network_response_text,
80
+ :processor_response_code,
81
+ :processor_response_text,
82
+ :status
79
83
  ]
80
84
  formatted_attrs = attr_order.map do |attr|
81
85
  if attr == :amount
@@ -15,6 +15,7 @@ module Braintree
15
15
  attr_reader :google_pay_cards
16
16
  attr_reader :graphql_id
17
17
  attr_reader :id
18
+ attr_reader :international_phone
18
19
  attr_reader :last_name
19
20
  attr_reader :paypal_accounts
20
21
  attr_reader :phone
@@ -148,8 +149,8 @@ module Braintree
148
149
 
149
150
  def self._attributes
150
151
  [
151
- :addresses, :company, :credit_cards, :email, :fax, :first_name, :id, :last_name, :phone, :website,
152
- :created_at, :updated_at, :tax_identifiers
152
+ :addresses, :company, :credit_cards, :email, :fax, :first_name, :id, :international_phone,
153
+ :last_name, :phone, :website, :created_at, :updated_at, :tax_identifiers
153
154
  ]
154
155
  end
155
156
 
@@ -75,7 +75,9 @@ module Braintree
75
75
  ],
76
76
  ]
77
77
  [
78
- :company, :email, :fax, :first_name, :id, :last_name, :phone, :website,
78
+ :company, :email, :fax, :first_name, :id,
79
+ {:international_phone => [:country_code, :national_number]},
80
+ :last_name, :phone, :website,
79
81
  :device_data, :payment_method_nonce,
80
82
  {:risk_data => [:customer_browser, :customer_ip]},
81
83
  {:credit_card => credit_card_signature},
@@ -139,7 +141,9 @@ module Braintree
139
141
  ],
140
142
  ]
141
143
  [
142
- :company, :email, :fax, :first_name, :id, :last_name, :phone, :website,
144
+ :company, :email, :fax, :first_name, :id,
145
+ {:international_phone => [:country_code, :national_number]},
146
+ :last_name, :phone, :website,
143
147
  :device_data, :payment_method_nonce, :default_payment_method_token,
144
148
  {:credit_card => credit_card_signature},
145
149
  {:tax_identifiers => [:country_code, :identifier]},
@@ -185,6 +185,10 @@ module Braintree
185
185
  KindIsInvalid = "84901"
186
186
  end
187
187
 
188
+ module GooglePayCard
189
+ AndroidPayCardsAreNotAccepted = "83708"
190
+ end
191
+
188
192
  module PayPalAccount
189
193
  AuthExpired = "92911"
190
194
  CannotHaveBothAccessTokenAndConsentCode = "82903"
@@ -2,8 +2,11 @@ module Braintree
2
2
  class LocalPaymentCompleted
3
3
  include BaseModule
4
4
 
5
- attr_reader :payment_id
5
+ attr_reader :bic
6
+ attr_reader :iban_last_chars
6
7
  attr_reader :payer_id
8
+ attr_reader :payer_name
9
+ attr_reader :payment_id
7
10
  attr_reader :payment_method_nonce
8
11
  attr_reader :transaction
9
12
 
@@ -5,7 +5,9 @@ module Braintree
5
5
  attr_reader :billing_agreement_id
6
6
  attr_reader :created_at
7
7
  attr_reader :customer_id
8
+ attr_reader :edit_paypal_vault_id
8
9
  attr_reader :email
10
+ attr_reader :funding_source_description
9
11
  attr_reader :image_url
10
12
  attr_reader :payer_id
11
13
  attr_reader :revoked_at
@@ -21,6 +21,7 @@ module Braintree
21
21
  attr_reader :extended_address
22
22
  attr_reader :first_name
23
23
  attr_reader :id
24
+ attr_reader :international_phone
24
25
  attr_reader :last_name
25
26
  attr_reader :locality
26
27
  attr_reader :phone_number
@@ -8,6 +8,7 @@ module Braintree
8
8
  attr_reader :fax
9
9
  attr_reader :first_name
10
10
  attr_reader :id
11
+ attr_reader :international_phone
11
12
  attr_reader :last_name
12
13
  attr_reader :phone
13
14
  attr_reader :website
@@ -17,7 +18,7 @@ module Braintree
17
18
  end
18
19
 
19
20
  def inspect
20
- attr_order = [:id, :first_name, :last_name, :email, :company, :website, :phone, :fax]
21
+ attr_order = [:id, :first_name, :last_name, :email, :company, :website, :phone, :international_phone, :fax]
21
22
  formatted_attrs = attr_order.map do |attr|
22
23
  "#{attr}: #{send(attr).inspect}"
23
24
  end
@@ -5,11 +5,14 @@ module Braintree
5
5
 
6
6
  attr_reader :carrier
7
7
  attr_reader :id
8
+ # NEXT_MAJOR_VERSION Remove this method
9
+ # use paypal_tracker_id going forward
8
10
  attr_reader :paypal_tracking_id
11
+ attr_reader :paypal_tracker_id
9
12
  attr_reader :tracking_number
10
13
 
11
14
  def initialize(attributes)
12
- set_instance_variables_from_hash attributes unless attributes.nil?
15
+ set_instance_variables_from_hash attributes unless attributes.nil?
13
16
  end
14
17
  end
15
18
  end
@@ -121,6 +121,7 @@ module Braintree
121
121
  attr_reader :escrow_status
122
122
  attr_reader :facilitated_details
123
123
  attr_reader :facilitator_details
124
+ attr_reader :foreign_retailer
124
125
  attr_reader :gateway_rejection_reason
125
126
  attr_reader :google_pay_details
126
127
  attr_reader :graphql_id
@@ -170,6 +171,7 @@ module Braintree
170
171
  attr_reader :settlement_batch_id
171
172
  attr_reader :shipping_amount
172
173
  attr_reader :shipping_details
174
+ attr_reader :shipping_tax_amount
173
175
  attr_reader :ships_from_postal_code
174
176
  attr_reader :status # See Transaction::Status
175
177
  attr_reader :status_history
@@ -178,7 +178,7 @@ module Braintree
178
178
 
179
179
  def submit_for_partial_settlement(authorized_transaction_id, amount = nil, options = {})
180
180
  raise ArgumentError, "authorized_transaction_id is invalid" unless authorized_transaction_id =~ /\A[0-9a-z]+\z/
181
- Util.verify_keys(TransactionGateway._submit_for_settlement_signature, options)
181
+ Util.verify_keys(TransactionGateway._submit_for_partial_settlement_signature, options)
182
182
  transaction_params = {:amount => amount}.merge(options)
183
183
  response = @config.http.post("#{@config.base_merchant_path}/transactions/#{authorized_transaction_id}/submit_for_partial_settlement", :transaction => transaction_params)
184
184
  _handle_transaction_response(response)
@@ -214,36 +214,45 @@ module Braintree
214
214
  # three_d_secure_token has been deprecated in favor of three_d_secure_authentication_id
215
215
  def self._create_signature
216
216
  [
217
- :amount, :billing_address_id, :channel, :customer_id, :device_data, :discount_amount,
217
+ :amount, :billing_address_id, :channel, :currency_iso_code, :customer_id, :device_data,
218
+ :discount_amount, :exchange_rate_quote_id, :foreign_retailer,
218
219
  :merchant_account_id, :order_id, :payment_method_nonce, :payment_method_token,
219
220
  :product_sku, :purchase_order_number, :service_fee_amount, :shared_billing_address_id,
220
221
  :shared_customer_id, :shared_payment_method_nonce, :shared_payment_method_token,
221
- :shared_shipping_address_id, :shipping_address_id, :shipping_amount,
222
+ :shared_shipping_address_id, :shipping_address_id, :shipping_amount, :shipping_tax_amount,
222
223
  :ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,:three_d_secure_token, #Deprecated
223
224
  :transaction_source, :type, :venmo_sdk_payment_method_code, # Deprecated
224
- :sca_exemption, :currency_iso_code, :exchange_rate_quote_id,
225
- {:line_items => [:commodity_code, :description, :discount_amount, :image_url, :kind, :name, :product_code, :quantity, :tax_amount, :total_amount, :unit_amount, :unit_of_measure, :unit_tax_amount, :upc_code, :upc_type, :url]},
226
- {:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
227
- {:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number, {:payment_reader_card_details => [:encrypted_card_data, :key_serial_number]}, {:network_tokenization_attributes => [:cryptogram, :ecommerce_indicator, :token_requestor_id]}]},
228
- {:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
225
+ :sca_exemption,
226
+ {:apple_pay_card => [:number, :cardholder_name, :cryptogram, :expiration_month, :expiration_year, :eci_indicator]},
229
227
  {
230
228
  :billing => AddressGateway._shared_signature
231
229
  },
232
- {
233
- :shipping => AddressGateway._shared_signature + [:shipping_method],
234
- },
235
- {
236
- :three_d_secure_pass_thru => [
237
- :eci_flag,
238
- :cavv,
239
- :xid,
240
- :three_d_secure_version,
241
- :authentication_response,
242
- :directory_response,
243
- :cavv_algorithm,
244
- :ds_transaction_id,
245
- ]
246
- },
230
+ {:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number, {:payment_reader_card_details => [:encrypted_card_data, :key_serial_number]}, {:network_tokenization_attributes => [:cryptogram, :ecommerce_indicator, :token_requestor_id]}]},
231
+ {:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
232
+ {:custom_fields => :_any_key_},
233
+ {:descriptor => [:name, :phone, :url]},
234
+ {:external_vault => [
235
+ :status,
236
+ :previous_network_transaction_id,
237
+ ]},
238
+ {:google_pay_card => [:number, :cryptogram, :google_transaction_id, :expiration_month, :expiration_year, :source_card_type, :source_card_last_four, :eci_indicator]},
239
+ {:industry => [
240
+ :industry_type,
241
+ {:data => [
242
+ :country_code, :date_of_birth, :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
243
+ :passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
244
+ :issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
245
+ {:legs => [
246
+ :conjunction_ticket, :exchange_ticket, :coupon_number, :service_class, :carrier_code, :fare_basis_code, :flight_number, :departure_date, :departure_airport_code, :departure_time,
247
+ :arrival_airport_code, :arrival_time, :stopover_permitted, :fare_amount, :fee_amount, :tax_amount, :endorsement_or_restrictions,
248
+ ]},
249
+ {:additional_charges => [
250
+ :kind, :amount,
251
+ ]},
252
+ ]},
253
+ ]},
254
+ {:installments => [:count]},
255
+ {:line_items => [:commodity_code, :description, :discount_amount, :image_url, :kind, :name, :product_code, :quantity, :tax_amount, :total_amount, :unit_amount, :unit_of_measure, :unit_tax_amount, :upc_code, :upc_type, :url]},
247
256
  {:options => [
248
257
  :hold_in_escrow,
249
258
  :store_in_vault,
@@ -265,31 +274,23 @@ module Braintree
265
274
  {:credit_card => [:account_type, :process_debit_as_credit]},
266
275
  ]
267
276
  },
268
- {:external_vault => [
269
- :status,
270
- :previous_network_transaction_id,
271
- ]},
272
- {:custom_fields => :_any_key_},
273
- {:descriptor => [:name, :phone, :url]},
274
277
  {:paypal_account => [:email, :token, :paypal_data, :payee_id, :payee_email, :payer_id, :payment_id]},
275
- {:industry => [
276
- :industry_type,
277
- {:data => [
278
- :country_code, :date_of_birth, :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
279
- :passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
280
- :issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
281
- {:legs => [
282
- :conjunction_ticket, :exchange_ticket, :coupon_number, :service_class, :carrier_code, :fare_basis_code, :flight_number, :departure_date, :departure_airport_code, :departure_time,
283
- :arrival_airport_code, :arrival_time, :stopover_permitted, :fare_amount, :fee_amount, :tax_amount, :endorsement_or_restrictions,
284
- ]},
285
- {:additional_charges => [
286
- :kind, :amount,
287
- ]},
288
- ]},
289
- ]},
290
- {:apple_pay_card => [:number, :cardholder_name, :cryptogram, :expiration_month, :expiration_year, :eci_indicator]},
291
- {:google_pay_card => [:number, :cryptogram, :google_transaction_id, :expiration_month, :expiration_year, :source_card_type, :source_card_last_four, :eci_indicator]},
292
- {:installments => [:count]},
278
+ {:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
279
+ {
280
+ :shipping => AddressGateway._shared_signature + [:shipping_method],
281
+ },
282
+ {
283
+ :three_d_secure_pass_thru => [
284
+ :eci_flag,
285
+ :cavv,
286
+ :xid,
287
+ :three_d_secure_version,
288
+ :authentication_response,
289
+ :directory_response,
290
+ :cavv_algorithm,
291
+ :ds_transaction_id,
292
+ ]
293
+ },
293
294
  ]
294
295
  end
295
296
 
@@ -317,11 +318,18 @@ module Braintree
317
318
  :tax_exempt,
318
319
  :discount_amount,
319
320
  :shipping_amount,
321
+ :shipping_tax_amount,
320
322
  :ships_from_postal_code,
321
323
  :line_items => [:commodity_code, :description, :discount_amount, :image_url, :kind, :name, :product_code, :quantity, :tax_amount, :total_amount, :unit_amount, :unit_of_measure, :unit_tax_amount, :upc_code, :upc_type, :url],
322
324
  ]
323
325
  end
324
326
 
327
+ def self._submit_for_partial_settlement_signature
328
+ _submit_for_settlement_signature + [
329
+ :final_capture
330
+ ]
331
+ end
332
+
325
333
  def self._adjust_authorization_signature
326
334
  [
327
335
  :amount
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 20
4
+ Minor = 22
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -46,6 +46,8 @@ module Braintree
46
46
 
47
47
  RecipientUpdatedGrantedPaymentMethod = "recipient_updated_granted_payment_method"
48
48
 
49
+ RefundFailed = "refund_failed"
50
+
49
51
  SubscriptionBillingSkipped = "subscription_billing_skipped"
50
52
  SubscriptionCanceled = "subscription_canceled"
51
53
  SubscriptionChargedSuccessfully = "subscription_charged_successfully"
@@ -104,6 +104,8 @@ module Braintree
104
104
  _local_payment_reversed_sample_xml
105
105
  when Braintree::WebhookNotification::Kind::PaymentMethodCustomerDataUpdated
106
106
  _payment_method_customer_data_updated_sample_xml(id)
107
+ when Braintree::WebhookNotification::Kind::RefundFailed
108
+ _refund_failed_sample_xml(id)
107
109
  else
108
110
  _subscription_sample_xml(id)
109
111
  end
@@ -1094,8 +1096,11 @@ module Braintree
1094
1096
  def _local_payment_completed_sample_xml(id)
1095
1097
  <<-XML
1096
1098
  <local-payment>
1097
- <payment-id>PAY-XYZ123</payment-id>
1099
+ <bic>BIC</bic>
1100
+ <iban_last_chars>1234</iban_last_chars>
1098
1101
  <payer-id>ABCPAYER</payer-id>
1102
+ <payer-name>PAYERNAME</payer-name>
1103
+ <payment-id>PAY-XYZ123</payment-id>
1099
1104
  <payment-method-nonce>ee257d98-de40-47e8-96b3-a6954ea7a9a4</payment-method-nonce>
1100
1105
  <transaction>
1101
1106
  <id>#{id}</id>
@@ -1181,5 +1186,21 @@ module Braintree
1181
1186
  </venmo-account>
1182
1187
  XML
1183
1188
  end
1189
+
1190
+ def _refund_failed_sample_xml(id)
1191
+ <<-XML
1192
+ <transaction>
1193
+ <id>#{id}</id>
1194
+ <amount>100</amount>
1195
+ <credit-card>
1196
+ <number>1234560000001234</number>
1197
+ <cvv>123</cvv>
1198
+ <card-type>MasterCard</card-type>
1199
+ </credit-card>
1200
+ <status>processor_declined</status>
1201
+ <refunded-transaction-id>1</refunded-transaction-id>
1202
+ </transaction>
1203
+ XML
1204
+ end
1184
1205
  end
1185
1206
  end
@@ -15,6 +15,7 @@ describe Braintree::Address do
15
15
  :locality => "Chicago",
16
16
  :region => "Illinois",
17
17
  :phone_number => "5551231234",
18
+ :international_phone => {:country_code => "1", :national_number => "3121234567"},
18
19
  :postal_code => "60622",
19
20
  :country_name => "United States of America",
20
21
  )
@@ -28,6 +29,8 @@ describe Braintree::Address do
28
29
  expect(result.address.locality).to eq("Chicago")
29
30
  expect(result.address.region).to eq("Illinois")
30
31
  expect(result.address.phone_number).to eq("5551231234")
32
+ expect(result.address.international_phone[:country_code]).to eq("1")
33
+ expect(result.address.international_phone[:national_number]).to eq("3121234567")
31
34
  expect(result.address.postal_code).to eq("60622")
32
35
  expect(result.address.country_name).to eq("United States of America")
33
36
  expect(result.address.country_code_alpha2).to eq("US")
@@ -241,6 +244,7 @@ describe Braintree::Address do
241
244
  :region => "Illinois",
242
245
  :postal_code => "60621",
243
246
  :country_name => "United States of America",
247
+ :international_phone => {:country_code => "1", :national_number => "3121234567"},
244
248
  )
245
249
  expect(result.success?).to eq(true)
246
250
  expect(result.address.street_address).to eq("123 E New St")
@@ -252,6 +256,8 @@ describe Braintree::Address do
252
256
  expect(result.address.country_code_alpha2).to eq("US")
253
257
  expect(result.address.country_code_alpha3).to eq("USA")
254
258
  expect(result.address.country_code_numeric).to eq("840")
259
+ expect(result.address.international_phone[:country_code]).to eq("1")
260
+ expect(result.address.international_phone[:national_number]).to eq("3121234567")
255
261
  end
256
262
 
257
263
  it "accepts country_codes" do
@@ -10,7 +10,7 @@ describe Braintree::ApplePayGateway do
10
10
 
11
11
  result = gateway.merchant.create(
12
12
  :email => "name@email.com",
13
- :country_code_alpha3 => "USA",
13
+ :country_code_alpha3 => "GBR",
14
14
  :payment_methods => ["credit_card", "paypal"],
15
15
  )
16
16
 
@@ -48,6 +48,25 @@ describe Braintree::CreditCardVerification, "search" do
48
48
  expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
49
49
  end
50
50
 
51
+ it "creates a new verification for Visa ANI" do
52
+ verification_params = {
53
+ :credit_card => {
54
+ :expiration_date => "05/2012",
55
+ :number => Braintree::Test::CreditCardNumbers::Visa,
56
+ },
57
+ }
58
+
59
+ result = Braintree::CreditCardVerification.create(verification_params)
60
+
61
+ expect(result).to be_success
62
+ expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::Verified)
63
+ expect(result.credit_card_verification.processor_response_code).to eq("1000")
64
+ expect(result.credit_card_verification.processor_response_text).to eq("Approved")
65
+ expect(result.credit_card_verification.ani_first_name_response_code).to eq("I")
66
+ expect(result.credit_card_verification.ani_last_name_response_code).to eq("I")
67
+ expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
68
+ end
69
+
51
70
  it "creates a new verification from external vault param" do
52
71
  verification_params = {
53
72
  :credit_card => {
@@ -38,6 +38,7 @@ describe Braintree::Customer do
38
38
  :company => "Microsoft",
39
39
  :email => "bill@microsoft.com",
40
40
  :phone => "312.555.1234",
41
+ :international_phone => {:country_code => "1", :national_number => "3121234567"},
41
42
  :fax => "614.555.5678",
42
43
  :website => "www.microsoft.com",
43
44
  :tax_identifiers => [{:country_code => "US", :identifier => "987654321"}],
@@ -49,6 +50,8 @@ describe Braintree::Customer do
49
50
  expect(result.customer.company).to eq("Microsoft")
50
51
  expect(result.customer.email).to eq("bill@microsoft.com")
51
52
  expect(result.customer.phone).to eq("312.555.1234")
53
+ expect(result.customer.international_phone[:country_code]).to eq("1")
54
+ expect(result.customer.international_phone[:national_number]).to eq("3121234567")
52
55
  expect(result.customer.fax).to eq("614.555.5678")
53
56
  expect(result.customer.website).to eq("www.microsoft.com")
54
57
  expect(result.customer.created_at.between?(Time.now - 10, Time.now)).to eq(true)
@@ -1193,6 +1196,7 @@ describe Braintree::Customer do
1193
1196
  customer.id,
1194
1197
  :first_name => "Mr. Joe",
1195
1198
  :last_name => "Super Cool",
1199
+ :international_phone => {:country_code => "1", :national_number => "3121234567"},
1196
1200
  :custom_fields => {
1197
1201
  :store_me => "a value"
1198
1202
  },
@@ -1201,6 +1205,8 @@ describe Braintree::Customer do
1201
1205
  expect(result.customer.id).to eq(customer.id)
1202
1206
  expect(result.customer.first_name).to eq("Mr. Joe")
1203
1207
  expect(result.customer.last_name).to eq("Super Cool")
1208
+ expect(result.customer.international_phone[:country_code]).to eq("1")
1209
+ expect(result.customer.international_phone[:national_number]).to eq("3121234567")
1204
1210
  expect(result.customer.custom_fields[:store_me]).to eq("a value")
1205
1211
  end
1206
1212
 
@@ -97,7 +97,7 @@ describe Braintree::MerchantAccount do
97
97
 
98
98
  result = gateway.merchant.create(
99
99
  :email => "name@email.com",
100
- :country_code_alpha3 => "USA",
100
+ :country_code_alpha3 => "GBR",
101
101
  :payment_methods => ["credit_card", "paypal"],
102
102
  )
103
103
 
@@ -109,7 +109,7 @@ describe Braintree::MerchantAccount do
109
109
  result = gateway.merchant_account.all
110
110
  expect(result).to be_success
111
111
  expect(result.merchant_accounts.count).to eq(1)
112
- expect(result.merchant_accounts.first.currency_iso_code).to eq("USD")
112
+ expect(result.merchant_accounts.first.currency_iso_code).to eq("GBP")
113
113
  expect(result.merchant_accounts.first.status).to eq("active")
114
114
  expect(result.merchant_accounts.first.default).to eq(true)
115
115
  end