1
0
зеркало из https://github.com/glebtv/yookassa.git synced 2026-08-28 15:16:18 +03:00
Этот коммит содержится в:
Andrey
2020-12-07 23:10:23 +03:00
родитель 55dbde6397
Коммит b40b9a32b3
29 изменённых файлов: 133 добавлений и 184 удалений

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

@@ -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 Обычный файл
Просмотреть файл

@@ -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 Обычный файл
Просмотреть файл

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