Class: Walletone::Recurrent::Client
- Inherits:
-
Object
- Object
- Walletone::Recurrent::Client
- Defined in:
- lib/walletone/recurrent/client.rb
Constant Summary collapse
- RECURRENT_API =
'https://wl.walletone.com/checkout/invoicingapi/'
- INVOICE_CLASS =
Walletone::Recurrent::Invoice
- RESULT_INVOICE_CLASS =
Walletone::Recurrent::ResultInvoice
Instance Method Summary collapse
- #create_invoice(invoice) ⇒ Object
-
#initialize(merchant_id:, customer_id:, secret_key:, hash_type: Walletone::Signer::DEFAULT_HASH_TYPE) ⇒ Client
constructor
A new instance of Client.
- #make_payment(payment_id: nil, email: nil) ⇒ Object
Constructor Details
#initialize(merchant_id:, customer_id:, secret_key:, hash_type: Walletone::Signer::DEFAULT_HASH_TYPE) ⇒ Client
Returns a new instance of Client.
14 15 16 17 18 19 20 |
# File 'lib/walletone/recurrent/client.rb', line 14 def initialize(merchant_id:, customer_id:, secret_key:, hash_type: Walletone::Signer::DEFAULT_HASH_TYPE) @merchant_id = merchant_id.to_s @customer_id = customer_id.to_s @secret_key = secret_key.to_s @hash_type = hash_type @timestamp = Time.now.utc.strftime('%FT%T') end |
Instance Method Details
#create_invoice(invoice) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/walletone/recurrent/client.rb', line 22 def create_invoice(invoice) fail "Must be a #{INVOICE_CLASS} (#{invoice})" unless invoice.is_a? INVOICE_CLASS result = do_request RECURRENT_API + 'invoices', invoice.to_json RESULT_INVOICE_CLASS.new result end |
#make_payment(payment_id: nil, email: nil) ⇒ Object
30 31 32 33 34 |
# File 'lib/walletone/recurrent/client.rb', line 30 def make_payment(payment_id: nil, email: nil) body = { CustomerId: customer_id, CreditCardTerminal: 'Non3Ds', UseSavedAuthData: 'true', AuthData: { RecurrentCreditCardEmail: email } }.to_json do_request RECURRENT_API + "payments/#{payment_id}/process", body end |