Class: Paydunya::Onsite::Invoice

Inherits:
Checkout::Invoice show all
Defined in:
lib/paydunya/checkout/onsite_invoice.rb

Instance Attribute Summary collapse

Attributes inherited from Checkout::Invoice

#callback_url, #cancel_url, #currency, #custom_data, #customer, #description, #invoice_url, #items, #receipt_url, #return_url, #store, #taxes, #token, #total_amount

Attributes inherited from Checkout::Core

#description, #response_code, #response_text, #result, #status, #token, #transaction_id

Instance Method Summary collapse

Methods inherited from Checkout::Invoice

#add_channel, #add_channels, #add_custom_data, #add_item, #add_tax, #confirm, #get_custom_data, #get_customer_info, #get_items, #get_taxes, #initialize

Methods inherited from Checkout::Core

#push_results

Methods included from Utilities

#connection, #send_get_request, #send_post_request

Constructor Details

This class inherits a constructor from Paydunya::Checkout::Invoice

Instance Attribute Details

#invoice_tokenObject

Returns the value of attribute invoice_token.



4
5
6
# File 'lib/paydunya/checkout/onsite_invoice.rb', line 4

def invoice_token
  @invoice_token
end

Instance Method Details

#charge(opr_token, confirm_token) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/paydunya/checkout/onsite_invoice.rb', line 6

def charge(opr_token, confirm_token)
  result = send_post_request(Paydunya::Setup.opr_charge_base_url, {
                               token: opr_token,
                               confirm_token: confirm_token
                             })
  rebuild_invoice(result['invoice_data']) if result['response_code'] == '00'
  @response_code = result['response_code']
  @response_text = result['response_text']
  result['response_code'] == '00'
end

#create(account_alias) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/paydunya/checkout/onsite_invoice.rb', line 17

def create()
  result = send_post_request(Paydunya::Setup.opr_base_url, {
                               invoice_data: build_invoice_payload,
                               opr_data: {
                                 account_alias: 
                               }
                             })
  create_response(result)
end