mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 16:32:04 +02:00
Add EveryPay payments
* Refactor BankLink into Payments::BankLink, add Payments::EveryPay * Write tests for existing invoice views * Write basic tests for Payments module
This commit is contained in:
parent
f7c2b25a66
commit
c5591b4828
32 changed files with 818 additions and 31 deletions
49
app/models/payments/base.rb
Normal file
49
app/models/payments/base.rb
Normal file
|
@ -0,0 +1,49 @@
|
|||
module Payments
|
||||
class Base
|
||||
include ActionView::Helpers::NumberHelper
|
||||
|
||||
attr_reader :type,
|
||||
:invoice,
|
||||
:return_url,
|
||||
:response_url,
|
||||
:response
|
||||
|
||||
def initialize(type, invoice, opts = {})
|
||||
@type = type
|
||||
@invoice = invoice
|
||||
@return_url = opts[:return_url]
|
||||
@response_url = opts[:response_url]
|
||||
@response = opts[:response]
|
||||
end
|
||||
|
||||
def create_transaction
|
||||
transaction = BankTransaction.where(description: invoice.order).first_or_initialize(
|
||||
reference_no: invoice.reference_no,
|
||||
currency: invoice.currency,
|
||||
iban: invoice.seller_iban
|
||||
)
|
||||
|
||||
transaction.save!
|
||||
end
|
||||
|
||||
def complete_transaction
|
||||
fail NotImplementedError
|
||||
end
|
||||
|
||||
def settled_payment?
|
||||
fail NotImplementedError
|
||||
end
|
||||
|
||||
def form_fields
|
||||
fail NotImplementedError
|
||||
end
|
||||
|
||||
def form_url
|
||||
ENV["#{type}_payment_url"]
|
||||
end
|
||||
|
||||
def valid_response?
|
||||
fail NotImplementedError
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue