braintree 4.2.0 → 4.6.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 +1 -1
- data/lib/braintree/apple_pay_card.rb +9 -0
- data/lib/braintree/enriched_customer_data.rb +21 -0
- data/lib/braintree/error_codes.rb +1 -0
- data/lib/braintree/google_pay_card.rb +9 -0
- data/lib/braintree/http.rb +1 -0
- data/lib/braintree/local_payment_expired.rb +21 -0
- data/lib/braintree/local_payment_funded.rb +22 -0
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
- data/lib/braintree/plan.rb +20 -0
- data/lib/braintree/plan_gateway.rb +100 -0
- data/lib/braintree/successful_result.rb +1 -0
- data/lib/braintree/transaction/paypal_details.rb +2 -0
- data/lib/braintree/transaction_gateway.rb +2 -2
- data/lib/braintree/transaction_review.rb +18 -0
- data/lib/braintree/venmo_profile_data.rb +23 -0
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/webhook_notification.rb +14 -0
- data/lib/braintree/webhook_testing_gateway.rb +91 -17
- data/lib/braintree.rb +5 -0
- data/spec/integration/braintree/customer_spec.rb +27 -0
- data/spec/integration/braintree/merchant_account_spec.rb +3 -3
- data/spec/integration/braintree/payment_method_nonce_spec.rb +2 -1
- data/spec/integration/braintree/payment_method_spec.rb +27 -0
- data/spec/integration/braintree/plan_spec.rb +82 -0
- data/spec/integration/braintree/transaction_spec.rb +28 -0
- data/spec/unit/braintree/enriched_customer_data_spec.rb +32 -0
- data/spec/unit/braintree/http_spec.rb +2 -0
- data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
- data/spec/unit/braintree/local_payment_funded_spec.rb +34 -0
- data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +45 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +4 -0
- data/spec/unit/braintree/transaction_spec.rb +3 -3
- data/spec/unit/braintree/venmo_profile_data_spec.rb +32 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +78 -1
- metadata +15 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d5f90896056b6236f7150b16b09322c9f32822b23bd4367140418f9506c8767
|
4
|
+
data.tar.gz: 948821597de9332dccd0ee502f3828b6e6d14253681fe42a8c5950d15fb71882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f0d867f7795d6969fe315a78ee163f871d919fc611a9dcba22c259332fd2f1bb47c94676aad8f340ec4cb040ebe2d8f256d50704b9b586b5f4afb6cbf93199c
|
7
|
+
data.tar.gz: d2db07468b1b333986d61389cb60a16cde90db6168bd445a04a5f04621debdebd0cd334f9623ddc26ee85da546dc4efd1aea3751510d444c72c8e5a4b4771bf5
|
data/braintree.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
"bug_tracker_uri" => "https://github.com/braintree/braintree_ruby/issues",
|
19
19
|
"changelog_uri" => "https://github.com/braintree/braintree_ruby/blob/master/CHANGELOG.md",
|
20
20
|
"source_code_uri" => "https://github.com/braintree/braintree_ruby",
|
21
|
-
"documentation_uri" => "https://
|
21
|
+
"documentation_uri" => "https://developer.paypal.com/braintree/docs"
|
22
22
|
}
|
23
23
|
end
|
24
24
|
|
@@ -12,15 +12,24 @@ module Braintree
|
|
12
12
|
|
13
13
|
attr_reader :bin
|
14
14
|
attr_reader :card_type
|
15
|
+
attr_reader :commercial
|
16
|
+
attr_reader :country_of_issuance
|
15
17
|
attr_reader :created_at
|
16
18
|
attr_reader :customer_id
|
19
|
+
attr_reader :debit
|
17
20
|
attr_reader :default
|
21
|
+
attr_reader :durbin_regulated
|
18
22
|
attr_reader :expiration_month
|
19
23
|
attr_reader :expiration_year
|
20
24
|
attr_reader :expired
|
25
|
+
attr_reader :healthcare
|
21
26
|
attr_reader :image_url
|
27
|
+
attr_reader :issuing_bank
|
22
28
|
attr_reader :last_4
|
23
29
|
attr_reader :payment_instrument_name
|
30
|
+
attr_reader :payroll
|
31
|
+
attr_reader :prepaid
|
32
|
+
attr_reader :product_id
|
24
33
|
attr_reader :source_description
|
25
34
|
attr_reader :subscriptions
|
26
35
|
attr_reader :token
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Braintree
|
2
|
+
class EnrichedCustomerData
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :fields_updated
|
6
|
+
attr_reader :profile_data
|
7
|
+
|
8
|
+
def initialize(attributes) # :nodoc:
|
9
|
+
set_instance_variables_from_hash(attributes)
|
10
|
+
@profile_data = VenmoProfileData._new(attributes[:profile_data])
|
11
|
+
end
|
12
|
+
|
13
|
+
class << self
|
14
|
+
protected :new
|
15
|
+
end
|
16
|
+
|
17
|
+
def self._new(*args) # :nodoc:
|
18
|
+
self.new(*args)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -312,6 +312,7 @@ module Braintree
|
|
312
312
|
DiscountAmountCannotBeNegative = "915160"
|
313
313
|
DiscountAmountFormatIsInvalid = "915159"
|
314
314
|
DiscountAmountIsTooLarge = "915161"
|
315
|
+
ExchangeRateQuoteIdTooLong = "915229"
|
315
316
|
FailedAuthAdjustmentAllowRetry = "95603"
|
316
317
|
FailedAuthAdjustmentHardDecline = "95602"
|
317
318
|
FinalAuthSubmitForSettlementForDifferentAmount = "95601"
|
@@ -3,13 +3,22 @@ module Braintree
|
|
3
3
|
include BaseModule # :nodoc:
|
4
4
|
|
5
5
|
attr_reader :bin
|
6
|
+
attr_reader :commercial
|
7
|
+
attr_reader :country_of_issuance
|
6
8
|
attr_reader :created_at
|
7
9
|
attr_reader :customer_id
|
10
|
+
attr_reader :debit
|
8
11
|
attr_reader :default
|
12
|
+
attr_reader :durbin_regulated
|
9
13
|
attr_reader :expiration_month
|
10
14
|
attr_reader :expiration_year
|
11
15
|
attr_reader :google_transaction_id
|
16
|
+
attr_reader :healthcare
|
12
17
|
attr_reader :image_url
|
18
|
+
attr_reader :issuing_bank
|
19
|
+
attr_reader :payroll
|
20
|
+
attr_reader :prepaid
|
21
|
+
attr_reader :product_id
|
13
22
|
attr_reader :source_card_last_4
|
14
23
|
attr_reader :source_card_type
|
15
24
|
attr_reader :source_description
|
data/lib/braintree/http.rb
CHANGED
@@ -188,6 +188,7 @@ module Braintree
|
|
188
188
|
formatted_xml = input_xml.gsub(/^/, "[Braintree] ")
|
189
189
|
formatted_xml = formatted_xml.gsub(/<number>(.{6}).+?(.{4})<\/number>/m, '<number>\1******\2</number>')
|
190
190
|
formatted_xml = formatted_xml.gsub(/<cvv>.+?<\/cvv>/m, "<cvv>***</cvv>")
|
191
|
+
formatted_xml = formatted_xml.gsub(/<encrypted-card-data>.+?<\/encrypted-card-data>/m, "<encrypted-card-data>***</encrypted-card-data>")
|
191
192
|
formatted_xml
|
192
193
|
end
|
193
194
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Braintree
|
2
|
+
class LocalPaymentExpired
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :payment_id
|
6
|
+
attr_reader :payment_context_id
|
7
|
+
|
8
|
+
def initialize(attributes) # :nodoc:
|
9
|
+
set_instance_variables_from_hash(attributes)
|
10
|
+
end
|
11
|
+
|
12
|
+
class << self
|
13
|
+
protected :new
|
14
|
+
end
|
15
|
+
|
16
|
+
def self._new(*args) # :nodoc:
|
17
|
+
self.new(*args)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Braintree
|
2
|
+
class LocalPaymentFunded
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :payment_id
|
6
|
+
attr_reader :payment_context_id
|
7
|
+
attr_reader :transaction
|
8
|
+
|
9
|
+
def initialize(attributes) # :nodoc:
|
10
|
+
set_instance_variables_from_hash(attributes)
|
11
|
+
@transaction = Transaction._new(Configuration.gateway, transaction)
|
12
|
+
end
|
13
|
+
|
14
|
+
class << self
|
15
|
+
protected :new
|
16
|
+
end
|
17
|
+
|
18
|
+
def self._new(*args) # :nodoc:
|
19
|
+
self.new(*args)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Braintree
|
2
|
+
class PaymentMethodCustomerDataUpdatedMetadata
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :token
|
6
|
+
attr_reader :payment_method
|
7
|
+
attr_reader :datetime_updated
|
8
|
+
attr_reader :enriched_customer_data
|
9
|
+
|
10
|
+
def initialize(gateway, attributes) # :nodoc:
|
11
|
+
set_instance_variables_from_hash(attributes)
|
12
|
+
@payment_method = PaymentMethodParser.parse_payment_method(gateway, attributes[:payment_method])
|
13
|
+
@enriched_customer_data = EnrichedCustomerData._new(enriched_customer_data) if enriched_customer_data
|
14
|
+
end
|
15
|
+
|
16
|
+
class << self
|
17
|
+
protected :new
|
18
|
+
end
|
19
|
+
|
20
|
+
def self._new(*args) # :nodoc:
|
21
|
+
self.new(*args)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/braintree/plan.rb
CHANGED
@@ -33,6 +33,26 @@ module Braintree
|
|
33
33
|
|
34
34
|
class << self
|
35
35
|
protected :new
|
36
|
+
|
37
|
+
def create(*args)
|
38
|
+
Configuration.gateway.plan.create(*args)
|
39
|
+
end
|
40
|
+
|
41
|
+
def create!(*args)
|
42
|
+
Configuration.gateway.plan.create!(*args)
|
43
|
+
end
|
44
|
+
|
45
|
+
def find(*args)
|
46
|
+
Configuration.gateway.plan.find(*args)
|
47
|
+
end
|
48
|
+
|
49
|
+
def update(*args)
|
50
|
+
Configuration.gateway.plan.update(*args)
|
51
|
+
end
|
52
|
+
|
53
|
+
def update!(*args)
|
54
|
+
Configuration.gateway.plan.update!(*args)
|
55
|
+
end
|
36
56
|
end
|
37
57
|
|
38
58
|
def self._new(*args)
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Braintree
|
2
2
|
class PlanGateway # :nodoc:
|
3
|
+
include BaseModule
|
4
|
+
|
3
5
|
def initialize(gateway)
|
4
6
|
@gateway = gateway
|
5
7
|
@config = gateway.config
|
@@ -13,5 +15,103 @@ module Braintree
|
|
13
15
|
Plan._new(@gateway, attributes)
|
14
16
|
end
|
15
17
|
end
|
18
|
+
|
19
|
+
def create(attributes)
|
20
|
+
Util.verify_keys(PlanGateway._create_signature, attributes)
|
21
|
+
_do_create "/plans", :plan => attributes
|
22
|
+
end
|
23
|
+
|
24
|
+
def create!(*args)
|
25
|
+
return_object_or_raise(:plan) { create(*args) }
|
26
|
+
end
|
27
|
+
|
28
|
+
def find(id)
|
29
|
+
raise ArgumentError if id.nil? || id.to_s.strip == ""
|
30
|
+
response = @config.http.get("#{@config.base_merchant_path}/plans/#{id}")
|
31
|
+
Plan._new(@gateway, response[:plan])
|
32
|
+
rescue NotFoundError
|
33
|
+
raise NotFoundError, "plan with id #{id.inspect} not found"
|
34
|
+
end
|
35
|
+
|
36
|
+
def update(plan_id, attributes)
|
37
|
+
Util.verify_keys(PlanGateway._update_signature, attributes)
|
38
|
+
response = @config.http.put("#{@config.base_merchant_path}/plans/#{plan_id}", :plan => attributes)
|
39
|
+
if response[:plan]
|
40
|
+
SuccessfulResult.new(:plan => Plan._new(@gateway, response[:plan]))
|
41
|
+
elsif response[:api_error_response]
|
42
|
+
ErrorResult.new(@gateway, response[:api_error_response])
|
43
|
+
else
|
44
|
+
raise UnexpectedError, "expected :plan or :api_error_response"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def update!(*args)
|
49
|
+
return_object_or_raise(:plan) { update(*args) }
|
50
|
+
end
|
51
|
+
|
52
|
+
def self._create_signature
|
53
|
+
[
|
54
|
+
:billing_day_of_month,
|
55
|
+
:billing_frequency,
|
56
|
+
:currency_iso_code,
|
57
|
+
:description,
|
58
|
+
:id,
|
59
|
+
:merchant_id,
|
60
|
+
:name,
|
61
|
+
:number_of_billing_cycles,
|
62
|
+
:price,
|
63
|
+
:trial_duration,
|
64
|
+
:trial_duration_unit,
|
65
|
+
:trial_period
|
66
|
+
] + _add_on_discount_signature
|
67
|
+
end
|
68
|
+
|
69
|
+
def self._update_signature
|
70
|
+
[
|
71
|
+
:billing_day_of_month,
|
72
|
+
:billing_frequency,
|
73
|
+
:currency_iso_code,
|
74
|
+
:description,
|
75
|
+
:id,
|
76
|
+
:merchant_id,
|
77
|
+
:name,
|
78
|
+
:number_of_billing_cycles,
|
79
|
+
:price,
|
80
|
+
:trial_duration,
|
81
|
+
:trial_duration_unit,
|
82
|
+
:trial_period
|
83
|
+
] + _add_on_discount_signature
|
84
|
+
end
|
85
|
+
|
86
|
+
def self._add_on_discount_signature
|
87
|
+
[
|
88
|
+
{
|
89
|
+
:add_ons => [
|
90
|
+
{:add => [:amount, :inherited_from_id, :never_expires, :number_of_billing_cycles, :quantity]},
|
91
|
+
{:update => [:amount, :existing_id, :never_expires, :number_of_billing_cycles, :quantity]},
|
92
|
+
{:remove => [:_any_key_]}
|
93
|
+
]
|
94
|
+
},
|
95
|
+
{
|
96
|
+
:discounts => [
|
97
|
+
{:add => [:amount, :inherited_from_id, :never_expires, :number_of_billing_cycles, :quantity]},
|
98
|
+
{:update => [:amount, :existing_id, :never_expires, :number_of_billing_cycles, :quantity]},
|
99
|
+
{:remove => [:_any_key_]}
|
100
|
+
]
|
101
|
+
}
|
102
|
+
]
|
103
|
+
end
|
104
|
+
|
105
|
+
def _do_create(path, params) # :nodoc:
|
106
|
+
response = @config.http.post("#{@config.base_merchant_path}#{path}", params)
|
107
|
+
if response[:plan]
|
108
|
+
SuccessfulResult.new(:plan => Plan._new(@gateway, response[:plan]))
|
109
|
+
elsif response[:errors]
|
110
|
+
ErrorResult.new(@gateway, response[:errors])
|
111
|
+
else
|
112
|
+
raise UnexpectedError, "expected :plan or :errors"
|
113
|
+
end
|
114
|
+
end
|
16
115
|
end
|
17
116
|
end
|
117
|
+
|
@@ -24,6 +24,8 @@ module Braintree
|
|
24
24
|
attr_reader :refund_from_transaction_fee_currency_iso_code
|
25
25
|
attr_reader :refund_id
|
26
26
|
attr_reader :seller_protection_status
|
27
|
+
attr_reader :tax_id
|
28
|
+
attr_reader :tax_id_type
|
27
29
|
attr_reader :token
|
28
30
|
attr_reader :transaction_fee_amount
|
29
31
|
attr_reader :transaction_fee_currency_iso_code
|
@@ -61,7 +61,7 @@ module Braintree
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def find(id)
|
64
|
-
raise ArgumentError if id.nil? || id.strip.to_s == ""
|
64
|
+
raise ArgumentError, "id can not be empty" if id.nil? || id.strip.to_s == ""
|
65
65
|
response = @config.http.get("#{@config.base_merchant_path}/transactions/#{id}")
|
66
66
|
Transaction._new(@gateway, response[:transaction])
|
67
67
|
rescue NotFoundError
|
@@ -192,7 +192,7 @@ module Braintree
|
|
192
192
|
:shared_shipping_address_id, :shipping_address_id, :shipping_amount,
|
193
193
|
:ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,
|
194
194
|
:three_d_secure_token, :transaction_source, :type, :venmo_sdk_payment_method_code,
|
195
|
-
:sca_exemption, :currency_iso_code,
|
195
|
+
:sca_exemption, :currency_iso_code, :exchange_rate_quote_id,
|
196
196
|
{:line_items => [:quantity, :name, :description, :kind, :unit_amount, :unit_tax_amount, :total_amount, :discount_amount, :tax_amount, :unit_of_measure, :product_code, :commodity_code, :url]},
|
197
197
|
{:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
|
198
198
|
{:credit_card => [:token, :cardholder_name, :cvv, :expiration_date, :expiration_month, :expiration_year, :number, {:payment_reader_card_details => [:encrypted_card_data, :key_serial_number]}]},
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Braintree
|
2
|
+
class TransactionReview
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :transaction_id, :decision, :reviewer_email, :reviewer_note, :reviewer_time
|
6
|
+
|
7
|
+
def initialize(attributes)
|
8
|
+
set_instance_variables_from_hash(attributes)
|
9
|
+
end
|
10
|
+
|
11
|
+
class << self
|
12
|
+
protected :new
|
13
|
+
def _new(*args) # :nodoc:
|
14
|
+
self.new(*args)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Braintree
|
2
|
+
class VenmoProfileData
|
3
|
+
include BaseModule
|
4
|
+
|
5
|
+
attr_reader :username
|
6
|
+
attr_reader :first_name
|
7
|
+
attr_reader :last_name
|
8
|
+
attr_reader :phone_number
|
9
|
+
attr_reader :email
|
10
|
+
|
11
|
+
def initialize(attributes) # :nodoc:
|
12
|
+
set_instance_variables_from_hash(attributes)
|
13
|
+
end
|
14
|
+
|
15
|
+
class << self
|
16
|
+
protected :new
|
17
|
+
end
|
18
|
+
|
19
|
+
def self._new(*args) # :nodoc:
|
20
|
+
self.new(*args)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/braintree/version.rb
CHANGED
@@ -28,6 +28,8 @@ module Braintree
|
|
28
28
|
GrantedPaymentMethodRevoked = "granted_payment_method_revoked"
|
29
29
|
|
30
30
|
LocalPaymentCompleted = "local_payment_completed"
|
31
|
+
LocalPaymentExpired = "local_payment_expired"
|
32
|
+
LocalPaymentFunded = "local_payment_funded"
|
31
33
|
LocalPaymentReversed = "local_payment_reversed"
|
32
34
|
|
33
35
|
OAuthAccessRevoked = "oauth_access_revoked"
|
@@ -36,6 +38,8 @@ module Braintree
|
|
36
38
|
PartnerMerchantDisconnected = "partner_merchant_disconnected"
|
37
39
|
PartnerMerchantDeclined = "partner_merchant_declined"
|
38
40
|
|
41
|
+
PaymentMethodCustomerDataUpdated = "payment_method_customer_data_updated"
|
42
|
+
|
39
43
|
PaymentMethodRevokedByCustomer = "payment_method_revoked_by_customer"
|
40
44
|
|
41
45
|
RecipientUpdatedGrantedPaymentMethod = "recipient_updated_granted_payment_method"
|
@@ -52,6 +56,7 @@ module Braintree
|
|
52
56
|
SubMerchantAccountDeclined = "sub_merchant_account_declined"
|
53
57
|
|
54
58
|
TransactionDisbursed = "transaction_disbursed"
|
59
|
+
TransactionReviewed = "transaction_reviewed"
|
55
60
|
TransactionSettlementDeclined = "transaction_settlement_declined"
|
56
61
|
TransactionSettled = "transaction_settled"
|
57
62
|
end
|
@@ -65,13 +70,17 @@ module Braintree
|
|
65
70
|
attr_reader :revoked_payment_method_metadata
|
66
71
|
attr_reader :kind
|
67
72
|
attr_reader :local_payment_completed
|
73
|
+
attr_reader :local_payment_expired
|
74
|
+
attr_reader :local_payment_funded
|
68
75
|
attr_reader :local_payment_reversed
|
69
76
|
attr_reader :oauth_access_revocation
|
70
77
|
attr_reader :partner_merchant
|
78
|
+
attr_reader :payment_method_customer_data_updated_metadata
|
71
79
|
attr_reader :source_merchant_id
|
72
80
|
attr_reader :subscription
|
73
81
|
attr_reader :timestamp
|
74
82
|
attr_reader :transaction
|
83
|
+
attr_reader :transaction_review
|
75
84
|
|
76
85
|
def self.parse(*args)
|
77
86
|
Configuration.gateway.webhook_notification.parse(*args)
|
@@ -90,6 +99,7 @@ module Braintree
|
|
90
99
|
@oauth_access_revocation = OpenStruct.new(@subject[:oauth_application_revocation]) if @subject.has_key?(:oauth_application_revocation)
|
91
100
|
@subscription = Subscription._new(gateway, @subject[:subscription]) if @subject.has_key?(:subscription)
|
92
101
|
@transaction = Transaction._new(gateway, @subject[:transaction]) if @subject.has_key?(:transaction)
|
102
|
+
@transaction_review = OpenStruct.new(@subject[:transaction_review]) if @subject.has_key?(:transaction_review)
|
93
103
|
@disbursement = Disbursement._new(gateway, @subject[:disbursement]) if @subject.has_key?(:disbursement)
|
94
104
|
@dispute = Dispute._new(@subject[:dispute]) if @subject.has_key?(:dispute)
|
95
105
|
@account_updater_daily_report = AccountUpdaterDailyReport._new(@subject[:account_updater_daily_report]) if @subject.has_key?(:account_updater_daily_report)
|
@@ -98,7 +108,11 @@ module Braintree
|
|
98
108
|
@granted_payment_instrument_update = GrantedPaymentInstrumentUpdate._new(@subject[:granted_payment_instrument_update]) if @subject.has_key?(:granted_payment_instrument_update)
|
99
109
|
@revoked_payment_method_metadata = RevokedPaymentMethodMetadata._new(gateway, @subject) if [Kind::GrantedPaymentInstrumentRevoked, Kind::PaymentMethodRevokedByCustomer, Kind::GrantedPaymentMethodRevoked].include?(@kind)
|
100
110
|
@local_payment_completed = LocalPaymentCompleted._new(@subject[:local_payment]) if @subject.has_key?(:local_payment) && Kind::LocalPaymentCompleted == @kind
|
111
|
+
@local_payment_expired = LocalPaymentExpired._new(@subject[:local_payment_expired]) if @subject.has_key?(:local_payment_expired) && Kind::LocalPaymentExpired == @kind
|
112
|
+
@local_payment_funded = LocalPaymentFunded._new(@subject[:local_payment_funded]) if @subject.has_key?(:local_payment_funded) && Kind::LocalPaymentFunded == @kind
|
101
113
|
@local_payment_reversed = LocalPaymentReversed._new(@subject[:local_payment_reversed]) if @subject.has_key?(:local_payment_reversed) && Kind::LocalPaymentReversed == @kind
|
114
|
+
@payment_method_customer_data_updated_metadata = PaymentMethodCustomerDataUpdatedMetadata._new(gateway, @subject[:payment_method_customer_data_updated_metadata]) if @subject.has_key?(:payment_method_customer_data_updated_metadata) && Kind::PaymentMethodCustomerDataUpdated == @kind
|
115
|
+
|
102
116
|
end
|
103
117
|
|
104
118
|
def merchant_account
|
@@ -60,6 +60,8 @@ module Braintree
|
|
60
60
|
_merchant_account_declined_sample_xml(id)
|
61
61
|
when Braintree::WebhookNotification::Kind::TransactionDisbursed
|
62
62
|
_transaction_disbursed_sample_xml(id)
|
63
|
+
when Braintree::WebhookNotification::Kind::TransactionReviewed
|
64
|
+
_transaction_reviewed_sample_xml(id)
|
63
65
|
when Braintree::WebhookNotification::Kind::TransactionSettled
|
64
66
|
_transaction_settled_sample_xml(id)
|
65
67
|
when Braintree::WebhookNotification::Kind::TransactionSettlementDeclined
|
@@ -88,8 +90,14 @@ module Braintree
|
|
88
90
|
_payment_method_revoked_by_customer_sample_xml(id)
|
89
91
|
when Braintree::WebhookNotification::Kind::LocalPaymentCompleted
|
90
92
|
_local_payment_completed_sample_xml(id)
|
93
|
+
when Braintree::WebhookNotification::Kind::LocalPaymentExpired
|
94
|
+
_local_payment_expired_sample_xml
|
95
|
+
when Braintree::WebhookNotification::Kind::LocalPaymentFunded
|
96
|
+
_local_payment_funded_sample_xml(id)
|
91
97
|
when Braintree::WebhookNotification::Kind::LocalPaymentReversed
|
92
|
-
_local_payment_reversed_sample_xml
|
98
|
+
_local_payment_reversed_sample_xml
|
99
|
+
when Braintree::WebhookNotification::Kind::PaymentMethodCustomerDataUpdated
|
100
|
+
_payment_method_customer_data_updated_sample_xml(id)
|
93
101
|
else
|
94
102
|
_subscription_sample_xml(id)
|
95
103
|
end
|
@@ -244,6 +252,19 @@ module Braintree
|
|
244
252
|
XML
|
245
253
|
end
|
246
254
|
|
255
|
+
def _transaction_reviewed_sample_xml(id)
|
256
|
+
|
257
|
+
<<-XML
|
258
|
+
<transaction-review>
|
259
|
+
<transaction-id>my_id</transaction-id>
|
260
|
+
<decision>decision</decision>
|
261
|
+
<reviewer-email>hey@girl.com</reviewer-email>
|
262
|
+
<reviewer-note>i reviewed this</reviewer-note>
|
263
|
+
<reviewed-time type="datetime">2017-06-16T20:44:41Z</reviewed-time>
|
264
|
+
</transaction-review>
|
265
|
+
XML
|
266
|
+
end
|
267
|
+
|
247
268
|
def _transaction_settled_sample_xml(id)
|
248
269
|
<<-XML
|
249
270
|
<transaction>
|
@@ -880,21 +901,7 @@ module Braintree
|
|
880
901
|
end
|
881
902
|
|
882
903
|
def _granted_payment_method_revoked_xml(id)
|
883
|
-
|
884
|
-
<venmo-account>
|
885
|
-
<created-at type='dateTime'>2018-10-11T21:28:37Z</created-at>
|
886
|
-
<updated-at type='dateTime'>2018-10-11T21:28:37Z</updated-at>
|
887
|
-
<default type='boolean'>true</default>
|
888
|
-
<image-url>https://assets.braintreegateway.com/payment_method_logo/venmo.png?environment=test</image-url>
|
889
|
-
<token>#{id}</token>
|
890
|
-
<source-description>Venmo Account: venmojoe</source-description>
|
891
|
-
<username>venmojoe</username>
|
892
|
-
<venmo-user-id>456</venmo-user-id>
|
893
|
-
<subscriptions type='array'/>
|
894
|
-
<customer-id>venmo_customer_id</customer-id>
|
895
|
-
<global-id>cGF5bWVudG1ldGhvZF92ZW5tb2FjY291bnQ</global-id>
|
896
|
-
</venmo-account>
|
897
|
-
XML
|
904
|
+
_venmo_account_xml(id)
|
898
905
|
end
|
899
906
|
|
900
907
|
def _payment_method_revoked_by_customer_sample_xml(id)
|
@@ -935,12 +942,79 @@ module Braintree
|
|
935
942
|
XML
|
936
943
|
end
|
937
944
|
|
938
|
-
def
|
945
|
+
def _local_payment_expired_sample_xml
|
946
|
+
<<-XML
|
947
|
+
<local-payment-expired>
|
948
|
+
<payment-id>PAY-XYZ123</payment-id>
|
949
|
+
<payment-context-id>cG5b=</payment-context-id>
|
950
|
+
</local-payment-expired>
|
951
|
+
XML
|
952
|
+
end
|
953
|
+
|
954
|
+
def _local_payment_funded_sample_xml(id)
|
955
|
+
<<-XML
|
956
|
+
<local-payment-funded>
|
957
|
+
<payment-id>PAY-XYZ123</payment-id>
|
958
|
+
<payment-context-id>cG5b=</payment-context-id>
|
959
|
+
<transaction>
|
960
|
+
<id>#{id}</id>
|
961
|
+
<status>settled</status>
|
962
|
+
<amount>49.99</amount>
|
963
|
+
<order-id>order4567</order-id>
|
964
|
+
</transaction>
|
965
|
+
</local-payment-funded>
|
966
|
+
XML
|
967
|
+
end
|
968
|
+
|
969
|
+
def _local_payment_reversed_sample_xml
|
939
970
|
<<-XML
|
940
971
|
<local-payment-reversed>
|
941
972
|
<payment-id>PAY-XYZ123</payment-id>
|
973
|
+
<payment-context-id>cG5b=</payment-context-id>
|
942
974
|
</local-payment-reversed>
|
943
975
|
XML
|
944
976
|
end
|
977
|
+
|
978
|
+
def _payment_method_customer_data_updated_sample_xml(id)
|
979
|
+
<<-XML
|
980
|
+
<payment-method-customer-data-updated-metadata>
|
981
|
+
<token>TOKEN-12345</token>
|
982
|
+
<payment-method>
|
983
|
+
#{_venmo_account_xml(id)}
|
984
|
+
</payment-method>
|
985
|
+
<datetime-updated type='dateTime'>2022-01-01T21:28:37Z</datetime-updated>
|
986
|
+
<enriched-customer-data>
|
987
|
+
<fields-updated type='array'>
|
988
|
+
<item>username</item>
|
989
|
+
</fields-updated>
|
990
|
+
<profile-data>
|
991
|
+
<username>venmo_username</username>
|
992
|
+
<first-name>John</first-name>
|
993
|
+
<last-name>Doe</last-name>
|
994
|
+
<phone-number>1231231234</phone-number>
|
995
|
+
<email>john.doe@paypal.com</email>
|
996
|
+
</profile-data>
|
997
|
+
</enriched-customer-data>
|
998
|
+
</payment-method-customer-data-updated-metadata>
|
999
|
+
XML
|
1000
|
+
end
|
1001
|
+
|
1002
|
+
def _venmo_account_xml(id)
|
1003
|
+
<<-XML
|
1004
|
+
<venmo-account>
|
1005
|
+
<created-at type='dateTime'>2018-10-11T21:28:37Z</created-at>
|
1006
|
+
<updated-at type='dateTime'>2018-10-11T21:28:37Z</updated-at>
|
1007
|
+
<default type='boolean'>true</default>
|
1008
|
+
<image-url>https://assets.braintreegateway.com/payment_method_logo/venmo.png?environment=test</image-url>
|
1009
|
+
<token>#{id}</token>
|
1010
|
+
<source-description>Venmo Account: venmojoe</source-description>
|
1011
|
+
<username>venmojoe</username>
|
1012
|
+
<venmo-user-id>456</venmo-user-id>
|
1013
|
+
<subscriptions type='array'/>
|
1014
|
+
<customer-id>venmo_customer_id</customer-id>
|
1015
|
+
<global-id>cGF5bWVudG1ldGhvZF92ZW5tb2FjY291bnQ</global-id>
|
1016
|
+
</venmo-account>
|
1017
|
+
XML
|
1018
|
+
end
|
945
1019
|
end
|
946
1020
|
end
|
data/lib/braintree.rb
CHANGED
@@ -65,6 +65,7 @@ require "braintree/dispute/transaction"
|
|
65
65
|
require "braintree/dispute/transaction_details"
|
66
66
|
require "braintree/document_upload"
|
67
67
|
require "braintree/document_upload_gateway"
|
68
|
+
require "braintree/enriched_customer_data"
|
68
69
|
require "braintree/error_codes"
|
69
70
|
require "braintree/error_result"
|
70
71
|
require "braintree/errors"
|
@@ -73,6 +74,8 @@ require "braintree/graphql_client"
|
|
73
74
|
require "braintree/google_pay_card"
|
74
75
|
require "braintree/local_payment_completed"
|
75
76
|
require "braintree/local_payment_reversed"
|
77
|
+
require "braintree/local_payment_expired"
|
78
|
+
require "braintree/local_payment_funded"
|
76
79
|
require "braintree/transaction/local_payment_details"
|
77
80
|
require "braintree/merchant"
|
78
81
|
require "braintree/merchant_gateway"
|
@@ -86,6 +89,7 @@ require "braintree/oauth_gateway"
|
|
86
89
|
require "braintree/oauth_credentials"
|
87
90
|
require "braintree/payment_instrument_type"
|
88
91
|
require "braintree/payment_method"
|
92
|
+
require "braintree/payment_method_customer_data_updated_metadata"
|
89
93
|
require "braintree/payment_method_gateway"
|
90
94
|
require "braintree/payment_method_nonce"
|
91
95
|
require "braintree/payment_method_nonce_details"
|
@@ -153,6 +157,7 @@ require "braintree/dispute_search"
|
|
153
157
|
require "braintree/validation_error"
|
154
158
|
require "braintree/validation_error_collection"
|
155
159
|
require "braintree/venmo_account"
|
160
|
+
require "braintree/venmo_profile_data"
|
156
161
|
require "braintree/version"
|
157
162
|
require "braintree/visa_checkout_card"
|
158
163
|
require "braintree/samsung_pay_card"
|