braintree 4.21.0 → 4.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abb377057ff689e5a04a7a2dbfa201a3243b5008898ab343ec76d02200d4ffba
4
- data.tar.gz: 128bed5617e3793b7353fd10e76dd06afce28143f4ac5def37bc28c4efb07ce4
3
+ metadata.gz: 3eefd7e093c28bf6167e2147719c79ddfde8823a01d2a5941d3b88b7ddb7b001
4
+ data.tar.gz: b61191ffd282fad509d02061f26f4fd61bdead52eaa33a11c165cc32cde8e9c9
5
5
  SHA512:
6
- metadata.gz: 1034c8cb638f8ecd4df2533fb4e22bc21710df5ce5b8c56da4801028b91322dbd0e690108081e7745e1c74c06be7290484872eb5a55f128c23cd3e5fc480bf3c
7
- data.tar.gz: 36f48a290b8ffcfab8467d8b5b582b96d40320cf9929d996d5d703bab0cedaa0d033865c81e9b6434669fb5ca82bee911c591de5c4a9bfe0ced6c0c46fe761cd
6
+ metadata.gz: 80b27a7c007729e9236d3f8b3ececb6eb89c207e2954bfad63d225d28e2984054b36c3f3193f8ee65596471b2682ddf72c10dfac25651288709142238c73e3da
7
+ data.tar.gz: b7bece4ac524d149d38bb311bb125a56b6b80d2198218bdabbbf993a5a7208bc1d35e9d863ea6b63ca002409a35fde7e47793f6471daea6b3aa5d0202d12fc8e
@@ -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
@@ -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,6 +5,7 @@ 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
9
10
  attr_reader :funding_source_description
10
11
  attr_reader :image_url
@@ -171,6 +171,7 @@ module Braintree
171
171
  attr_reader :settlement_batch_id
172
172
  attr_reader :shipping_amount
173
173
  attr_reader :shipping_details
174
+ attr_reader :shipping_tax_amount
174
175
  attr_reader :ships_from_postal_code
175
176
  attr_reader :status # See Transaction::Status
176
177
  attr_reader :status_history
@@ -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, :foreign_retailer,
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,6 +318,7 @@ 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
  ]
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 21
4
+ Minor = 22
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -1096,8 +1096,11 @@ module Braintree
1096
1096
  def _local_payment_completed_sample_xml(id)
1097
1097
  <<-XML
1098
1098
  <local-payment>
1099
- <payment-id>PAY-XYZ123</payment-id>
1099
+ <bic>BIC</bic>
1100
+ <iban_last_chars>1234</iban_last_chars>
1100
1101
  <payer-id>ABCPAYER</payer-id>
1102
+ <payer-name>PAYERNAME</payer-name>
1103
+ <payment-id>PAY-XYZ123</payment-id>
1101
1104
  <payment-method-nonce>ee257d98-de40-47e8-96b3-a6954ea7a9a4</payment-method-nonce>
1102
1105
  <transaction>
1103
1106
  <id>#{id}</id>
@@ -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 => {
@@ -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
@@ -11,7 +11,7 @@ describe Braintree::MerchantGateway do
11
11
 
12
12
  result = gateway.merchant.create(
13
13
  :email => "name@email.com",
14
- :country_code_alpha3 => "USA",
14
+ :country_code_alpha3 => "GBR",
15
15
  :payment_methods => ["credit_card", "paypal"],
16
16
  )
17
17
 
@@ -21,10 +21,10 @@ describe Braintree::MerchantGateway do
21
21
  expect(merchant.id).not_to be_nil
22
22
  expect(merchant.email).to eq("name@email.com")
23
23
  expect(merchant.company_name).to eq("name@email.com")
24
- expect(merchant.country_code_alpha3).to eq("USA")
25
- expect(merchant.country_code_alpha2).to eq("US")
26
- expect(merchant.country_code_numeric).to eq("840")
27
- expect(merchant.country_name).to eq("United States of America")
24
+ expect(merchant.country_code_alpha3).to eq("GBR")
25
+ expect(merchant.country_code_alpha2).to eq("GB")
26
+ expect(merchant.country_code_numeric).to eq("826")
27
+ expect(merchant.country_name).to eq("United Kingdom")
28
28
 
29
29
  credentials = result.credentials
30
30
  expect(credentials.access_token).not_to be_nil
@@ -42,7 +42,7 @@ describe Braintree::MerchantGateway do
42
42
 
43
43
  result = gateway.merchant.create(
44
44
  :email => "name@email.com",
45
- :country_code_alpha3 => "USA",
45
+ :country_code_alpha3 => "GBR",
46
46
  :payment_methods => ["fake_money"],
47
47
  )
48
48
 
@@ -70,7 +70,7 @@ describe Braintree::MerchantGateway do
70
70
  )
