Sha256: 1514e2342ada4830639063455f8ca380ffb663f02e3fcf329a1b280678b9c6a2
Contents?: true
Size: 1.57 KB
Versions: 1
Compression:
Stored size: 1.57 KB
Contents
# frozen_string_literal: true module YandexCheckout class Payment < Evil::Client option :shop_id, proc(&:to_s) option :api_key, proc(&:to_s) path { 'https://payment.yandex.net/api/v3/payments' } security { basic_auth shop_id, api_key } operation :get_payment_info do option :payment_id, proc(&:to_s) http_method :get path { "/#{payment_id}" } response(200) { |*res| Entity::Payment.build(*res) } response(400, 404) { |*res| Error.build(*res) } end operation :create do option :payment option :idempotency_key, proc(&:to_s) http_method :post format 'json' headers { { 'Idempotence-Key' => idempotency_key } } body { payment } response(200) { |*res| Entity::Payment.build(*res) } response(400) { |*res| Error.build(*res) } end operation :capture do option :payment_id, proc(&:to_s) option :idempotency_key, optional: true http_method :post path { "/#{payment_id}/capture" } format 'json' headers { { 'Idempotence-Key' => idempotency_key } } response(200) { |*res| Entity::Payment.build(*res) } response(400) { |*res| Error.build(*res) } end operation :cancel do option :payment_id, proc(&:to_s) option :idempotency_key, optional: true http_method :post path { "/#{payment_id}/cancel" } format 'json' headers { { 'Idempotence-Key' => idempotency_key } } response(200) { |*res| Entity::Payment.build(*res) } response(400) { |*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/payment.rb |