diff --git a/lib/yookassa/entity/authorization_details.rb b/lib/yookassa/entity/authorization_details.rb new file mode 100644 index 0000000..59d23d0 --- /dev/null +++ b/lib/yookassa/entity/authorization_details.rb @@ -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 user’s 3‑D 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 diff --git a/lib/yookassa/entity/cancellation_details.rb b/lib/yookassa/entity/cancellation_details.rb new file mode 100644 index 0000000..55da223 --- /dev/null +++ b/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 diff --git a/lib/yookassa/entity/payment.rb b/lib/yookassa/entity/payment.rb index a60e869..2016472 100644 --- a/lib/yookassa/entity/payment.rb +++ b/lib/yookassa/entity/payment.rb @@ -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" diff --git a/lib/yookassa/entity/transfer.rb b/lib/yookassa/entity/transfer.rb new file mode 100644 index 0000000..48c9d17 --- /dev/null +++ b/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 key’s title, + # no more than 512 characters in the key’s value, data type is a string in the UTF-8 format. + attribute? :metadata, Types::Hash + end + end +end