зеркало из
https://github.com/glebtv/yookassa.git
synced 2026-09-07 11:25:51 +03:00
add payment
Этот коммит содержится в:
14
spec/fixtures/payment.json
поставляемый
Обычный файл
14
spec/fixtures/payment.json
поставляемый
Обычный файл
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"amount": {
|
||||
"value": "10.00",
|
||||
"currency": "RUB"
|
||||
},
|
||||
"payment_method_data": {
|
||||
"type": "bank_card"
|
||||
},
|
||||
"confirmation": {
|
||||
"type": "redirect",
|
||||
"return_url": "https://www.merchant-website.com/return_url"
|
||||
},
|
||||
"description": "Заказ №72"
|
||||
}
|
||||
29
spec/yandex-checkout/payment_spec.rb
Обычный файл
29
spec/yandex-checkout/payment_spec.rb
Обычный файл
@@ -0,0 +1,29 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe YandexCheckout::Payment do
|
||||
describe '#make_payment' do
|
||||
let(:settings) { { shop_id: 'SHOP_ID', api_key: 'API_KEY' } }
|
||||
let(:idempotence_key) { 123 }
|
||||
let(:payment) { described_class.new(settings) }
|
||||
let(:params) { { payment: File.read('spec/fixtures/payment.json') } }
|
||||
let(:answer) { { result: 'accepted' } }
|
||||
|
||||
before { stub_request(:any, //).to_return(body: answer.to_json) }
|
||||
subject { payment.create(params) }
|
||||
|
||||
context 'using ssl via POST:' do
|
||||
let(:url) { 'https://payment.yandex.net/api/v3/payments' }
|
||||
|
||||
it 'sends a request' do
|
||||
# binding.pry
|
||||
subject
|
||||
expect(a_request(:post, url)).to have_been_made
|
||||
end
|
||||
|
||||
it 'returns success' do
|
||||
expect(subject).to be_kind_of YandexCheckout::Response
|
||||
expect(subject.result).to eq 'accepted'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,9 +1,5 @@
|
||||
RSpec.describe YandexCheckout do
|
||||
it "has a version number" do
|
||||
it 'has a version number' do
|
||||
expect(YandexCheckout::VERSION).not_to be nil
|
||||
end
|
||||
|
||||
it "does something useful" do
|
||||
expect(false).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
Ссылка в новой задаче
Block a user