-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create SolidusAfterpay::PaymentSource
To keep track of the checkout with Afterpay and the Payment in Solidus we need a model that will be the Source of the Payment when payed with the Afterpay PaymentMethod.
- Loading branch information
1 parent
0606626
commit d9e5920
Showing
2 changed files
with
21 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module SolidusAfterpay | ||
class PaymentSource < SolidusSupport.payment_source_parent_class | ||
self.table_name = 'solidus_afterpay_payment_sources' | ||
|
||
validates :token, presence: true | ||
end | ||
end |
12 changes: 12 additions & 0 deletions
12
db/migrate/20210813142725_create_solidus_afterpay_payment_sources.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,12 @@ | ||
class CreateSolidusAfterpayPaymentSources < SolidusSupport::Migration[4.2] | ||
def change | ||
create_table :solidus_afterpay_payment_sources do |t| | ||
t.string :token | ||
t.references :payment_method, index: true | ||
|
||
t.timestamps | ||
end | ||
|
||
add_foreign_key :solidus_afterpay_payment_sources, :spree_payment_methods, column: :payment_method_id | ||
end | ||
end |