Class: Paytureman::PaymentNew
Instance Attribute Summary
Attributes inherited from Payment
#gateway, #order_id
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Payment
#current, new_from_payment
Constructor Details
#initialize(order_id, amount, ip, gateway = nil) ⇒ PaymentNew
Returns a new instance of PaymentNew.
24
25
26
27
|
# File 'lib/payments/payment_new.rb', line 24
def initialize(order_id, amount, ip, gateway = nil)
super(order_id, amount, gateway)
@ip = ip
end
|
Class Method Details
.new_from_memento(memento) ⇒ Object
34
35
36
|
# File 'lib/payments/payment_new.rb', line 34
def self.new_from_memento(memento)
new(memento.order_id, memento.amount, memento.ip, memento.gateway)
end
|
Instance Method Details
#prepare(description = PaymentDescription.new) ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/payments/payment_new.rb', line 38
def prepare(description = PaymentDescription.new)
session_id = payture.init(order_id, amount_in_cents, ip, description.to_h)
if session_id
PaymentPrepared.new(order_id, amount, session_id, gateway)
else
self
end
end
|
#save_to_memento(memento) ⇒ Object
29
30
31
32
|
# File 'lib/payments/payment_new.rb', line 29
def save_to_memento(memento)
super
memento.ip = ip
end
|