forked from MarkEdmondson1234/googleID
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruby-client.refund
38 lines (31 loc) · 1.19 KB
/
ruby-client.refund
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Given(/^the user creates a refund$/) do
sleep(1)
@response = @client.refund_invoice(id: REFUND_TRANSACTION, params: {amount: 1, currency: 'USD', bitcoinAddress: REFUND_ADDRESS})
end
Then(/^they will receive a refund id$/) do
@refund_id = @response["id"]
expect(@refund_id).not_to be_empty
end
Given(/^the user requests a specific refund$/) do
@response = @client.get_refund(invoice_id: REFUND_TRANSACTION, request_id: @refund_id)
end
Then(/^they will receive the refund$/) do
expect(@response.first["status"]).not_to be_empty
end
Given(/^the user requests all refunds for an invoice$/) do
client = new_client_from_stored_values
@response = client.get_all_refunds_for_invoice(id: REFUND_TRANSACTION)
end
Then(/^they will receive an array of refunds$/) do
expect(@response).to be_instance_of Array
end
Given(/^a properly formatted cancellation request$/) do
sleep(1)
client = new_client_from_stored_values
@refund_id = client.get_all_refunds_for_invoice(id: REFUND_TRANSACTION).first["id"]
@response = client.cancel_refund(invoice_id: REFUND_TRANSACTION, request_id: @refund_id)
end
Then(/^the refund will be cancelled$/) do
expect(@response).to eq("Success")
end
© 2020 GitHub, Inc.