1
0
зеркало из https://github.com/glebtv/yookassa.git synced 2026-08-28 15:16:18 +03:00

Added AuthorizationDetails, CancellationDetails, Transfers

Этот коммит содержится в:
Ivan Shamatov
2021-10-31 23:36:20 +03:00
родитель 2f5a64794d
Коммит 27cff37930
4 изменённых файлов: 80 добавлений и 1 удалений

Просмотреть файл

@@ -0,0 +1,28 @@
# frozen_string_literal: true
require_relative "./types"
module Yookassa
module Entity
class AuthorizationDetails < Dry::Struct
# rrn [string, optional]
# Retrieval Reference Number is a unique identifier of a transaction in the issuer's system. Used for payments via bank card.
attribute? :rrn, Types::String
# auth_code [string, optional]
# Bank card's authorization code. Provided by the issuer to confirm authorization.
attribute? :auth_code, Types::String
# three_d_secure [object, optional]
# Information about users 3D Secure authentication for confirming the payment.
attribute? :three_d_secure, Types::Hash.schema(
# applied [boolean, required]
# Information on whether the 3-D Secure authentication form is displayed to the user for confirming the payment or not.
# true: YooMoney displayed the form to the user, so that they could complete 3-D Secure authentication;
# false: payment was processed without 3-D Secure authentication.
applied: Types::Bool
).with_key_transform(&:to_sym)
end
end
end

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

@@ -0,0 +1,18 @@
# frozen_string_literal: true
require_relative "./types"
module Yookassa
module Entity
class CancellationDetails < Dry::Struct
# party [string, required]
# The participant of the payment process that made the decision to cancel the payment.
# Possible values are yoo_money, payment_network, and merchant. More about initiators of payment cancelation
attribute :party, Types::String.enum("yoo_money", "payment_network", "merchant")
# reason [string, required]
# Reason behind the cancelation. Possible values https://yookassa.ru/en/developers/payments/declined-payments#cancellation-details-reason
attribute :reason, Types::String
end
end
end

Просмотреть файл

@@ -5,7 +5,7 @@ require_relative "./amount"
require_relative "./payment_methods"
require_relative "./confirmation"
require_relative "./recipient"
require_relative "./cancelation_details"
require_relative "./cancellation_details"
require_relative "./authorization_details"
require_relative "./transfer"

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

@@ -0,0 +1,33 @@
# frozen_string_literal: true
require_relative "./types"
require_relative "./amount"
module Yookassa
module Entity
class Transfer < Dry::Struct
# account_id [string, required]
# ID of the store in favor of which you're accepting the receipt. Provided by YooMoney, displayed in the Sellers section
# of your Merchant Profile (shopId column).
attribute :account_id, Types::String
# amount [object, required]
# Amount to be transferred to the store.
attribute :amount, Entity::Amount
# status [string, required]
# Status of the money distribution between stores. Possible values: pending, waiting_for_capture, succeeded, canceled.
attribute :status, Types::String.enum("pending", "waiting_for_capture", "succeeded", "canceled")
# platform_fee_amount [object, optional]
# Commission for sold products or services charged in your favor.
attribute? :platform_fee_amount, Entity::Amount
# metadata [object, optional]
# Any additional data you might require for processing payments (for example, order number), specified as a “key-value” pair
# and returned in response from YooMoney. Limitations: no more than 16 keys, no more than 32 characters in the keys title,
# no more than 512 characters in the keys value, data type is a string in the UTF-8 format.
attribute? :metadata, Types::Hash
end
end
end