class YaKassa::V3::ReceiptRequest

Public Instance Methods

body() click to toggle source
# File lib/ya_kassa/v3/receipt_request.rb, line 26
def body
  {
    customer: body_customer,
    payment_id: payment_id,
    type: type,
    send: send,
    items: body_items,
    settlements: settlements_body
  }
end

Protected Instance Methods

body_customer() click to toggle source
# File lib/ya_kassa/v3/receipt_request.rb, line 39
def body_customer
  body = {
    full_name: full_name,
    email: email,
    phone: phone
  }
  body[:inn] = inn if inn
  body
end
body_items() click to toggle source
# File lib/ya_kassa/v3/receipt_request.rb, line 49
def body_items
  items.map do |item|
    {
      description: item[:description],
      quantity: item[:quantity],
      amount: {
        value: item[:amount_value],
        currency: currency
      },
      vat_code: vat_code,
      payment_mode: payment_mode
    }
  end
end
settlements_body() click to toggle source
# File lib/ya_kassa/v3/receipt_request.rb, line 64
def settlements_body
  items.map do |item|
    {
      type: payment_type,
      amount: {
        value: item[:amount_value],
        currency: currency
      }
    }
  end
end

Private Instance Methods

api_client() click to toggle source
# File lib/ya_kassa/v3/receipt_request.rb, line 78
def api_client
  api_client_post
end
url() click to toggle source
# File lib/ya_kassa/v3/receipt_request.rb, line 82
def url
  router.receipt_url
end