Class: Paynow::Payment
- Inherits:
-
Object
- Object
- Paynow::Payment
- Defined in:
- lib/paynow/payment.rb
Overview
Value object with information about the payment
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#buyer ⇒ Object
readonly
Returns the value of attribute buyer.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#external_id ⇒ Object
readonly
Returns the value of attribute external_id.
-
#payment_id ⇒ Object
readonly
Returns the value of attribute payment_id.
-
#redirect_url ⇒ Object
readonly
Returns the value of attribute redirect_url.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
- #created? ⇒ Boolean
-
#initialize(attributes) ⇒ Payment
constructor
A new instance of Payment.
Constructor Details
#initialize(attributes) ⇒ Payment
Returns a new instance of Payment.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/paynow/payment.rb', line 19 def initialize(attributes) @response = attributes[:response] @amount = attributes[:amount] @description = attributes[:description] @buyer = attributes[:buyer] @payment_id = attributes[:payment_id] @status = attributes[:status] @redirect_url = attributes[:redirect_url] @external_id = attributes[:external_id] end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
6 7 8 |
# File 'lib/paynow/payment.rb', line 6 def amount @amount end |
#buyer ⇒ Object (readonly)
Returns the value of attribute buyer.
6 7 8 |
# File 'lib/paynow/payment.rb', line 6 def buyer @buyer end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/paynow/payment.rb', line 6 def description @description end |
#external_id ⇒ Object (readonly)
Returns the value of attribute external_id.
6 7 8 |
# File 'lib/paynow/payment.rb', line 6 def external_id @external_id end |
#payment_id ⇒ Object (readonly)
Returns the value of attribute payment_id.
6 7 8 |
# File 'lib/paynow/payment.rb', line 6 def payment_id @payment_id end |
#redirect_url ⇒ Object (readonly)
Returns the value of attribute redirect_url.
6 7 8 |
# File 'lib/paynow/payment.rb', line 6 def redirect_url @redirect_url end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/paynow/payment.rb', line 6 def response @response end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/paynow/payment.rb', line 6 def status @status end |
Class Method Details
.create(*args) ⇒ Object
15 16 17 |
# File 'lib/paynow/payment.rb', line 15 def self.create(*args) Paynow::Configuration.gateway.create_payment(*args) end |
Instance Method Details
#created? ⇒ Boolean
30 31 32 |
# File 'lib/paynow/payment.rb', line 30 def created? response.code == '201' && status == 'NEW' end |