Class: PaynetEasy::PaynetEasyApi::PaymentData::Payment

Inherits:
Data
  • Object
show all
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

Instance Method Summary collapse

Methods inherited from Data

#initialize

Constructor Details

This class inherits a constructor from PaynetEasy::PaynetEasyApi::PaymentData::Data

Instance Attribute Details

#amountObject

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_addressObject

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_idObject

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

#commentObject

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_cardObject

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

#currencyObject

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

#customerObject

Payment customer



73
74
75
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 73

def customer
  @customer
end

#descriptionObject

Brief payment description



43
44
45
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 43

def description
  @description
end

#destinationObject

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_transactionsObject

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_idObject

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_fromObject

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_toObject

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

#statusObject

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_centsObject



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

Returns:

  • (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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


186
187
188
# File 'lib/paynet_easy/paynet_easy_api/payment_data/payment.rb', line 186

def returned?
  status == STATUS_RETURN
end