commit 2ff1d263081aa338a46660574560dce2b067ae4d
parent 894c5b172b74c0f7f5305c00d8f7e71c2e934863
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date: Thu, 9 Mar 2017 16:32:28 +0100
Payments generator does three payments.
Diffstat:
1 file changed, 76 insertions(+), 0 deletions(-)
diff --git a/src/samples/generate_payments.c b/src/samples/generate_payments.c
@@ -1316,12 +1316,38 @@ run (void *cls)
.details.admin_add_incoming.sender_details = "{ \"type\":\"test\", \"bank_uri\":\"" BANK_URI "\", \"account_number\":62, \"uuid\":1 }",
.details.admin_add_incoming.transfer_details = "{ \"uuid\": 1}",
.details.admin_add_incoming.amount = "EUR:5.01" },
+ /* Fill reserve with EUR:5.01, as withdraw fee is 1 ct per config */
+ { .oc = OC_ADMIN_ADD_INCOMING,
+ .label = "create-reserve-2",
+ .expected_response_code = MHD_HTTP_OK,
+ .details.admin_add_incoming.sender_details = "{ \"type\":\"test\", \"bank_uri\":\"" BANK_URI "\", \"account_number\":62, \"uuid\":1 }",
+ .details.admin_add_incoming.transfer_details = "{ \"uuid\": 1}",
+ .details.admin_add_incoming.amount = "EUR:5.01" },
+ /* Fill reserve with EUR:5.01, as withdraw fee is 1 ct per config */
+ { .oc = OC_ADMIN_ADD_INCOMING,
+ .label = "create-reserve-3",
+ .expected_response_code = MHD_HTTP_OK,
+ .details.admin_add_incoming.sender_details = "{ \"type\":\"test\", \"bank_uri\":\"" BANK_URI "\", \"account_number\":62, \"uuid\":1 }",
+ .details.admin_add_incoming.transfer_details = "{ \"uuid\": 1}",
+ .details.admin_add_incoming.amount = "EUR:5.01" },
/* Withdraw a 5 EUR coin, at fee of 1 ct */
{ .oc = OC_WITHDRAW_SIGN,
.label = "withdraw-coin-1",
.expected_response_code = MHD_HTTP_OK,
.details.reserve_withdraw.reserve_reference = "create-reserve-1",
.details.reserve_withdraw.amount = "EUR:5" },
+ /* Withdraw a 5 EUR coin, at fee of 1 ct */
+ { .oc = OC_WITHDRAW_SIGN,
+ .label = "withdraw-coin-2",
+ .expected_response_code = MHD_HTTP_OK,
+ .details.reserve_withdraw.reserve_reference = "create-reserve-2",
+ .details.reserve_withdraw.amount = "EUR:5" },
+ /* Withdraw a 5 EUR coin, at fee of 1 ct */
+ { .oc = OC_WITHDRAW_SIGN,
+ .label = "withdraw-coin-3",
+ .expected_response_code = MHD_HTTP_OK,
+ .details.reserve_withdraw.reserve_reference = "create-reserve-3",
+ .details.reserve_withdraw.amount = "EUR:5" },
/* Create proposal */
{ .oc = OC_PROPOSAL,
@@ -1340,6 +1366,40 @@ run (void *cls)
\"products\":\
[ {\"description\":\"ice cream\", \"value\":\"{EUR:5}\"} ] }"},
+ /* Create proposal */
+ { .oc = OC_PROPOSAL,
+ .label = "create-proposal-2",
+ .expected_response_code = MHD_HTTP_OK,
+ .details.proposal.order = "{\
+ \"max_fee\":\
+ {\"currency\":\"EUR\", \"value\":0, \"fraction\":50000000},\
+ \"order_id\":\"2\",\
+ \"timestamp\":\"\\/Date(42)\\/\",\
+ \"refund_deadline\":\"\\/Date(0)\\/\",\
+ \"pay_deadline\":\"\\/Date(9999999999)\\/\",\
+ \"amount\":{\"currency\":\"EUR\", \"value\":5, \"fraction\":0},\
+ \"merchant\":{\"instance\":\"default\"},\
+ \"summary\": \"merchant-lib testcase\",\
+ \"products\":\
+ [ {\"description\":\"ice cream\", \"value\":\"{EUR:5}\"} ] }"},
+
+ /* Create proposal */
+ { .oc = OC_PROPOSAL,
+ .label = "create-proposal-3",
+ .expected_response_code = MHD_HTTP_OK,
+ .details.proposal.order = "{\
+ \"max_fee\":\
+ {\"currency\":\"EUR\", \"value\":0, \"fraction\":50000000},\
+ \"order_id\":\"3\",\
+ \"timestamp\":\"\\/Date(42)\\/\",\
+ \"refund_deadline\":\"\\/Date(0)\\/\",\
+ \"pay_deadline\":\"\\/Date(9999999999)\\/\",\
+ \"amount\":{\"currency\":\"EUR\", \"value\":5, \"fraction\":0},\
+ \"merchant\":{\"instance\":\"default\"},\
+ \"summary\": \"merchant-lib testcase\",\
+ \"products\":\
+ [ {\"description\":\"ice cream\", \"value\":\"{EUR:5}\"} ] }"},
+
{ .oc = OC_PAY,
.label = "deposit-simple",
.expected_response_code = MHD_HTTP_OK,
@@ -1348,6 +1408,22 @@ run (void *cls)
.details.pay.amount_with_fee = "EUR:5",
.details.pay.amount_without_fee = "EUR:4.99" },
+ { .oc = OC_PAY,
+ .label = "deposit-simple",
+ .expected_response_code = MHD_HTTP_OK,
+ .details.pay.contract_ref = "create-proposal-2",
+ .details.pay.coin_ref = "withdraw-coin-2",
+ .details.pay.amount_with_fee = "EUR:5",
+ .details.pay.amount_without_fee = "EUR:4.99" },
+
+ { .oc = OC_PAY,
+ .label = "deposit-simple",
+ .expected_response_code = MHD_HTTP_OK,
+ .details.pay.contract_ref = "create-proposal-3",
+ .details.pay.coin_ref = "withdraw-coin-3",
+ .details.pay.amount_with_fee = "EUR:5",
+ .details.pay.amount_without_fee = "EUR:4.99" },
+
{ .oc = OC_END,
.label = "end-of-commands"}
};