1
0
зеркало из https://github.com/glebtv/yookassa.git synced 2026-09-04 02:05:51 +03:00
Этот коммит содержится в:
Ivan Shamatov
2021-10-28 20:15:08 +03:00
родитель 847c90bb6c
Коммит e6a7b5cb7f
23 изменённых файлов: 254 добавлений и 138 удалений

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

@@ -1,13 +1,13 @@
# frozen_string_literal: true
require 'evil/client'
require "evil/client"
require 'yookassa/version'
require 'yookassa/payment'
require 'yookassa/refund'
require 'yookassa/response'
require 'yookassa/callable'
require 'yookassa/optional'
require 'yookassa/entity/payment'
require 'yookassa/entity/refund'
require 'yookassa/error'
require "yookassa/version"
require "yookassa/payment"
require "yookassa/refund"
require "yookassa/response"
require "yookassa/callable"
require "yookassa/optional"
require "yookassa/entity/payment"
require "yookassa/entity/refund"
require "yookassa/error"

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

@@ -1,8 +1,8 @@
# frozen_string_literal: true
require_relative './amount'
require_relative './payment_method'
require_relative './confirmation'
require_relative "./amount"
require_relative "./payment_method"
require_relative "./confirmation"
module Yookassa
module Entity

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

@@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative './card'
require_relative "./card"
module Yookassa
module Entity

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

@@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative './amount'
require_relative "./amount"
module Yookassa
module Entity

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

@@ -13,7 +13,7 @@ module Yookassa
option :parameter, proc(&:to_s), optional: true
def error?
type == 'error'
type == "error"
end
class << self
@@ -23,7 +23,7 @@ module Yookassa
end
def new(opts)
super opts.each_with_object({}) { |(key, val), obj| obj[key.to_sym] = val }
super opts.transform_keys(&:to_sym)
end
end
end

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

@@ -5,7 +5,7 @@ module Yookassa
private
def initialize(opts)
super opts.each_with_object({}) { |(key, val), obj| obj[key.to_sym] = val }
super opts.transform_keys(&:to_sym)
end
def __options__

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

@@ -5,7 +5,7 @@ module Yookassa
option :shop_id, proc(&:to_s)
option :api_key, proc(&:to_s)
path { 'https://api.yookassa.ru/v3/payments' }
path { "https://api.yookassa.ru/v3/payments" }
security { basic_auth shop_id, api_key }
operation :get_payment_info do
@@ -24,8 +24,8 @@ module Yookassa
http_method :post
format 'json'
headers { { 'Idempotence-Key' => idempotency_key } }
format "json"
headers { { "Idempotence-Key" => idempotency_key } }
body { payment }
response(200) { |*res| Entity::Payment.build(*res) }
@@ -40,8 +40,8 @@ module Yookassa
path { "/#{payment_id}/capture" }
format 'json'
headers { { 'Idempotence-Key' => idempotency_key } }
format "json"
headers { { "Idempotence-Key" => idempotency_key } }
response(200) { |*res| Entity::Payment.build(*res) }
response(400) { |*res| Error.build(*res) }
@@ -55,8 +55,8 @@ module Yookassa
path { "/#{payment_id}/cancel" }
format 'json'
headers { { 'Idempotence-Key' => idempotency_key } }
format "json"
headers { { "Idempotence-Key" => idempotency_key } }
response(200) { |*res| Entity::Payment.build(*res) }
response(400) { |*res| Error.build(*res) }

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

@@ -5,7 +5,7 @@ module Yookassa
option :shop_id, proc(&:to_s)
option :api_key, proc(&:to_s)
path { 'https://api.yookassa.ru/v3/refunds' }
path { "https://api.yookassa.ru/v3/refunds" }
security { basic_auth shop_id, api_key }
operation :get_refund_info do
@@ -24,8 +24,8 @@ module Yookassa
http_method :post
format 'json'
headers { { 'Idempotence-Key' => idempotency_key } }
format "json"
headers { { "Idempotence-Key" => idempotency_key } }
body { payload }
response(200) { |*res| Entity::Refund.build(*res) }

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

@@ -4,7 +4,7 @@ module Yookassa
class Response
extend Dry::Initializer
option :id, proc(&:to_s)
option :status, proc(&:to_s), default: proc { nil }
option :status, proc(&:to_s), default: proc {}
class << self
def build(*res)
@@ -13,7 +13,7 @@ module Yookassa
end
def new(opts)
super opts.each_with_object({}) { |(key, val), obj| obj[key.to_sym] = val }
super opts.transform_keys(&:to_sym)
end
end
end

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

@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Yookassa
VERSION = '0.1.0'
VERSION = "0.1.0"
end