1
0
зеркало из https://github.com/glebtv/yookassa.git synced 2026-09-04 18:15:49 +03:00
Этот коммит содержится в:
Ivan Shamatov
2021-11-09 01:01:13 +03:00
коммит произвёл GitHub
родитель 811ab20f05
Коммит c5c1e8a54e
13 изменённых файлов: 167 добавлений и 30 удалений

4
spec/fixtures/payment_response.json поставляемый
Просмотреть файл

@@ -19,8 +19,8 @@
"saved": false
},
"recipient": {
"account_id": "54401",
"gateway_id": "289250"
"account_id": 54401,
"gateway_id": 289250
},
"refundable": false,
"test": true

42
spec/fixtures/payments_list_response.json поставляемый Обычный файл
Просмотреть файл

@@ -0,0 +1,42 @@
{
"type": "list",
"items": [
{
"id": "22e12f66-000f-5000-8000-18db351245c7",
"status": "waiting_for_capture",
"paid": true,
"amount": {
"value": 2,
"currency": "RUB"
},
"created_at": "2018-07-18T10:51:18.139Z",
"description": "Заказ №72",
"expires_at": "2018-07-25T10:52:00.233Z",
"metadata": {
},
"payment_method": {
"type": "bank_card",
"id": "22e12f66-000f-5000-8000-18db351245c7",
"saved": false,
"card": {
"first6": 555555,
"last4": 4444,
"expiry_month": 7,
"expiry_year": 2022,
"card_type": "MasterCard",
"issuer_country": "RU",
"issuer_name": "Sberbank"
},
"title": "Bank card *4444"
},
"recipient": {
"account_id": 100001,
"gateway_id": 1000001
},
"refundable": false,
"test": false
}
],
"next_cursor": "37a5c87d-3984-51e8-a7f3-8de646d39ec15"
}

16
spec/fixtures/refunds_list_response.json поставляемый Обычный файл
Просмотреть файл

@@ -0,0 +1,16 @@
{
"type": "list",
"items": [
{
"id": "216749f7-0016-50be-b000-078d43a63ae4",
"status": "succeeded",
"amount": {
"value": 1,
"currency": "RUB"
},
"created_at": "2017-10-04T19:27:51.407Z",
"payment_id": "216749da-000f-50be-b000-096747fad91e"
}
],
"next_cursor": "416746f8-0016-50be-b000-078d43a4578"
}

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

@@ -98,4 +98,28 @@ RSpec.describe Yookassa::Payments do
it_behaves_like "returns_payment_object"
end
describe "#list" do
let(:body) { File.read("spec/fixtures/payments_list_response.json") }
let(:filters) do
{
limit: 20,
"created_at.gt": "2018-07-18T10:51:18.139Z"
}
end
let(:url) { "https://api.yookassa.ru/v3/payments?limit=20&created_at.gt=2018-07-18T10:51:18.139Z" }
subject { payment.list(filters: filters) }
it "sends a request" do
subject
expect(a_request(:get, url)).to have_been_made
end
it "returns a collection" do
expect(subject).to be_a Yookassa::Entity::PaymentCollection
end
end
end

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

@@ -51,4 +51,28 @@ RSpec.describe Yookassa::Refunds do
it_behaves_like "returns_refund_object"
end
describe "#list" do
let(:body) { File.read("spec/fixtures/refunds_list_response.json") }
let(:filters) do
{
limit: 20,
"created_at.gt": "2018-07-18T10:51:18.139Z"
}
end
let(:url) { "https://api.yookassa.ru/v3/refunds?limit=20&created_at.gt=2018-07-18T10:51:18.139Z" }
subject { refund.list(filters: filters) }
it "sends a request" do
subject
expect(a_request(:get, url)).to have_been_made
end
it "returns a collection" do
expect(subject).to be_a Yookassa::Entity::RefundCollection
end
end
end