-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c523c2d
commit 7a01335
Showing
42 changed files
with
892 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
module Braintree | ||
module PaymentInstrumentType | ||
PayPalAccount = "paypal_account" | ||
CreditCard = "credit_card" | ||
ApplePayCard = "apple_pay_card" | ||
CreditCard = "credit_card" | ||
GooglePayCard = "android_pay_card" | ||
VenmoAccount = "venmo_account" | ||
UsBankAccount = "us_bank_account" | ||
VisaCheckoutCard = "visa_checkout_card" | ||
SamsungPayCard = "samsung_pay_card" | ||
LocalPayment = "local_payment" | ||
PayPalAccount = "paypal_account" | ||
PayPalHere = "paypal_here" | ||
SamsungPayCard = "samsung_pay_card" | ||
SepaDirectDebitAccount = "sepa_debit_account" | ||
UsBankAccount = "us_bank_account" | ||
VenmoAccount = "venmo_account" | ||
VisaCheckoutCard = "visa_checkout_card" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
module Braintree | ||
class SepaDirectDebitAccount | ||
include BaseModule | ||
|
||
attr_reader :bank_reference_token | ||
attr_reader :created_at | ||
attr_reader :customer_id | ||
attr_reader :customer_global_id | ||
attr_reader :default | ||
attr_reader :global_id | ||
attr_reader :image_url | ||
attr_reader :last_4 | ||
attr_reader :mandate_type | ||
attr_reader :merchant_or_partner_customer_id | ||
attr_reader :token | ||
attr_reader :updated_at | ||
attr_reader :view_mandate_url | ||
|
||
def initialize(gateway, attributes) # :nodoc: | ||
@gateway = gateway | ||
set_instance_variables_from_hash(attributes) | ||
end | ||
|
||
def default? | ||
@default | ||
end | ||
|
||
class << self | ||
protected :new | ||
end | ||
|
||
def self._new(*args) # :nodoc: | ||
self.new(*args) | ||
end | ||
|
||
def self.find(*args) | ||
Configuration.gateway.sepa_direct_debit_account.find(*args) | ||
end | ||
|
||
def self.delete(*args) | ||
Configuration.gateway.sepa_direct_debit_account.delete(*args) | ||
end | ||
|
||
def self.sale(token, transaction_attributes) | ||
options = transaction_attributes[:options] || {} | ||
Configuration.gateway.transaction.sale( | ||
transaction_attributes.merge( | ||
:payment_method_token => token, | ||
:options => options.merge(:submit_for_settlement => true), | ||
), | ||
) | ||
end | ||
|
||
def self.sale!(token, transaction_attributes) | ||
return_object_or_raise(:transaction) { sale(token, transaction_attributes) } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module Braintree | ||
class SepaDirectDebitAccountGateway | ||
def initialize(gateway) | ||
@gateway = gateway | ||
@config = gateway.config | ||
@config.assert_has_access_token_or_keys | ||
end | ||
|
||
def find(token) | ||
raise ArgumentError if token.nil? || token.to_s.strip == "" | ||
response = @config.http.get("#{@config.base_merchant_path}/payment_methods/sepa_debit_account/#{token}") | ||
SepaDirectDebitAccount._new(@gateway, response[:sepa_debit_account]) | ||
rescue NotFoundError | ||
raise NotFoundError, "sepa direct debit account with token #{token.inspect} not found" | ||
end | ||
|
||
def delete(token) | ||
raise ArgumentError if token.nil? || token.to_s.strip == "" | ||
@config.http.delete("#{@config.base_merchant_path}/payment_methods/sepa_debit_account/#{token}") | ||
SuccessfulResult.new | ||
rescue NotFoundError | ||
raise NotFoundError, "sepa direct debit account with token #{token.inspect} not found" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module Braintree | ||
class SepaDirectDebitAccountNonceDetails# :nodoc: | ||
include BaseModule | ||
|
||
attr_reader :bank_reference_token | ||
attr_reader :last_4 | ||
attr_reader :mandate_type | ||
attr_reader :merchant_or_partner_customer_id | ||
|
||
def initialize(attributes) | ||
set_instance_variables_from_hash attributes unless attributes.nil? | ||
end | ||
|
||
def inspect | ||
attr_order = [ | ||
:bank_reference_token, | ||
:last_4, | ||
:mandate_type, | ||
:merchant_or_partner_customer_id, | ||
] | ||
|
||
formatted_attrs = attr_order.map do |attr| | ||
"#{attr}: #{send(attr).inspect}" | ||
end | ||
"#<SepaDirectDebitAccountNonceDetails#{formatted_attrs.join(", ")}>" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
lib/braintree/transaction/sepa_direct_debit_account_details.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module Braintree | ||
class Transaction | ||
class SepaDirectDebitAccountDetails # :nodoc: | ||
include BaseModule | ||
|
||
attr_reader :bank_reference_token | ||
attr_reader :capture_id | ||
attr_reader :debug_id | ||
attr_reader :global_id | ||
attr_reader :last_4 | ||
attr_reader :mandate_type | ||
attr_reader :merchant_or_partner_customer_id | ||
attr_reader :paypal_v2_order_id | ||
attr_reader :refund_from_transaction_fee_amount | ||
attr_reader :refund_from_transaction_fee_currency_iso_code | ||
attr_reader :refund_id | ||
attr_reader :settlement_type | ||
attr_reader :token | ||
attr_reader :transaction_fee_amount | ||
attr_reader :transaction_fee_currency_iso_code | ||
|
||
def initialize(attributes) | ||
set_instance_variables_from_hash attributes unless attributes.nil? | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.