зеркало из
https://github.com/glebtv/yookassa.git
synced 2026-08-28 15:16:18 +03:00
Refund structs revisited (#13)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
49d8a8c208
Коммит
f5f9f3793d
1
.gitignore
поставляемый
1
.gitignore
поставляемый
@@ -11,3 +11,4 @@
|
||||
|
||||
# rspec failure tracking
|
||||
.rspec_status
|
||||
.tool-versions
|
||||
|
||||
6
Gemfile
6
Gemfile
@@ -7,6 +7,12 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
||||
# Specify your gem's dependencies in yookassa.gemspec
|
||||
gemspec
|
||||
|
||||
group :documentation do
|
||||
gem "rack"
|
||||
gem "webrick"
|
||||
gem "yard"
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
gem "pry"
|
||||
gem "pry-byebug", "~> 3.8.0"
|
||||
|
||||
@@ -70,6 +70,7 @@ GEM
|
||||
byebug (~> 11.0)
|
||||
pry (~> 0.10)
|
||||
public_suffix (4.0.6)
|
||||
rack (2.2.3)
|
||||
rainbow (3.0.0)
|
||||
rake (13.0.6)
|
||||
regexp_parser (2.1.1)
|
||||
@@ -117,6 +118,8 @@ GEM
|
||||
addressable (>= 2.8.0)
|
||||
crack (>= 0.3.2)
|
||||
hashdiff (>= 0.4.0, < 2.0.0)
|
||||
webrick (1.7.0)
|
||||
yard (0.9.26)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
@@ -124,6 +127,7 @@ PLATFORMS
|
||||
DEPENDENCIES
|
||||
pry
|
||||
pry-byebug (~> 3.8.0)
|
||||
rack
|
||||
rake (~> 13.0)
|
||||
rspec (~> 3.5)
|
||||
rubocop (~> 1.22)
|
||||
@@ -131,6 +135,8 @@ DEPENDENCIES
|
||||
rubocop-rspec (~> 2.5)
|
||||
simplecov (~> 0.16)
|
||||
webmock (~> 3.14)
|
||||
webrick
|
||||
yard
|
||||
yookassa!
|
||||
|
||||
BUNDLED WITH
|
||||
|
||||
29
bin/yard
Исполняемый файл
29
bin/yard
Исполняемый файл
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# This file was generated by Bundler.
|
||||
#
|
||||
# The application 'yard' is installed as part of a gem, and
|
||||
# this file is here to facilitate running it.
|
||||
#
|
||||
|
||||
require "pathname"
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||
Pathname.new(__FILE__).realpath)
|
||||
|
||||
bundle_binstub = File.expand_path("bundle", __dir__)
|
||||
|
||||
if File.file?(bundle_binstub)
|
||||
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
||||
load(bundle_binstub)
|
||||
else
|
||||
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
||||
end
|
||||
end
|
||||
|
||||
require "rubygems"
|
||||
require "bundler/setup"
|
||||
|
||||
load Gem.bin_path("yard", "yard")
|
||||
@@ -2,18 +2,45 @@
|
||||
|
||||
require_relative "./types"
|
||||
require_relative "./amount"
|
||||
require_relative "./source"
|
||||
|
||||
module Yookassa
|
||||
module Entity
|
||||
class Refund < Dry::Struct
|
||||
attribute :id, Types::String
|
||||
attribute? :idempotency_key, Types::String
|
||||
attribute :status, Types::String
|
||||
# id [string, required]
|
||||
# Refund's ID in YooMoney
|
||||
attribute :id, Types::String
|
||||
|
||||
# payment_id [string, required]
|
||||
# Payment ID in YooMoney
|
||||
attribute :payment_id, Types::String
|
||||
|
||||
# status [string, required]
|
||||
# Refund status. Possible values: canceled, succeeded
|
||||
attribute :status, Types::String.enum("canceled", "succeeded")
|
||||
|
||||
# receipt_registration [string, optional]
|
||||
# Delivery status of receipt data to online sales register (pending, succeeded, or canceled).
|
||||
# For those who use the solution for 54-FZ
|
||||
attribute? :receipt_registration, Types::String.enum("pending", "succeeded", "canceled")
|
||||
|
||||
# created_at [string, required]
|
||||
# Time to refund creation, based on UTC and specified in the ISO 8601 format, for example, 2017-11-03T11:52:31.827Z
|
||||
attribute :created_at, Types::String
|
||||
|
||||
# amount [object, required]
|
||||
# Amount refunded to the user.
|
||||
attribute :amount, Entity::Amount
|
||||
attribute? :receipt_registration, Types::String
|
||||
|
||||
# description [string, optional]
|
||||
# Reason behind the refund.
|
||||
attribute :description, Types::String
|
||||
|
||||
# sources [array, optional]
|
||||
# Information about money held for refunds: the amount to be held and the stores getting the refunds.
|
||||
# Specified if you use the YooMoney solution for marketplaces
|
||||
attribute? :sources, Types::Array.of(Entity::Source)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
23
lib/yookassa/entity/source.rb
Обычный файл
23
lib/yookassa/entity/source.rb
Обычный файл
@@ -0,0 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative "./types"
|
||||
require_relative "./amount"
|
||||
|
||||
module Yookassa
|
||||
module Entity
|
||||
class Source < 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]
|
||||
# Refund amount
|
||||
attribute :amount, Entity::Amount
|
||||
|
||||
# platform_fee_amount [object, optional]
|
||||
# Commission for sold products or services charged in your favor.
|
||||
attribute? :platform_fee_amount, Entity::Amount
|
||||
end
|
||||
end
|
||||
end
|
||||
Ссылка в новой задаче
Block a user