diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-03-26 23:25:23 +0200 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-03-26 23:25:23 +0200 |
commit | ffe29907989526a94d1131eddbf18dc9309ad524 (patch) | |
tree | a6df2a96cacc2f7ab745e830c93ca60f08580ffc /php/order.php | |
parent | aea6d706cb5e89998f65700fc78ca40864f7455b (diff) | |
download | merchant-frontend-examples-ffe29907989526a94d1131eddbf18dc9309ad524.tar.gz merchant-frontend-examples-ffe29907989526a94d1131eddbf18dc9309ad524.tar.bz2 merchant-frontend-examples-ffe29907989526a94d1131eddbf18dc9309ad524.zip |
contract -> order
Diffstat (limited to 'php/order.php')
-rw-r--r-- | php/order.php | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/php/order.php b/php/order.php new file mode 100644 index 0000000..7582ae7 --- /dev/null +++ b/php/order.php @@ -0,0 +1,78 @@ +<?php + // This file is in the public domain. + + include_once 'config.php'; + include_once 'helpers.php'; + + function make_order($transaction_id, $now){ + $contract + = array( + 'amount' => + array('value' => 1, + 'fraction' => 0, + 'currency' => $GLOBALS['CURRENCY']), + 'max_fee' => + array('value' => 0, + 'fraction' => 50000, + 'currency' => $GLOBALS['CURRENCY']), + 'transaction_id' => + $transaction_id, + 'products' => + array(array('description' => + "Donation to charity program", + 'quantity' => 1, + 'price' => + array ('value' => 1, + 'fraction' => 0, + 'currency' => $GLOBALS['CURRENCY']), + 'product_id' => 0, + 'taxes' => + array(), + 'delivery_date' => + "/Date(" . $now->getTimestamp() . ")/", + 'delivery_location' => + 'LNAME1' + ) + ), + 'summary' => + "Personal donation to charity program", + 'timestamp' => + "/Date(" . $now->getTimestamp() . ")/", + 'fulfillment_url' => + url_rel("/fulfillment.php?" + . "transaction_id=$transaction_id×tamp=" + . $now->getTimestamp()), + 'refund_deadline' => + "/Date(" . $now->getTimestamp() . ")/", + 'pay_deadline' => + "/Date(" . $now->add(new DateInterval('P2W'))->getTimestamp() . ")/", + 'merchant' => + array('address' => + 'LNAME2', + 'name' => + "Charity donation shop", + 'jurisdiction' => + 'LNAME2'), + 'locations' => + array ('LNAME1' => + array ('country' => 'Test Country 1', + 'city' => 'Test City 1', + 'state' => 'Test State 1', + 'region' => 'Test Region 1', + 'province' => 'Test Province 1', + 'ZIP code' => 49081, + 'street' => 'test street 1', + 'street number' => 201), + 'LNAME2' => + array ('country' => 'Test Country 2', + 'city' => 'Test City 2', + 'state' => 'Test State 2', + 'region' => 'Test Region 2', + 'province' => 'Test Province 2', + 'ZIP code' => 49082, + 'street' => 'test street 2', + 'street number' => 202) + )); + return array ('contract' => $contract); + } +?> |