Class: Instamojo::Payment
- Inherits:
-
Object
- Object
- Instamojo::Payment
- Includes:
- CommonObject
- Defined in:
- lib/client/payment.rb
Overview
"payment_id" => "MOJO3815000F72853519",
"quantity" => 1,
"status" => "Credit",
"link_slug" => "demo-product",
"link_title" => "Demo product",
"buyer_name" => "",
"buyer_phone" => "",
"buyer_email" => "[email protected]",
"currency" => "Free",
"unit_price" => "0.00",
"amount" => "0.00",
"fees" => "0",
"shipping_address" => nil,
"shipping_city" => nil,
"shipping_state" => nil,
"shipping_zip" => nil,
"shipping_country" => nil,
"discount_code" => nil,
"discount_amount_off" => nil,
"variants" => [],
"custom_fields" => {,
"affiliate_id" => nil,
"affiliate_commission" => nil,
"created_at" => "2013-08-15T13:16:24.629Z"
}
Instance Attribute Summary collapse
-
#affiliate_commission ⇒ Object
Returns the value of attribute affiliate_commission.
-
#affiliate_id ⇒ Object
Returns the value of attribute affiliate_id.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#buyer_email ⇒ Object
Returns the value of attribute buyer_email.
-
#buyer_name ⇒ Object
Returns the value of attribute buyer_name.
-
#buyer_phone ⇒ Object
Returns the value of attribute buyer_phone.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#custom_fields ⇒ Object
Returns the value of attribute custom_fields.
-
#discount_amount_off ⇒ Object
Returns the value of attribute discount_amount_off.
-
#discount_code ⇒ Object
Returns the value of attribute discount_code.
-
#fees ⇒ Object
Returns the value of attribute fees.
-
#link_slug ⇒ Object
Returns the value of attribute link_slug.
-
#link_title ⇒ Object
Returns the value of attribute link_title.
-
#original ⇒ Object
readonly
Returns the value of attribute original.
-
#payment_id ⇒ Object
Returns the value of attribute payment_id.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#shipping_address ⇒ Object
Returns the value of attribute shipping_address.
-
#shipping_city ⇒ Object
Returns the value of attribute shipping_city.
-
#shipping_country ⇒ Object
Returns the value of attribute shipping_country.
-
#shipping_state ⇒ Object
Returns the value of attribute shipping_state.
-
#shipping_zip ⇒ Object
Returns the value of attribute shipping_zip.
-
#status ⇒ Object
Returns the value of attribute status.
-
#unit_price ⇒ Object
Returns the value of attribute unit_price.
-
#variants ⇒ Object
Returns the value of attribute variants.
Instance Method Summary collapse
-
#initialize(payment, client) ⇒ Payment
constructor
A new instance of Payment.
-
#process_refund(hash = {}, &block) ⇒ Object
(also: #create_refund)
Process refund for this payment payment.process_refund(type: ‘QFL’, body: ‘Customer is not satisfied’).
- #to_s ⇒ Object
Methods included from CommonObject
#assign_values, #construct_hash, included, #reload, #reload!, #to_h, #to_json
Constructor Details
#initialize(payment, client) ⇒ Payment
Returns a new instance of Payment.
41 42 43 44 |
# File 'lib/client/payment.rb', line 41 def initialize(payment, client) assign_values(payment) @client = client # Reference to client end |
Instance Attribute Details
#affiliate_commission ⇒ Object
Returns the value of attribute affiliate_commission.
35 36 37 |
# File 'lib/client/payment.rb', line 35 def affiliate_commission @affiliate_commission end |
#affiliate_id ⇒ Object
Returns the value of attribute affiliate_id.
35 36 37 |
# File 'lib/client/payment.rb', line 35 def affiliate_id @affiliate_id end |
#amount ⇒ Object
Returns the value of attribute amount.
34 35 36 |
# File 'lib/client/payment.rb', line 34 def amount @amount end |
#buyer_email ⇒ Object
Returns the value of attribute buyer_email.
33 34 35 |
# File 'lib/client/payment.rb', line 33 def buyer_email @buyer_email end |
#buyer_name ⇒ Object
Returns the value of attribute buyer_name.
33 34 35 |
# File 'lib/client/payment.rb', line 33 def buyer_name @buyer_name end |
#buyer_phone ⇒ Object
Returns the value of attribute buyer_phone.
33 34 35 |
# File 'lib/client/payment.rb', line 33 def buyer_phone @buyer_phone end |
#created_at ⇒ Object
Returns the value of attribute created_at.
35 36 37 |
# File 'lib/client/payment.rb', line 35 def created_at @created_at end |
#currency ⇒ Object
Returns the value of attribute currency.
34 35 36 |
# File 'lib/client/payment.rb', line 34 def currency @currency end |
#custom_fields ⇒ Object
Returns the value of attribute custom_fields.
35 36 37 |
# File 'lib/client/payment.rb', line 35 def custom_fields @custom_fields end |
#discount_amount_off ⇒ Object
Returns the value of attribute discount_amount_off.
35 36 37 |
# File 'lib/client/payment.rb', line 35 def discount_amount_off @discount_amount_off end |
#discount_code ⇒ Object
Returns the value of attribute discount_code.
35 36 37 |
# File 'lib/client/payment.rb', line 35 def discount_code @discount_code end |
#fees ⇒ Object
Returns the value of attribute fees.
34 35 36 |
# File 'lib/client/payment.rb', line 34 def fees @fees end |
#link_slug ⇒ Object
Returns the value of attribute link_slug.
33 34 35 |
# File 'lib/client/payment.rb', line 33 def link_slug @link_slug end |
#link_title ⇒ Object
Returns the value of attribute link_title.
33 34 35 |
# File 'lib/client/payment.rb', line 33 def link_title @link_title end |
#original ⇒ Object (readonly)
Returns the value of attribute original.
37 38 39 |
# File 'lib/client/payment.rb', line 37 def original @original end |
#payment_id ⇒ Object
Returns the value of attribute payment_id.
33 34 35 |
# File 'lib/client/payment.rb', line 33 def payment_id @payment_id end |
#quantity ⇒ Object
Returns the value of attribute quantity.
33 34 35 |
# File 'lib/client/payment.rb', line 33 def quantity @quantity end |
#shipping_address ⇒ Object
Returns the value of attribute shipping_address.
34 35 36 |
# File 'lib/client/payment.rb', line 34 def shipping_address @shipping_address end |
#shipping_city ⇒ Object
Returns the value of attribute shipping_city.
34 35 36 |
# File 'lib/client/payment.rb', line 34 def shipping_city @shipping_city end |
#shipping_country ⇒ Object
Returns the value of attribute shipping_country.
35 36 37 |
# File 'lib/client/payment.rb', line 35 def shipping_country @shipping_country end |
#shipping_state ⇒ Object
Returns the value of attribute shipping_state.
34 35 36 |
# File 'lib/client/payment.rb', line 34 def shipping_state @shipping_state end |
#shipping_zip ⇒ Object
Returns the value of attribute shipping_zip.
34 35 36 |
# File 'lib/client/payment.rb', line 34 def shipping_zip @shipping_zip end |
#status ⇒ Object
Returns the value of attribute status.
33 34 35 |
# File 'lib/client/payment.rb', line 33 def status @status end |
#unit_price ⇒ Object
Returns the value of attribute unit_price.
34 35 36 |
# File 'lib/client/payment.rb', line 34 def unit_price @unit_price end |
#variants ⇒ Object
Returns the value of attribute variants.
35 36 37 |
# File 'lib/client/payment.rb', line 35 def variants @variants end |
Instance Method Details
#process_refund(hash = {}, &block) ⇒ Object Also known as: create_refund
Process refund for this payment payment.process_refund(type: ‘QFL’, body: ‘Customer is not satisfied’)
48 49 50 51 |
# File 'lib/client/payment.rb', line 48 def process_refund(hash = {}, &block) hash[:payment_id] = self.payment_id @client.create_refund(hash, &block) end |
#to_s ⇒ Object
53 54 55 56 |
# File 'lib/client/payment.rb', line 53 def to_s sprintf("Instamojo Payment(payment_id: %s, quantity: %s, amount: %s, status: %s, link_slug: %s, buyer_name: %s)", payment_id, quantity, amount, status, link_slug, buyer_name) end |