Class: PaynetEasy::PaynetEasyApi::PaymentData::Payment
- Defined in:
- lib/paynet_easy/paynet_easy_api/payment_data/payment.rb
Constant Summary collapse
- STATUS_NEW =
Payment is new, and not processing
'new'
- STATUS_PREAUTH =
Payment is under preauth, or preauth is finished
'preauth'
- STATUS_CAPTURE =
Payment is under capture, or capture is finished
'capture'
- STATUS_RETURN =
Payment is under return, or return is finished
'return'
- @@allowed_statuses =
All allowed payment statuses
[ STATUS_PREAUTH, STATUS_CAPTURE, STATUS_RETURN ]
Instance Attribute Summary collapse
-
#amount ⇒ Object
Amount to be charged.
-
#billing_address ⇒ Object
Payment billing address.
-
#client_id ⇒ Object
Unique identifier of payment assigned by merchant.
-
#comment ⇒ Object
A short comment for payment.
-
#credit_card ⇒ Object
Payment credit card.
-
#currency ⇒ Object
Currency the transaction is charged in (three-letter currency code).
-
#customer ⇒ Object
Payment customer.
-
#description ⇒ Object
Brief payment description.
-
#destination ⇒ Object
Destination to where the payment goes.
-
#payment_transactions ⇒ Object
Payment transactions for payment.
-
#paynet_id ⇒ Object
Unique identifier of payment assigned by PaynetEasy.
-
#recurrent_card_from ⇒ Object
Payment source recurrent card.
-
#recurrent_card_to ⇒ Object
Payment destination recurrent card.
-
#status ⇒ Object
Payment status.
Instance Method Summary collapse
- #add_payment_transaction(payment_transaction) ⇒ Object
- #amount_in_cents ⇒ Object
- #has_payment_transaction?(payment_transaction) ⇒ Boolean
-
#has_processing_transaction? ⇒ Boolean
True, if the payment has a transaction that is currently being processed.
-
#new? ⇒ Boolean
True, if payment is new.
-
#paid? ⇒ Boolean
True, is payment is paid up.
-
#returned? ⇒ Boolean
True, if funds returned to customer.
Methods inherited from Data
Constructor Details
This class inherits a constructor from PaynetEasy::PaynetEasyApi::PaymentData::Data
Instance Attribute Details
#amount ⇒ Object
Amount to be charged
53 54 55 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 53 def amount @amount end |
#billing_address ⇒ Object
Payment billing address
78 79 80 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 78 def billing_address @billing_address end |
#client_id ⇒ Object
Unique identifier of payment assigned by merchant
33 34 35 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 33 def client_id @client_id end |
#comment ⇒ Object
A short comment for payment
63 64 65 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 63 def comment @comment end |
#credit_card ⇒ Object
Payment credit card
83 84 85 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 83 def credit_card @credit_card end |
#currency ⇒ Object
Currency the transaction is charged in (three-letter currency code)
58 59 60 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 58 def currency @currency end |
#customer ⇒ Object
Payment customer
73 74 75 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 73 def customer @customer end |
#description ⇒ Object
Brief payment description
43 44 45 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 43 def description @description end |
#destination ⇒ Object
Destination to where the payment goes
48 49 50 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 48 def destination @destination end |
#payment_transactions ⇒ Object
Payment transactions for payment
98 99 100 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 98 def payment_transactions @payment_transactions end |
#paynet_id ⇒ Object
Unique identifier of payment assigned by PaynetEasy
38 39 40 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 38 def paynet_id @paynet_id end |
#recurrent_card_from ⇒ Object
Payment source recurrent card
88 89 90 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 88 def recurrent_card_from @recurrent_card_from end |
#recurrent_card_to ⇒ Object
Payment destination recurrent card
93 94 95 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 93 def recurrent_card_to @recurrent_card_to end |
#status ⇒ Object
Payment status
68 69 70 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 68 def status @status end |
Instance Method Details
#add_payment_transaction(payment_transaction) ⇒ Object
148 149 150 151 152 153 154 155 156 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 148 def add_payment_transaction(payment_transaction) unless has_payment_transaction? payment_transaction @payment_transactions << payment_transaction end unless payment_transaction.payment === self payment_transaction.payment = self end end |
#amount_in_cents ⇒ Object
100 101 102 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 100 def amount_in_cents (amount * 100).to_i if amount end |
#has_payment_transaction?(payment_transaction) ⇒ Boolean
158 159 160 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 158 def has_payment_transaction?(payment_transaction) payment_transactions.include? payment_transaction end |
#has_processing_transaction? ⇒ Boolean
True, if the payment has a transaction that is currently being processed
163 164 165 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 163 def has_processing_transaction? payment_transactions.one? &:processing? end |
#new? ⇒ Boolean
True, if payment is new
176 177 178 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 176 def new? status == STATUS_NEW end |
#paid? ⇒ Boolean
True, is payment is paid up
181 182 183 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 181 def paid? [STATUS_PREAUTH, STATUS_CAPTURE].include? status end |
#returned? ⇒ Boolean
True, if funds returned to customer
186 187 188 |
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 186 def returned? status == STATUS_RETURN end |