1
0
зеркало из https://github.com/glebtv/yookassa.git synced 2026-09-03 17:55:51 +03:00
Этот коммит содержится в:
Ivan Shamatov
2021-11-07 14:58:02 +03:00
коммит произвёл GitHub
родитель 9412846bbd
Коммит 811ab20f05
3 изменённых файлов: 106 добавлений и 0 удалений

28
lib/yookassa/entity/customer.rb Обычный файл
Просмотреть файл

@@ -0,0 +1,28 @@
# frozen_string_literal: true
require_relative "./types"
module Yookassa
module Entity
class Customer < Dry::Struct
# Name of the organization for companies, full name for sole proprietors and individuals.
# If the individual doesn't have a Tax Identification Number (INN),
# specify their passport information in this parameter. Maximum 256 characters.
# Online sales register that support this parameter: Orange Data, ATOL Online.
attribute? :full_name, Types::String
# User's Tax Identification Number (INN) (10 or 12 digits). If the individual doesn't have an INN,
# specify their passport information in the full_name parameter.
# Online sales register that support this parameter: Orange Data, ATOL Online.
attribute? :inn, Types::String
# User's email address for sending the receipt.
# Required parameter if phone isn't specified.
attribute? :email, Types::String
# User's phone number for sending the receipt. Specified in the ITU-T E.164 format, for example, 79000000000.
# Required parameter if email isn't specified.
attribute? :phone, Types::String
end
end
end

47
lib/yookassa/entity/product.rb Обычный файл
Просмотреть файл

@@ -0,0 +1,47 @@
# frozen_string_literal: true
require_relative "./amount"
module Yookassa
module Entity
class Product < Dry::Struct
# Product name (maximum 128 characters).
attribute :description, Types::String
# Product quantity. Maximum possible value depends on the model of your online sales register.
attribute :quantity, Types::String
# Product price
attribute :amount, Yookassa::Entity::Amount
# VAT rate. Possible value is a number from 1 to 6. More about VAT rates codes
# https://yookassa.ru/en/developers/54fz/parameters-values#vat-codes
attribute :vat_code, Types::Integer
# Payment subject attribute. List of possible values: https://yookassa.ru/en/developers/54fz/parameters-values#payment-subject
attribute? :payment_subject, Types::String
# Payment method attribute. List of possible values: https://yookassa.ru/en/developers/54fz/parameters-values#payment-mode
attribute? :payment_mode, Types::String
# Product code is a unique number assigned to a unit of product during marking process.
# Format: hexadecimal number with spaces. Maximum length is 32 bytes.
# Example: 00 00 00 01 00 21 FA 41 00 23 05 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 12 00 AB 00.
# Required parameter for marked products. http://docs.cntd.ru/document/557297080
attribute? :product_code, Types::String
# Country of origin code according to the Russian classifier of world countries (OK (MK (ISO 3166) 004-97) 025-2001).
# Example: RU.
# Online sales register tthat support this parameter: Orange Data, Kit Invest.
attribute? :country_of_origin_code, Types::String
# Customs declaration number (1 to 32 characters).
# Online sales register that support this parameter: Orange Data, Kit Invest.
attribute? :customs_declaration_number, Types::String
# Amount of excise tax on products including kopeks. Decimal number with 2 digits after the period.
# Online sales register that support this parameter: Orange Data, Kit Invest.
attribute? :excise
end
end
end

31
lib/yookassa/entity/receipt.rb Обычный файл
Просмотреть файл

@@ -0,0 +1,31 @@
# frozen_string_literal: true
require_relative "./types"
require_relative "./customer"
require_relative "./product"
module Yookassa
module Entity
class Receipt < Dry::Struct
# User details. You should specify at least the basic contact information:
# email address (customer.email) or phone number (customer.phone)
attribute? :customer, Yookassa::Entity::Customer
# List of products in an order (maximum 100 items).
attribute :items, Types::Array.of(Yookassa::Entity::Product)
# Store's tax system. The parameter is only required if you use several tax systems.
# Otherwise, the parameter is not specified. List of possible values:
# https://yookassa.ru/en/developers/54fz/parameters-values#tax-systems
attribute? :tax_system_code, Types::Integer
# User's phone number for sending the receipt. Set in the ITU-T E.164 format, for example, 79000000000.
# !DEPRECATED PARAMETER: we recommend specifying the details in the receipt.customer.phone parameter.
attribute? :phone, Types::String
# User's email address for sending the receipt.
# !DEPRECATED PARAMETER: we recommend specifying the details in the receipt.customer.email parameter.
attribute? :email, Types::String
end
end
end