Class: MPower::Onsite::Invoice
- Inherits:
-
Checkout::Invoice
- Object
- Checkout::Core
- Checkout::Invoice
- MPower::Onsite::Invoice
- Defined in:
- lib/mpower/checkout/onsite_invoice.rb
Instance Attribute Summary
Attributes inherited from Checkout::Invoice
#cancel_url, #currency, #custom_data, #customer, #description, #invoice_token, #invoice_url, #items, #receipt_url, #return_url, #store, #taxes, #total_amount
Attributes inherited from Checkout::Core
#description, #invoice_token, #response_code, #response_text, #result, #status, #token, #transaction_id
Instance Method Summary collapse
- #charge(opr_token, confirm_token) ⇒ Object
- #create(account_alias) ⇒ Object
-
#initialize ⇒ Invoice
constructor
A new instance of Invoice.
Methods inherited from Checkout::Invoice
#add_custom_data, #add_item, #add_tax, #confirm, #get_custom_data, #get_customer_info, #get_items, #get_taxes
Methods inherited from Checkout::Core
Methods included from Utilities
#hash_to_json, #http_get_request, #http_json_request, #json_to_hash
Constructor Details
#initialize ⇒ Invoice
Returns a new instance of Invoice.
4 5 6 |
# File 'lib/mpower/checkout/onsite_invoice.rb', line 4 def initialize super end |
Instance Method Details
#charge(opr_token, confirm_token) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/mpower/checkout/onsite_invoice.rb', line 8 def charge(opr_token,confirm_token) payload = { :token => opr_token, :confirm_token => confirm_token } result = http_json_request(MPower::Setup.opr_charge_base_url,payload) if result["response_code"] == "00" rebuild_invoice(result["invoice_data"]) @response_code = result["response_code"] @response_text = result["response_text"] true else @response_code = result["response_code"] @response_text = result["response_text"] false end end |
#create(account_alias) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/mpower/checkout/onsite_invoice.rb', line 28 def create(account_alias) payload = { :invoice_data => build_invoice_payload, :opr_data => { :account_alias => account_alias } } result = http_json_request(MPower::Setup.opr_base_url,payload) create_response(result) end |