Class: CloudPayments::Transaction
- Inherits:
-
Model
- Object
- Hashie::Trash
- Model
- CloudPayments::Transaction
show all
- Defined in:
- lib/cloud_payments/models/transaction.rb
Constant Summary
collapse
- AWAITING_AUTHENTICATION =
'AwaitingAuthentication'
- COMPLECTED =
'Completed'
- AUTHORIZED =
'Authorized'
- CANCELLED =
'Cancelled'
- DECLINED =
'Declined'
Constants inherited
from Model
Model::BooleanTransform, Model::DateTimeTransform, Model::DecimalTransform, Model::IntegralTransform
Instance Method Summary
collapse
Instance Method Details
#authorized? ⇒ Boolean
76
77
78
|
# File 'lib/cloud_payments/models/transaction.rb', line 76
def authorized?
status == AUTHORIZED
end
|
#awaiting_authentication? ⇒ Boolean
68
69
70
|
# File 'lib/cloud_payments/models/transaction.rb', line 68
def awaiting_authentication?
status == AWAITING_AUTHENTICATION
end
|
#cancelled? ⇒ Boolean
80
81
82
|
# File 'lib/cloud_payments/models/transaction.rb', line 80
def cancelled?
status == CANCELLED
end
|
#card_number ⇒ Object
60
61
62
|
# File 'lib/cloud_payments/models/transaction.rb', line 60
def card_number
@card_number ||= "#{card_first_six}XXXXXX#{card_last_four}".gsub(/(.{4})/, '\1 ').rstrip
end
|
#completed? ⇒ Boolean
72
73
74
|
# File 'lib/cloud_payments/models/transaction.rb', line 72
def completed?
status == COMPLECTED
end
|
#declined? ⇒ Boolean
84
85
86
|
# File 'lib/cloud_payments/models/transaction.rb', line 84
def declined?
status == DECLINED
end
|
#ip_location ⇒ Object
64
65
66
|
# File 'lib/cloud_payments/models/transaction.rb', line 64
def ip_location
[ip_lat, ip_lng] if ip_lng && ip_lat
end
|
#refunded? ⇒ Boolean
88
89
90
|
# File 'lib/cloud_payments/models/transaction.rb', line 88
def refunded?
refunded
end
|
#required_secure3d? ⇒ Boolean
52
53
54
|
# File 'lib/cloud_payments/models/transaction.rb', line 52
def required_secure3d?
false
end
|
#subscription ⇒ Object
56
57
58
|
# File 'lib/cloud_payments/models/transaction.rb', line 56
def subscription
@subscription ||= CloudPayments.client.subscriptions.find(subscription_id) if subscription_id
end
|