зеркало из
https://github.com/glebtv/yookassa.git
synced 2026-08-28 15:16:18 +03:00
Init yookassa
Этот коммит содержится в:
@@ -1,13 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'evil/client'
|
||||
|
||||
require 'yandex-checkout/version'
|
||||
require 'yandex-checkout/payment'
|
||||
require 'yandex-checkout/refund'
|
||||
require 'yandex-checkout/response'
|
||||
require 'yandex-checkout/callable'
|
||||
require 'yandex-checkout/optional'
|
||||
require 'yandex-checkout/entity/payment'
|
||||
require 'yandex-checkout/entity/refund'
|
||||
require 'yandex-checkout/error'
|
||||
@@ -1,5 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module YandexCheckout
|
||||
VERSION = '0.1.1'
|
||||
end
|
||||
13
lib/yookassa.rb
Обычный файл
13
lib/yookassa.rb
Обычный файл
@@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
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'
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module YandexCheckout
|
||||
module Yookassa
|
||||
module Callable
|
||||
def call(*args)
|
||||
new(*args)
|
||||
@@ -1,11 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module YandexCheckout
|
||||
module Yookassa
|
||||
module Entity
|
||||
class Amount
|
||||
extend Dry::Initializer
|
||||
extend YandexCheckout::Callable
|
||||
include YandexCheckout::Optional
|
||||
extend Yookassa::Callable
|
||||
include Yookassa::Optional
|
||||
|
||||
option :value, proc(&:to_f), optional: true
|
||||
option :currency, proc(&:to_s), optional: true
|
||||
@@ -1,11 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module YandexCheckout
|
||||
module Yookassa
|
||||
module Entity
|
||||
class Card
|
||||
extend Dry::Initializer
|
||||
extend YandexCheckout::Callable
|
||||
include YandexCheckout::Optional
|
||||
extend Yookassa::Callable
|
||||
include Yookassa::Optional
|
||||
|
||||
option :first6
|
||||
option :last4
|
||||
@@ -1,11 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module YandexCheckout
|
||||
module Yookassa
|
||||
module Entity
|
||||
class Confirmation
|
||||
extend Dry::Initializer
|
||||
extend YandexCheckout::Callable
|
||||
include YandexCheckout::Optional
|
||||
extend Yookassa::Callable
|
||||
include Yookassa::Optional
|
||||
|
||||
option :type, proc(&:to_s), optional: true
|
||||
option :confirmation_url, proc(&:to_s), optional: true
|
||||
@@ -4,9 +4,9 @@ require_relative './amount'
|
||||
require_relative './payment_method'
|
||||
require_relative './confirmation'
|
||||
|
||||
module YandexCheckout
|
||||
module Yookassa
|
||||
module Entity
|
||||
class Payment < YandexCheckout::Response
|
||||
class Payment < Yookassa::Response
|
||||
option :paid
|
||||
option :amount, Entity::Amount
|
||||
option :created_at
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
require_relative './card'
|
||||
|
||||
module YandexCheckout
|
||||
module Yookassa
|
||||
module Entity
|
||||
class PaymentMethod
|
||||
extend Dry::Initializer
|
||||
extend YandexCheckout::Callable
|
||||
include YandexCheckout::Optional
|
||||
extend Yookassa::Callable
|
||||
include Yookassa::Optional
|
||||
|
||||
option :type, proc(&:to_s)
|
||||
option :id, proc(&:to_s)
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
require_relative './amount'
|
||||
|
||||
module YandexCheckout
|
||||
module Yookassa
|
||||
module Entity
|
||||
class Refund < YandexCheckout::Response
|
||||
class Refund < Yookassa::Response
|
||||
option :payment_id
|
||||
option :created_at, proc(&:to_s)
|
||||
option :amount, Entity::Amount
|
||||
@@ -1,10 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module YandexCheckout
|
||||
module Yookassa
|
||||
class Error
|
||||
extend Dry::Initializer
|
||||
extend YandexCheckout::Callable
|
||||
include YandexCheckout::Optional
|
||||
extend Yookassa::Callable
|
||||
include Yookassa::Optional
|
||||
|
||||
option :type, proc(&:to_s)
|
||||
option :id, proc(&:to_s), optional: true
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module YandexCheckout
|
||||
module Yookassa
|
||||
module Optional
|
||||
private
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module YandexCheckout
|
||||
module Yookassa
|
||||
class Payment < Evil::Client
|
||||
option :shop_id, proc(&:to_s)
|
||||
option :api_key, proc(&:to_s)
|
||||
|
||||
path { 'https://payment.yandex.net/api/v3/payments' }
|
||||
path { 'https://api.yookassa.ru/v3/payments' }
|
||||
security { basic_auth shop_id, api_key }
|
||||
|
||||
operation :get_payment_info do
|
||||
@@ -1,11 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module YandexCheckout
|
||||
module Yookassa
|
||||
class Refund < Evil::Client
|
||||
option :shop_id, proc(&:to_s)
|
||||
option :api_key, proc(&:to_s)
|
||||
|
||||
path { 'https://payment.yandex.net/api/v3/refunds' }
|
||||
path { 'https://api.yookassa.ru/v3/refunds' }
|
||||
security { basic_auth shop_id, api_key }
|
||||
|
||||
operation :get_refund_info do
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module YandexCheckout
|
||||
module Yookassa
|
||||
class Response
|
||||
extend Dry::Initializer
|
||||
option :id, proc(&:to_s)
|
||||
5
lib/yookassa/version.rb
Обычный файл
5
lib/yookassa/version.rb
Обычный файл
@@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Yookassa
|
||||
VERSION = '0.1.0'
|
||||
end
|
||||
Ссылка в новой задаче
Block a user