Skip to content

Commit 931c7c4

Browse files
4.28.0
Co-authored-by: Kevin Laguerre <klaguerre@paypal.com>
1 parent b459ec9 commit 931c7c4

File tree

66 files changed

+1295
-251
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1295
-251
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## 4.28.0
4+
5+
- Add `account_information_inquiry` to
6+
- `CreditCardVerification#create`
7+
- `PaymentMethod#create` and `PaymentMethod#update`
8+
- `CreditCard#create` and `CreditCard#update`
9+
- Enhancements to PayPal customer recommendations
10+
- Create a session and get recommendations in one call
11+
- Hash customer email and phone number
12+
- Add `business`, `consumer`, `corporate`, and `purchase` from the bin data to credit card responses
13+
314
## 4.27.0
415

516
- Remove marketplace features

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The Braintree Ruby SDK is tested against Ruby versions 2.6, 2.7 and 3.0.
3232
_The Ruby core development community has released [End-of-Life branches](https://www.ruby-lang.org/en/downloads/branches/) for Ruby versions lower than 2.6, which are no longer receiving security updates. As a result, Braintree no longer supports these versions of Ruby. **We have updated our gem specifications to reflect these updates.**_
3333

3434
## Versions
35-
> :warning: **The SSL certificates for Ruby SDK versions older than 4.23.0 are set to expire by June 31, 2025. If you do not update your SDK to the latest version with the updated certificates by June 31, 2025, 100% of your impacted traffic will fail**
35+
> :warning: **The SSL certificates for Ruby SDK versions older than 2.82.0 are set to expire by March 30, 2026. If you do not update your SDK to the latest version with the updated certificates by March 30, 2026, 100% of your impacted traffic will fail**
3636
3737
Braintree employs a deprecation policy for our SDKs. For more information on the statuses of an SDK check our [developer docs](https://developer.paypal.com/braintree/docs/reference/general/server-sdk-deprecation-policy). [Minimum supported versions](https://developer.paypal.com/braintree/docs/reference/general/best-practices/ruby#server-sdk-versions) are also available in our developer docs.
3838

lib/braintree.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,12 @@
8383
require "braintree/graphql/inputs/customer_session_input"
8484
require "braintree/graphql/inputs/phone_input"
8585
require "braintree/graphql/inputs/update_customer_session_input"
86+
require "braintree/graphql/inputs/paypal_purchase_unit_input"
87+
require "braintree/graphql/inputs/paypal_payee_input"
88+
require "braintree/graphql/inputs/monetary_amount_input"
8689
require "braintree/graphql/types/customer_recommendations_payload"
8790
require "braintree/graphql/types/payment_options"
91+
require "braintree/graphql/types/payment_recommendations"
8892
require "braintree/graphql/unions/customer_recommendations"
8993
require "braintree/graphql_client"
9094
require "braintree/google_pay_card"

lib/braintree/apple_pay_card.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ module CardType
1212

1313
attr_reader :billing_address
1414
attr_reader :bin
15+
attr_reader :business
1516
attr_reader :card_type
1617
attr_reader :cardholder_name
1718
attr_reader :commercial
19+
attr_reader :consumer
20+
attr_reader :corporate
1821
attr_reader :country_of_issuance
1922
attr_reader :created_at
2023
attr_reader :customer_id
@@ -34,6 +37,7 @@ module CardType
3437
attr_reader :prepaid
3538
attr_reader :prepaid_reloadable
3639
attr_reader :product_id
40+
attr_reader :purchase
3741
attr_reader :source_card_last4
3842
attr_reader :source_description
3943
attr_reader :subscriptions

lib/braintree/bin_data.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ module Braintree
22
class BinData
33
include BaseModule
44

5+
attr_reader :business
56
attr_reader :commercial
7+
attr_reader :consumer
8+
attr_reader :corporate
69
attr_reader :country_of_issuance
710
attr_reader :debit
811
attr_reader :durbin_regulated
@@ -12,6 +15,7 @@ class BinData
1215
attr_reader :prepaid
1316
attr_reader :prepaid_reloadable
1417
attr_reader :product_id
18+
attr_reader :purchase
1519

1620
def initialize(attributes)
1721
set_instance_variables_from_hash attributes unless attributes.nil?
@@ -26,8 +30,9 @@ def inspect
2630

2731
def self._attributes
2832
[
29-
:commercial, :country_of_issuance, :debit, :durbin_regulated, :healthcare,
30-
:issuing_bank, :payroll, :prepaid, :prepaid_reloadable, :product_id
33+
:business, :commercial, :consumer, :corporate, :country_of_issuance, :debit,
34+
:durbin_regulated, :healthcare, :issuing_bank, :payroll, :prepaid,
35+
:prepaid_reloadable, :product_id, :purchase
3136
]
3237
end
3338
end

lib/braintree/credit_card.rb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,18 @@ module CardTypeIndicator
4545
Unknown = "Unknown"
4646
end
4747

48-
Commercial = CountryOfIssuance = Debit = DurbinRegulated = Healthcare =
49-
IssuingBank = Payroll = Prepaid = PrepaidReloadable = ProductId = CardTypeIndicator
48+
Business = Commercial = Consumer = Corporate = CountryOfIssuance = Debit =
49+
DurbinRegulated = Healthcare = IssuingBank = Payroll = Prepaid = PrepaidReloadable =
50+
ProductId = Purchase = CardTypeIndicator
5051

5152
attr_reader :billing_address
5253
attr_reader :bin
54+
attr_reader :business
5355
attr_reader :card_type
5456
attr_reader :cardholder_name
5557
attr_reader :commercial
58+
attr_reader :consumer
59+
attr_reader :corporate
5660
attr_reader :country_of_issuance
5761
attr_reader :created_at
5862
attr_reader :customer_id
@@ -68,6 +72,7 @@ module CardTypeIndicator
6872
attr_reader :prepaid
6973
attr_reader :prepaid_reloadable
7074
attr_reader :product_id
75+
attr_reader :purchase
7176
attr_reader :subscriptions
7277
attr_reader :token
7378
attr_reader :unique_number_identifier
@@ -200,9 +205,10 @@ class << self
200205

201206
def self._attributes
202207
[
203-
:billing_address, :bin, :card_type, :cardholder_name, :commercial, :country_of_issuance, :created_at, :customer_id,
204-
:debit, :durbin_regulated, :expiration_month, :expiration_year, :healthcare, :image_url, :is_network_tokenized?,
205-
:issuing_bank, :last_4, :payroll, :prepaid, :prepaid_reloadable, :product_id, :token, :updated_at
208+
:billing_address, :bin, :business, :card_type, :cardholder_name, :commercial, :consumer, :corporate,
209+
:country_of_issuance, :created_at, :customer_id, :debit, :durbin_regulated, :expiration_month,
210+
:expiration_year, :healthcare, :image_url, :is_network_tokenized?, :issuing_bank, :last_4, :payroll,
211+
:prepaid, :prepaid_reloadable, :product_id, :purchase, :token, :updated_at
206212
]
207213
end
208214

lib/braintree/credit_card_gateway.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def self._signature(type)
9696
# NEXT_MAJOR_VERSION Remove venmo_sdk_session
9797
# The old venmo SDK class has been deprecated
9898
options = [
99+
:account_information_inquiry,
99100
:fail_on_duplicate_payment_method,
100101
:fail_on_duplicate_payment_method_for_customer,
101102
:make_default,

lib/braintree/credit_card_verification_gateway.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def self._create_signature
6161
]},
6262
:intended_transaction_source,
6363
{:options => [
64+
:account_information_inquiry,
6465
:account_type,
6566
:amount,
6667
:merchant_account_id,

lib/braintree/customer_session_gateway.rb

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,13 @@ class CustomerSessionGateway
1919
GRAPHQL
2020

2121
GET_CUSTOMER_RECOMMENDATIONS = <<~GRAPHQL
22-
query CustomerRecommendations($input: CustomerRecommendationsInput!) {
23-
customerRecommendations(input: $input) {
22+
mutation GenerateCustomerRecommendations($input: GenerateCustomerRecommendationsInput!) {
23+
generateCustomerRecommendations(input: $input) {
24+
sessionId
2425
isInPayPalNetwork
25-
recommendations {
26-
... on PaymentRecommendations {
27-
paymentOptions {
26+
paymentRecommendations {
2827
paymentOption
2928
recommendedPriority
30-
}
31-
}
3229
}
3330
}
3431
}
@@ -143,7 +140,11 @@ def get_customer_recommendations(customer_recommendations_input)
143140
SuccessfulResult.new(:customer_recommendations => extract_customer_recommendations_payload(response))
144141
end
145142
rescue StandardError => e
146-
raise UnexpectedError, e.message
143+
if e.message.include?("Authorization failed")
144+
raise AuthorizationError, e.message
145+
else
146+
raise ServerError, e.message
147+
end
147148
end
148149
end
149150

@@ -187,8 +188,8 @@ def pop_value(map, key)
187188
end
188189

189190
def extract_customer_recommendations_payload(data)
190-
customer_recommendations_hash = get_value(data, "data.customerRecommendations")
191-
Braintree::CustomerRecommendationsPayload._new(customer_recommendations_hash)
191+
customer_recommendations_hash = get_value(data, "data.generateCustomerRecommendations")
192+
Braintree::CustomerRecommendationsPayload._new({:response => {"generateCustomerRecommendations" => customer_recommendations_hash}})
192193
end
193194
end
194195
end

lib/braintree/google_pay_card.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ class GooglePayCard
33
include BaseModule
44

55
attr_reader :bin
6+
attr_reader :business
67
attr_reader :commercial
8+
attr_reader :consumer
9+
attr_reader :corporate
710
attr_reader :country_of_issuance
811
attr_reader :created_at
912
attr_reader :customer_id
@@ -20,6 +23,7 @@ class GooglePayCard
2023
attr_reader :prepaid
2124
attr_reader :prepaid_reloadable
2225
attr_reader :product_id
26+
attr_reader :purchase
2327
attr_reader :source_card_last_4
2428
attr_reader :source_card_type
2529
attr_reader :source_description

0 commit comments

Comments
 (0)