Class: Poundpay::Payment
Instance Method Summary
collapse
Methods inherited from Resource
#collection_name, collection_path, element_path, #encode, instantiate_collection, new_element_path
Instance Method Details
#authorize ⇒ Object
74
75
76
77
78
79
80
|
# File 'lib/poundpay/elements.rb', line 74
def authorize
unless status == 'STAGED'
raise PaymentAuthorizeException.new "Payment status is #{status}. Only STAGED payments may be AUTHORIZED."
end
attributes['status'] = 'AUTHORIZED'
save
end
|
#cancel ⇒ Object
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/poundpay/elements.rb', line 101
def cancel
statuses = ['AUTHORIZED', 'ESCROWED']
unless statuses.include?(status)
raise PaymentCancelException.new "Payment status is #{status}. Only payments with statuses " \
"#{statuses.join(', ')} may be canceled"
end
attributes['status'] = 'CANCELED'
save
end
|
#escrow ⇒ Object
82
83
84
85
86
87
88
|
# File 'lib/poundpay/elements.rb', line 82
def escrow
unless status == 'AUTHORIZED'
raise PaymentEscrowException.new "Payment status is #{status}. Only AUTHORIZED payments may be ESCROWED."
end
attributes['status'] = 'ESCROWED'
save
end
|
#release ⇒ Object
90
91
92
93
94
95
96
97
98
99
|
# File 'lib/poundpay/elements.rb', line 90
def release
statuses = ['ESCROWED']
unless statuses.include?(status)
raise PaymentReleaseException.new "Payment status is #{status}. Only ESCROWED payments may be RELEASED."
end
attributes['status'] = 'RELEASED'
save
end
|