class Paytureman::PaymentNew

Attributes

ip[R]

Public Class Methods

new(order_id, amount, ip, gateway = nil) click to toggle source
Calls superclass method Paytureman::Payment::new
# File lib/payments/payment_new.rb, line 24
def initialize(order_id, amount, ip, gateway = nil)
  super(order_id, amount, gateway)
  @ip = ip
end
new_from_memento(memento) click to toggle source
# 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

Public Instance Methods

prepare(description = PaymentDescription.new) click to toggle source
# 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) click to toggle source
Calls superclass method Paytureman::Payment#save_to_memento
# File lib/payments/payment_new.rb, line 29
def save_to_memento(memento)
  super
  memento.ip = ip
end