71
71
  result = gateway.merchant.create(
72
72
  :email => "name@email.com",
73
- :country_code_alpha3 => "USA",
73
+ :country_code_alpha3 => "GBR",
74
74
  :payment_methods => ["credit_card", "paypal"],
75
75
  )
76
76
 
@@ -81,47 +81,12 @@ describe Braintree::MerchantGateway do
81
81
  context "multiple currencies" do
82
82
  before(:each) do
83
83
  @gateway = Braintree::Gateway.new(
84
- :client_id => "client_id$development$signup_client_id",
85
- :client_secret => "client_secret$development$signup_client_secret",
84
+ :client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
85
+ :client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
86
86
  :logger => Logger.new("/dev/null"),
87
87
  )
88
88
  end
89
89
 
90
- it "creates a US multi currency merchant for paypal and credit_card" do
91
- result = @gateway.merchant.create(
92
- :email => "name@email.com",
93
- :country_code_alpha3 => "USA",
94
- :payment_methods => ["credit_card", "paypal"],
95
- :currencies => ["GBP", "USD"],
96
- )
97
-
98
- merchant = result.merchant
99
- expect(merchant.id).not_to be_nil
100
- expect(merchant.email).to eq("name@email.com")
101
- expect(merchant.company_name).to eq("name@email.com")
102
- expect(merchant.country_code_alpha3).to eq("USA")
103
- expect(merchant.country_code_alpha2).to eq("US")
104
- expect(merchant.country_code_numeric).to eq("840")
105
- expect(merchant.country_name).to eq("United States of America")
106
-
107
- credentials = result.credentials
108
- expect(credentials.access_token).not_to be_nil
109
- expect(credentials.refresh_token).not_to be_nil
110
- expect(credentials.expires_at).not_to be_nil
111
- expect(credentials.token_type).to eq("bearer")
112
-
113
- merchant_accounts = merchant.merchant_accounts
114
- expect(merchant_accounts.count).to eq(2)
115
-
116
- merchant_account = merchant_accounts.detect { |ma| ma.id == "USD" }
117
- expect(merchant_account.default).to eq(true)
118
- expect(merchant_account.currency_iso_code).to eq("USD")
119
-
120
- merchant_account = merchant_accounts.detect { |ma| ma.id == "GBP" }
121
- expect(merchant_account.default).to eq(false)
122
- expect(merchant_account.currency_iso_code).to eq("GBP")
123
- end
124
-
125
90
  it "creates an EU multi currency merchant for paypal and credit_card" do
