Skip to content

Commit

Permalink
Create SolidusAfterpay::PaymentSource
Browse files Browse the repository at this point in the history
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
ChristianRimondi authored and mtylty committed Sep 2, 2021
1 parent 0606626 commit d9e5920
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/models/solidus_afterpay/payment_source.rb
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
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

0 comments on commit d9e5920

Please sign in to comment.