This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #232 from nebulab/3ds-support
Introduce 3D Secure support for credit cards
- Loading branch information
Showing
14 changed files
with
222 additions
and
21 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
10 changes: 10 additions & 0 deletions
10
app/controllers/solidus_paypal_braintree/checkout_controller_decorator.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,10 @@ | ||
module SolidusPaypalBraintree | ||
module CheckoutControllerDecorator | ||
|
||
def self.prepended(base) | ||
base.helper ::SolidusPaypalBraintree::BraintreeCheckoutHelper | ||
end | ||
|
||
::Spree::CheckoutController.prepend(self) | ||
end | ||
end |
44 changes: 44 additions & 0 deletions
44
app/helpers/solidus_paypal_braintree/braintree_checkout_helper.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,44 @@ | ||
# frozen_string_literal: true | ||
|
||
module SolidusPaypalBraintree | ||
module BraintreeCheckoutHelper | ||
|
||
def braintree_3ds_options_for(order) | ||
ship_address = order.ship_address | ||
bill_address = order.bill_address | ||
|
||
{ | ||
nonce: nil, # populated after tokenization | ||
bin: nil, # populated after tokenization | ||
onLookupComplete: nil, # populated after tokenization | ||
amount: order.total, | ||
email: order.email, | ||
billingAddress: { | ||
givenName: bill_address.firstname, | ||
surname: bill_address.lastname, | ||
phoneNumber: bill_address.phone, | ||
streetAddress: bill_address.address1, | ||
extendedAddress: bill_address.address2, | ||
locality: bill_address.city, | ||
region: bill_address.state&.name, | ||
postalCode: bill_address.zipcode, | ||
countryCodeAlpha2: bill_address.country&.iso, | ||
}, | ||
additionalInformation: { | ||
shippingGivenName: ship_address.firstname, | ||
shippingSurname: ship_address.lastname, | ||
shippingPhone: ship_address.phone, | ||
shippingAddress: { | ||
streedAddress: ship_address.address1, | ||
extendedAddress: ship_address.address2, | ||
locality: ship_address.city, | ||
region: ship_address.state&.name, | ||
postalCode: ship_address.zipcode, | ||
countryCodeAlpha2: ship_address.country&.iso, | ||
} | ||
} | ||
} | ||
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
14 changes: 9 additions & 5 deletions
14
app/views/spree/shared/_paypal_braintree_head_scripts.html.erb
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
6 changes: 6 additions & 0 deletions
6
db/migrate/20190911141712_add_3d_secure_to_braintree_configuration.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,6 @@ | ||
class Add3dSecureToBraintreeConfiguration < SolidusSupport::Migration[4.2] | ||
def change | ||
add_column :solidus_paypal_braintree_configurations, :three_d_secure, :boolean, null: false, default: false | ||
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
Oops, something went wrong.