126
91
  result = @gateway.merchant.create(
127
92
  :email => "name@email.com",
@@ -161,7 +126,7 @@ describe Braintree::MerchantGateway do
161
126
  it "creates a paypal-only merchant that accepts multiple currencies" do
162
127
  result = @gateway.merchant.create(
163
128
  :email => "name@email.com",
164
- :country_code_alpha3 => "USA",
129
+ :country_code_alpha3 => "GBR",
165
130
  :payment_methods => ["paypal"],
166
131
  :currencies => ["GBP", "USD"],
167
132
  :paypal_account => {
@@ -176,10 +141,10 @@ describe Braintree::MerchantGateway do
176
141
  expect(merchant.id).not_to be_nil
177
142
  expect(merchant.email).to eq("name@email.com")
178
143
  expect(merchant.company_name).to eq("name@email.com")
179
- expect(merchant.country_code_alpha3).to eq("USA")
180
- expect(merchant.country_code_alpha2).to eq("US")
181
- expect(merchant.country_code_numeric).to eq("840")
182
- expect(merchant.country_name).to eq("United States of America")
144
+ expect(merchant.country_code_alpha3).to eq("GBR")
145
+ expect(merchant.country_code_alpha2).to eq("GB")
146
+ expect(merchant.country_code_numeric).to eq("826")
147
+ expect(merchant.country_name).to eq("United Kingdom")
183
148
 
184
149
  credentials = result.credentials
185
150
  expect(credentials.access_token).not_to be_nil
@@ -191,90 +156,18 @@ describe Braintree::MerchantGateway do
191
156
  expect(merchant_accounts.count).to eq(2)
192
157
 
193
158
  merchant_account = merchant_accounts.detect { |ma| ma.id == "USD" }
194
- expect(merchant_account.default).to eq(true)
159
+ expect(merchant_account.default).to eq(false)
195
160
  expect(merchant_account.currency_iso_code).to eq("USD")
196
161
 
197
162
  merchant_account = merchant_accounts.detect { |ma| ma.id == "GBP" }
198
- expect(merchant_account.default).to eq(false)
199
- expect(merchant_account.currency_iso_code).to eq("GBP")
200
- end
201
-
202
- it "allows creation of non-US merchant if onboarding application is internal" do
203
- result = @gateway.merchant.create(
204
- :email => "name@email.com",
205
- :country_code_alpha3 => "JPN",
206
- :payment_methods => ["paypal"],
207
- :paypal_account => {
208
- :client_id => "paypal_client_id",
209
- :client_secret => "paypal_client_secret",
210
- },
211
- )
212
-
213
- expect(result).to be_success
214
-
215
- merchant = result.merchant
216
- expect(merchant.id).not_to be_nil
217
- expect(merchant.email).to eq("name@email.com")
218
- expect(merchant.company_name).to eq("name@email.com")
219
- expect(merchant.country_code_alpha3).to eq("JPN")
220
- expect(merchant.country_code_alpha2).to eq("JP")
221
- expect(merchant.country_code_numeric).to eq("392")
222
- expect(merchant.country_name).to eq("Japan")
223
-
224
- credentials = result.credentials
225
- expect(credentials.access_token).not_to be_nil
226
- expect(credentials.refresh_token).not_to be_nil
227
- expect(credentials.expires_at).not_to be_nil
228
- expect(credentials.token_type).to eq("bearer")
229
-
230
- merchant_accounts = merchant.merchant_accounts
231
- expect(merchant_accounts.count).to eq(1)
232
-
233
- merchant_account = merchant_accounts.detect { |ma| ma.id == "JPY" }
234
163
  expect(merchant_account.default).to eq(true)
235
- expect(merchant_account.currency_iso_code).to eq("JPY")
236
- end
237
-
238
- it "defaults to USD for non-US merchant if onboarding application is internal and country currency not supported" do
239
- result = @gateway.merchant.create(
240
- :email => "name@email.com",
241
- :country_code_alpha3 => "YEM",
242
- :payment_methods => ["paypal"],
243
- :paypal_account => {
244
- :client_id => "paypal_client_id",
245
- :client_secret => "paypal_client_secret",
246
- },
247
- )
248
-
249
- expect(result).to be_success
250
-
251
- merchant = result.merchant
252
- expect(merchant.id).not_to be_nil
253
- expect(merchant.email).to eq("name@email.com")
254
- expect(merchant.company_name).to eq("name@email.com")
255
- expect(merchant.country_code_alpha3).to eq("YEM")
256
- expect(merchant.country_code_alpha2).to eq("YE")
257
- expect(merchant.country_code_numeric).to eq("887")
258
- expect(merchant.country_name).to eq("Yemen")
259
-
260
- credentials = result.credentials
261
- expect(credentials.access_token).not_to be_nil
262
- expect(credentials.refresh_token).not_to be_nil
263
- expect(credentials.expires_at).not_to be_nil
264
- expect(credentials.token_type).to eq("bearer")
265
-
266
- merchant_accounts = merchant.merchant_accounts
267
- expect(merchant_accounts.count).to eq(1)
268
-
269
- merchant_account = merchant_accounts.detect { |ma| ma.id == "USD" }
270
- expect(merchant_account.default).to eq(true)
271
- expect(merchant_account.currency_iso_code).to eq("USD")
164
+ expect(merchant_account.currency_iso_code).to eq("GBP")
272
165
  end
273
166
 
274
167
  it "returns error if invalid currency is passed" do
275
168
  result = @gateway.merchant.create(
276
169
  :email => "name@email.com",
277
- :country_code_alpha3 => "USA",
170
+ :country_code_alpha3 => "GBR",
278
171
  :payment_methods => ["paypal"],
279
172
  :currencies => ["FAKE", "GBP"],
280
173
  :paypal_account => {
@@ -317,20 +210,6 @@ describe Braintree::MerchantGateway do
317
210
  end
318
211
  end
319
212
 
320
- context "merchant has no processor connection supporting apple pay" do
321
- before do
322
- Braintree::Configuration.merchant_id = "forward_payment_method_merchant_id"
323
- Braintree::Configuration.public_key = "forward_payment_method_public_key"
324
- Braintree::Configuration.private_key = "forward_payment_method_private_key"
325
- end
326
-
327
- it "returns a validation error" do
328
- result = Braintree::Merchant.provision_raw_apple_pay
329
- expect(result).not_to be_success
330
- expect(result.errors.for(:apple_pay).first.code).to eq(Braintree::ErrorCodes::ApplePay::ApplePayCardsAreNotAccepted)
331
- end
332
- end
333
-
334
213
  def _save_config
335
214
  @original_config = {
336
215
  :merchant_id => Braintree::Configuration.merchant_id,
@@ -26,6 +26,7 @@ describe Braintree::PayPalAccount do
26
26
  expect(paypal_account.updated_at).not_to be_nil
27
27
  expect(paypal_account.customer_id).to eq(customer.id)
28
28
  expect(paypal_account.funding_source_description).to be_nil
29
+ expect(paypal_account.edit_paypal_vault_id).to be_nil
29
30
  expect(paypal_account.revoked_at).to be_nil
30
31
  end
31
32
 
@@ -1153,7 +1153,7 @@ describe Braintree::Transaction do
1153
1153
  )
1154
1154
  result = gateway.merchant.create(
1155
1155
  :email => "name@email.com",
1156
- :country_code_alpha3 => "USA",
1156
+ :country_code_alpha3 => "GBR",
1157
1157
  :payment_methods => ["credit_card", "paypal"],
1158
1158
  )
1159
1159
 
@@ -7935,4 +7935,59 @@ describe Braintree::Transaction do
7935
7935
  expect(result.transaction.merchant_advice_code_text).to eq("New account information available")
7936
7936
  end
7937
7937
  end
7938
+
7939
+ context "Shipping Tax Amount" do
7940
+ it "accepts shipping-tax-amount field" do
7941
+ result = Braintree::Transaction.create(
7942
+ :type => "sale",
7943
+ :payment_method_nonce => Braintree::Test::Nonce::Transactable,
7944
+ :amount => "10.00",
7945
+ :shipping_amount => "1.00",
7946
+ :shipping_tax_amount => "1.00",
7947
+ :discount_amount => "2.00",
7948
+ :ships_from_postal_code => "12345",
7949
+ )
7950
+
7951
+ expect(result.success?).to eq(true)
7952
+ expect(result.transaction.shipping_amount).to eq("1.00")
7953
+ expect(result.transaction.shipping_tax_amount).to eq("1.00")
7954
+ expect(result.transaction.discount_amount).to eq("2.00")
7955
+ expect(result.transaction.ships_from_postal_code).to eq("12345")
7956
+ end
7957
+
7958
+ it "submit for settlement succeeds when shipping tax amount is provided" do
7959
+ result = Braintree::Transaction.sale(
7960
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
7961
+ :merchant_account_id => SpecHelper::FakeFirstDataMerchantAccountId,
7962
+ :credit_card => {
7963
+ :number => Braintree::Test::CreditCardNumbers::Visa,
7964
+ :expiration_date => "05/2029"
7965
+ },
7966
+ )
7967
+ expect(result.success?).to eq(true)
7968
+
7969
+ result = Braintree::Transaction.submit_for_settlement(
7970
+ result.transaction.id,
7971
+ nil,
7972
+ :discount_amount => "2.00",
7973
+ :shipping_amount => "1.23",
7974
+ :shipping_tax_amount => "0.40",
7975
+ :ships_from_postal_code => "90210",
7976
+ :line_items => [
7977
+ {
7978
+ :quantity => 1,
7979
+ :unit_amount => 1,
7980
+ :name => "New line item",
7981
+ :kind => "debit",
7982
+ :total_amount => "18.00",
7983
+ :discount_amount => "12.00",
7984
+ :tax_amount => "0",
7985
+ },
7986
+ ],
7987
+ )
7988
+ expect(result.success?).to eq(true)
7989
+ expect(result.transaction.shipping_tax_amount).to eq("0.40")
7990
+ expect(result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
7991
+ end
7992
+ end
7938
7993
  end
@@ -399,7 +399,7 @@ describe Braintree::Configuration do
399
399
 
400
400
  it "is qa.braintreegateway.com for qa" do
401
401
  Braintree::Configuration.environment = :qa
402
- expect(Braintree::Configuration.instantiate.server).to eq("gateway.qa.braintreepayments.com")
402
+ expect(Braintree::Configuration.instantiate.server).to eq("gateway.qa2.braintreepayments.com")
403
403
  end
404
404
 
405
405
  it "can by changed by configuring the production endpoint" do
@@ -6,6 +6,8 @@ describe Braintree::CreditCardVerification do
6
6
  verification = Braintree::CreditCardVerification._new(
7
7
  :status => "verified",
8
8
  :amount => "12.45",
9
+ :ani_first_name_response_code => "I",
10
+ :ani_last_name_response_code => "I",
9
11
  :currency_iso_code => "USD",
10
12
  :avs_error_response_code => "I",
11
13
  :avs_postal_code_response_code => "I",
@@ -17,8 +19,7 @@ describe Braintree::CreditCardVerification do
17
19
  :network_response_code => "05",
18
20
  :network_response_text => "Do not Honor",
19
21
  )
20
-
21
- expect(verification.inspect).to eq(%(#<Braintree::CreditCardVerification status: "verified", processor_response_code: "2000", processor_response_text: "Do Not Honor", amount: "12.45", currency_iso_code: "USD", cvv_response_code: "I", avs_error_response_code: "I", avs_postal_code_response_code: "I", avs_street_address_response_code: "I", network_response_code: "05", network_response_text: "Do not Honor", merchant_account_id: "some_id", gateway_rejection_reason: nil, id: nil, credit_card: nil, billing: nil, created_at: nil>))
22
+ expect(verification.inspect).to eq(%(#<Braintree::CreditCardVerification amount: "12.45", ani_first_name_response_code: "I", ani_last_name_response_code: "I", avs_error_response_code: "I", avs_postal_code_response_code: "I", avs_street_address_response_code: "I", billing: nil, created_at: nil, credit_card: nil, currency_iso_code: "USD", cvv_response_code: "I", gateway_rejection_reason: nil, id: nil, merchant_account_id: "some_id", network_response_code: "05", network_response_text: "Do not Honor", processor_response_code: "2000", processor_response_text: "Do Not Honor", status: "verified">))
22
23
  end
23
24
 
24
25
  it "has a status" do
@@ -37,6 +38,16 @@ describe Braintree::CreditCardVerification do
37
38
  end
38
39
  end
39
40
 
41
+ it "accepts ani name reponse codes" do
42
+ verification = Braintree::CreditCardVerification._new(
43
+ :ani_first_name_response_code => "M",
44
+ :ani_last_name_response_code => "M",
45
+ )
46
+
47
+ expect(verification.ani_first_name_response_code).to eq("M")
48
+ expect(verification.ani_last_name_response_code).to eq("M")
49
+ end
50
+
40
51
  it "accepts amount as either a String or BigDecimal" do
41
52
  expect(Braintree::CreditCardVerification._new(:amount => "12.34").amount).to eq(BigDecimal("12.34"))
42
53
  expect(Braintree::CreditCardVerification._new(:amount => BigDecimal("12.34")).amount).to eq(BigDecimal("12.34"))
@@ -38,7 +38,7 @@ describe Braintree::ErrorResult do
38
38
  :verification => {},
39
39
  :transaction => nil,
40
40
  )
41
- expect(result.inspect).to include("credit_card_verification: #<Braintree::CreditCardVerification status: ")
41
+ expect(result.inspect).to include("credit_card_verification: #<Braintree::CreditCardVerification amount: ")
42
42
  end
43
43
 
44
44
  it "does not include the credit_card_verification if there isn't one" do
@@ -12,8 +12,11 @@ describe Braintree::LocalPaymentCompleted do
12
12
  describe "self._new" do
13
13
  it "initializes the object with the appropriate attributes set" do
14
14
  params = {
15
- payment_id: "a-payment-id",
15
+ bic: "a-bic",
16
+ iban_last_chars: "1234",
16
17
  payer_id: "a-payer-id",
18
+ payer_name: "John Doe",
19
+ payment_id: "a-payment-id",
17
20
  payment_method_nonce: "a-nonce",
18
21
  transaction: {
19
22
  id: "a-transaction-id",
@@ -24,25 +27,34 @@ describe Braintree::LocalPaymentCompleted do
24
27
  }
25
28
  local_payment_completed = Braintree::LocalPaymentCompleted._new(params)
26
29
 
27
- expect(local_payment_completed.payment_id).to eq("a-payment-id")
30
+ expect(local_payment_completed.bic).to eq("a-bic")
31
+ expect(local_payment_completed.iban_last_chars).to eq("1234")
28
32
  expect(local_payment_completed.payer_id).to eq("a-payer-id")
33
+ expect(local_payment_completed.payer_name).to eq("John Doe")
34
+ expect(local_payment_completed.payment_id).to eq("a-payment-id")
29
35
  expect(local_payment_completed.payment_method_nonce).to eq("a-nonce")
30
- expect(local_payment_completed.transaction.id).to eq("a-transaction-id")
31
36
  expect(local_payment_completed.transaction.amount).to eq(31.0)
37
+ expect(local_payment_completed.transaction.id).to eq("a-transaction-id")
32
38
  expect(local_payment_completed.transaction.order_id).to eq("an-order-id")
33
39
  expect(local_payment_completed.transaction.status).to eq(Braintree::Transaction::Status::Authorized)
34
40
  end
35
41
 
36
42
  it "initializes the object with the appropriate attributes set if no transaction is provided" do
37
43
  params = {
38
- payment_id: "a-payment-id",
44
+ bic: "a-bic",
45
+ iban_last_chars: "1234",
39
46
  payer_id: "a-payer-id",
47
+ payer_name: "John Doe",
48
+ payment_id: "a-payment-id",
40
49
  payment_method_nonce: "a-nonce",
41
50
  }
42
51
  local_payment_completed = Braintree::LocalPaymentCompleted._new(params)
43
52
 
44
- expect(local_payment_completed.payment_id).to eq("a-payment-id")
53
+ expect(local_payment_completed.bic).to eq("a-bic")
54
+ expect(local_payment_completed.iban_last_chars).to eq("1234")
45
55
  expect(local_payment_completed.payer_id).to eq("a-payer-id")
56
+ expect(local_payment_completed.payer_name).to eq("John Doe")
57
+ expect(local_payment_completed.payment_id).to eq("a-payment-id")
46
58
  expect(local_payment_completed.payment_method_nonce).to eq("a-nonce")
47
59
  expect(local_payment_completed.transaction).to be_nil
48
60
  end
@@ -41,4 +41,13 @@ describe Braintree::PayPalAccount do
41
41
  expect(paypal_account.updated_at).to eq(now)
42
42
  end
43
43
  end
44
+
45
+ describe "edit_paypal_vault_id" do
46
+ it "exposes edit_paypal_vault_id" do
47
+ mock_edit_paypal_vault_id = "ENCR-BA-ID1"
48
+ paypal_account = Braintree::PayPalAccount._new(:gateway, :edit_paypal_vault_id => mock_edit_paypal_vault_id)
49
+
50
+ expect(paypal_account.edit_paypal_vault_id).to eq(mock_edit_paypal_vault_id)
51
+ end
52
+ end
44
53
  end
@@ -33,36 +33,45 @@ describe Braintree::TransactionGateway do
33
33
  # three_d_secure_token has been deprecated in favor of three_d_secure_authentication_id
34
34
  it "creates a transaction gateway signature" do
35
35
  expect(Braintree::TransactionGateway._create_signature).to match([
36
- :amount, :billing_address_id, :channel, :customer_id, :device_data, :discount_amount,
36
+ :amount, :billing_address_id, :channel, :currency_iso_code, :customer_id, :device_data,
37
+ :discount_amount, :exchange_rate_quote_id, :foreign_retailer,
37
38
  :merchant_account_id, :order_id, :payment_method_nonce, :payment_method_token,
38
39
  :product_sku, :purchase_order_number, :service_fee_amount, :shared_billing_address_id,
39
40
  :shared_customer_id, :shared_payment_method_nonce, :shared_payment_method_token,
40
- :shared_shipping_address_id, :shipping_address_id, :shipping_amount,
41
+ :shared_shipping_address_id, :shipping_address_id, :shipping_amount, :shipping_tax_amount,
41
42
  :ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,:three_d_secure_token, #Deprecated
42
- :transaction_source, :type, :venmo_sdk_payment_method_code, #Deprecated
43
- :sca_exemption, :currency_iso_code, :exchange_rate_quote_id, :foreign_retailer,
44
- {: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]},
45
- {:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
46
- {:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number, {:payment_reader_card_details => [:encrypted_card_data, :key_serial_number]}, {:network_tokenization_attributes => [:cryptogram, :ecommerce_indicator, :token_requestor_id]}]},
47
- {:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
43
+ :transaction_source, :type, :venmo_sdk_payment_method_code, # Deprecated
44
+ :sca_exemption,
45
+ {:apple_pay_card => [:number, :cardholder_name, :cryptogram, :expiration_month, :expiration_year, :eci_indicator]},
48
46
  {
49
47
  :billing => Braintree::AddressGateway._shared_signature
50
48
  },
51
- {
52
- :shipping => Braintree::AddressGateway._shared_signature + [:shipping_method],
53
- },
54
- {
55
- :three_d_secure_pass_thru => [
56
- :eci_flag,
57
- :cavv,
58
- :xid,
59
- :three_d_secure_version,
60
- :authentication_response,
61
- :directory_response,
62
- :cavv_algorithm,
63
- :ds_transaction_id,
64
- ]
65
- },
49
+ {:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number, {:payment_reader_card_details => [:encrypted_card_data, :key_serial_number]}, {:network_tokenization_attributes => [:cryptogram, :ecommerce_indicator, :token_requestor_id]}]},
50
+ {:customer => [:id, :company, :email, :fax, :first_name, :last_name, :phone, :website]},
51
+ {:custom_fields => :_any_key_},
52
+ {:descriptor => [:name, :phone, :url]},
53
+ {:external_vault => [
54
+ :status,
55
+ :previous_network_transaction_id,
56
+ ]},
57
+ {:google_pay_card => [:number, :cryptogram, :google_transaction_id, :expiration_month, :expiration_year, :source_card_type, :source_card_last_four, :eci_indicator]},
58
+ {:industry => [
59
+ :industry_type,
60
+ {:data => [
61
+ :country_code, :date_of_birth, :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
62
+ :passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
63
+ :issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
64
+ {:legs => [
65
+ :conjunction_ticket, :exchange_ticket, :coupon_number, :service_class, :carrier_code, :fare_basis_code, :flight_number, :departure_date, :departure_airport_code, :departure_time,
66
+ :arrival_airport_code, :arrival_time, :stopover_permitted, :fare_amount, :fee_amount, :tax_amount, :endorsement_or_restrictions,
67
+ ]},
68
+ {:additional_charges => [
69
+ :kind, :amount,
70
+ ]},
71
+ ]},
72
+ ]},
73
+ {:installments => [:count]},
74
+ {:line_items => [:commodity_code, :description, :discount_amount, :image_url, :kind, :name, :product_code, :quantity, :tax_amount, :total_amount, :unit_amount, :unit_of_measure, :unit_tax_amount, :upc_code, :upc_type, :url]},
66
75
  {:options => [
67
76
  :hold_in_escrow,
68
77
  :store_in_vault,
@@ -70,7 +79,7 @@ describe Braintree::TransactionGateway do
70
79
  :submit_for_settlement,
71
80
  :add_billing_address_to_payment_method,
72
81
  :store_shipping_address_in_vault,
73
- :venmo_sdk_session, #Deprecated
82
+ :venmo_sdk_session, # Deprecated
74
83
  :payee_id,
75
84
  :payee_email,
76
85
  :skip_advanced_fraud_checking,
@@ -84,31 +93,23 @@ describe Braintree::TransactionGateway do
84
93
  {:credit_card => [:account_type, :process_debit_as_credit]},
85
94
  ]
86
95
  },
87
- {:external_vault => [
88
- :status,
89
- :previous_network_transaction_id,
90
- ]},
91
- {:custom_fields => :_any_key_},
92
- {:descriptor => [:name, :phone, :url]},
93
96
  {:paypal_account => [:email, :token, :paypal_data, :payee_id, :payee_email, :payer_id, :payment_id]},
94
- {:industry => [
95
- :industry_type,
96
- {:data => [
97
- :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,
98
- :passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
99
- :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,
100
- {:legs => [
101
- :conjunction_ticket, :exchange_ticket, :coupon_number, :service_class, :carrier_code, :fare_basis_code, :flight_number, :departure_date, :departure_airport_code, :departure_time,
102
- :arrival_airport_code, :arrival_time, :stopover_permitted, :fare_amount, :fee_amount, :tax_amount, :endorsement_or_restrictions,
103
- ]},
104
- {:additional_charges => [
105
- :kind, :amount,
106
- ]},
107
- ]},
108
- ]},
109
- {:apple_pay_card => [:number, :cardholder_name, :cryptogram, :expiration_month, :expiration_year, :eci_indicator]},
110
- {:google_pay_card => [:number, :cryptogram, :google_transaction_id, :expiration_month, :expiration_year, :source_card_type, :source_card_last_four, :eci_indicator]},
111
- {:installments => [:count]},
97
+ {:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
98
+ {
99
+ :shipping => Braintree::AddressGateway._shared_signature + [:shipping_method],
100
+ },
101
+ {
102
+ :three_d_secure_pass_thru => [
103
+ :eci_flag,
104
+ :cavv,
105
+ :xid,
106
+ :three_d_secure_version,
107
+ :authentication_response,
108
+ :directory_response,
109
+ :cavv_algorithm,
110
+ :ds_transaction_id,
111
+ ]
112
+ },
112
113
  ])
113
114
  end
114
115
 
@@ -136,6 +137,7 @@ describe Braintree::TransactionGateway do
136
137
  :tax_exempt,
137
138
  :discount_amount,
138
139
  :shipping_amount,
140
+ :shipping_tax_amount,
139
141
  :ships_from_postal_code,
140
142
  :line_items => [:commodity_code, :description, :discount_amount, :image_url, :kind, :name, :product_code, :quantity, :tax_amount, :total_amount, :unit_amount, :unit_of_measure, :unit_tax_amount, :upc_code, :upc_type, :url],
141
143
  ])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braintree
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.21.0
4
+ version: 4.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-23 00:00:00.000000000 Z
11
+ date: 2024-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder