Class: AmplifypayRuby::Checkout::Invoice
- Defined in:
- lib/amplifypay_ruby/checkout/redirect_invoice.rb
Instance Attribute Summary collapse
-
#customer ⇒ Object
Returns the value of attribute customer.
-
#invoice_url ⇒ Object
Returns the value of attribute invoice_url.
-
#paymentDescription ⇒ Object
Returns the value of attribute paymentDescription.
-
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
-
#response_text ⇒ Object
Returns the value of attribute response_text.
-
#status_code ⇒ Object
Returns the value of attribute status_code.
-
#status_desc ⇒ Object
Returns the value of attribute status_desc.
-
#store ⇒ Object
Returns the value of attribute store.
-
#total_amount ⇒ Object
Returns the value of attribute total_amount.
-
#trans_id ⇒ Object
Returns the value of attribute trans_id.
-
#transaction_ref ⇒ Object
Returns the value of attribute transaction_ref.
Attributes inherited from Core
#description, #invoice_token, #response_code, #result, #status, #token, #transaction_id
Instance Method Summary collapse
- #confirm(token) ⇒ Object
- #create ⇒ Object
- #get_custom_data(key) ⇒ Object
- #get_customer_info(key) ⇒ Object
-
#initialize ⇒ Invoice
constructor
A new instance of Invoice.
Methods inherited from 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.
8 9 10 11 12 13 14 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 8 def initialize @trans_id = "22" @customer = {} @total_amount = 0.0 @redirect_url = "" @paymentDescription = "" end |
Instance Attribute Details
#customer ⇒ Object
Returns the value of attribute customer.
6 7 8 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 6 def customer @customer end |
#invoice_url ⇒ Object
Returns the value of attribute invoice_url.
6 7 8 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 6 def invoice_url @invoice_url end |
#paymentDescription ⇒ Object
Returns the value of attribute paymentDescription.
5 6 7 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 5 def paymentDescription @paymentDescription end |
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
5 6 7 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 5 def redirect_url @redirect_url end |
#response_text ⇒ Object
Returns the value of attribute response_text.
6 7 8 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 6 def response_text @response_text end |
#status_code ⇒ Object
Returns the value of attribute status_code.
6 7 8 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 6 def status_code @status_code end |
#status_desc ⇒ Object
Returns the value of attribute status_desc.
6 7 8 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 6 def status_desc @status_desc end |
#store ⇒ Object
Returns the value of attribute store.
5 6 7 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 5 def store @store end |
#total_amount ⇒ Object
Returns the value of attribute total_amount.
5 6 7 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 5 def total_amount @total_amount end |
#trans_id ⇒ Object
Returns the value of attribute trans_id.
6 7 8 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 6 def trans_id @trans_id end |
#transaction_ref ⇒ Object
Returns the value of attribute transaction_ref.
6 7 8 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 6 def transaction_ref @transaction_ref end |
Instance Method Details
#confirm(token) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 24 def confirm(token) verification_payload = build_verification_payload(token) result = http_json_request(AmplifypayRuby::Setup.checkout_confirm_base_url, verification_payload) if result["StatusDesc"] == "Approved" # rebuild_invoice(result) @response_text = "Payment was successful" true else @status = result["status"] @response_text = "Invoice status is #{result['StatusDesc'].upcase}" false end end |
#create ⇒ Object
39 40 41 42 43 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 39 def create result = http_json_request(AmplifypayRuby::Setup.checkout_base_url,build_invoice_payload) @store = result.inspect create_response(result) end |
#get_custom_data(key) ⇒ Object
20 21 22 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 20 def get_custom_data(key) @custom_data["#{key}"] end |
#get_customer_info(key) ⇒ Object
16 17 18 |
# File 'lib/amplifypay_ruby/checkout/redirect_invoice.rb', line 16 def get_customer_info(key) @customer["#{key}"] end |