class Omnikassa2::MerchantOrder

Attributes

amount[R]
merchant_order_id[R]
merchant_return_url[R]
payment_brand[R]
payment_brand_force[R]

Public Class Methods

new(params) click to toggle source
# File lib/omnikassa2/models/merchant_order.rb, line 10
def initialize(params)
  @merchant_return_url = params.fetch(:merchant_return_url)
  @merchant_order_id = params.fetch(:merchant_order_id)
  @amount = params.fetch(:amount)

  @payment_brand = params.fetch(:payment_brand, nil)
  @payment_brand_force = params.fetch(:payment_brand_force, nil)
end

Private Class Methods

csv_serializer() click to toggle source
# File lib/omnikassa2/models/merchant_order.rb, line 34
def self.csv_serializer
  Omnikassa2::CSVSerializer.new([
    { field: :timestamp },
    { field: :merchant_order_id },
    {
      field: :amount,
      nested_fields: [
        { field: :currency },
        { field: :amount }
      ]
    },
    { field: :language, include_if_nil: true },
    { field: :description, include_if_nil: true },
    { field: :merchant_return_url },
    { field: :payment_brand },
    { field: :payment_brand_force }
  ])
end

Public Instance Methods

signature() click to toggle source
# File lib/omnikassa2/models/merchant_order.rb, line 24
def signature
  SignatureService.sign to_s
end
timestamp() click to toggle source
# File lib/omnikassa2/models/merchant_order.rb, line 19
def timestamp
  @timestamp ||= Time.now.iso8601(3)
  @timestamp
end
to_s() click to toggle source
# File lib/omnikassa2/models/merchant_order.rb, line 28
def to_s
  MerchantOrder.csv_serializer.serialize(self)
end