Sha256: 150d611a3184feafd3f0e9c11680efd980c9e6572cfda5f378486db1c517e7ca

Contents?: true

Size: 858 Bytes

Versions: 1

Compression:

Stored size: 858 Bytes

Contents

# frozen_string_literal: true

module YandexCheckout
  class Refund < Evil::Client
    option :shop_id,  proc(&:to_s)
    option :api_key,  proc(&:to_s)

    path { 'https://payment.yandex.net/api/v3/refunds' }
    security { basic_auth shop_id, api_key }

    operation :get_refund_info do
      option :payment_id, proc(&:to_s)

      http_method :get
      path { "/#{payment_id}" }

      response(200) { |*res| Entity::Refund.build(*res) }
      response(400, 404) { |*res| Error.build(*res) }
    end

    operation :create do
      option :payload
      option :idempotency_key, proc(&:to_s)

      http_method :post

      format 'json'
      headers { { 'Idempotence-Key' => idempotency_key } }
      body { payload }

      response(200) { |*res| Entity::Refund.build(*res) }
      response(400, 404) { |*res| Error.build(*res) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yandex-checkout-0.1.1 lib/yandex-checkout/refund.rb