diff options
Diffstat (limited to 'src/frontend/generate_taler_contract.php')
-rw-r--r-- | src/frontend/generate_taler_contract.php | 97 |
1 files changed, 50 insertions, 47 deletions
diff --git a/src/frontend/generate_taler_contract.php b/src/frontend/generate_taler_contract.php index c71542c8..1e020ce7 100644 --- a/src/frontend/generate_taler_contract.php +++ b/src/frontend/generate_taler_contract.php @@ -90,55 +90,58 @@ $teatax = array ('value' => 1, // Take a timestamp $now = new DateTime('now'); -// pack the JSON for the contract +// JSON for the contract // --- FIXME: exact format needs review! -$json = json_encode (array ('amount' => array ('value' => $amount_value, - 'fraction' => $amount_fraction, +$contract = array ('amount' => + array ('value' => $amount_value, + 'fraction' => $amount_fraction, + 'currency' => $currency), + 'max_fee' => array ('value' => 3, + 'fraction' => 01010, + 'currency' => $currency), + 'transaction_id' => $transaction_id, + 'products' => array ( + array ('description' => $desc, + 'quantity' => 1, + 'price' => array ('value' => $amount_value, + 'fraction' => $amount_fraction, 'currency' => $currency), - 'max_fee' => array ('value' => 3, - 'fraction' => 01010, - 'currency' => $currency), - 'transaction_id' => $transaction_id, - 'products' => array ( - array ('description' => $desc, - 'quantity' => 1, - 'price' => array ('value' => $amount_value, - 'fraction' => $amount_fraction, - 'currency' => $currency), - 'product_id' => $p_id, - 'taxes' => array (array ('teatax' => $teatax)), - 'delivery_date' => "Some Date Format", - 'delivery_location' => 'LNAME1')), - 'timestamp' => "/Date(" . $now->getTimestamp() . ")/", - 'pay_url' => "/taler/pay", - 'expiry' => "/Date(" . $now->add(new DateInterval('P2W'))->getTimestamp() . ")/", - 'refund_deadline' => "/Date(" . $now->add(new DateInterval('P3M'))->getTimestamp() . ")/", - 'merchant' => array ('address' => 'LNAME2', - 'name' => 'test merchant', - 'jurisdiction' => 'LNAME3'), - - 'locations' => array ('LNAME1' => array ('country' => 'Test Country', - 'city' => 'Test City', - 'state' => 'Test State', - 'region' => 'Test Region', - 'province' => 'Test Province', - 'ZIP code' => 4908, - 'street' => 'test street', - 'street number' => 20), - 'LNAME2' => array ('country' => 'Test Country', - 'city' => 'Test City', - 'state' => 'Test State', - 'region' => 'Test Region', - 'province' => 'Test Province', - 'ZIP code' => 4908, - 'street' => 'test street', - 'street number' => 20), - 'LNAME3' => array ('country' => 'Test Country', - 'city' => 'Test City', - 'state' => 'Test State', - 'region' => 'Test Region', - 'province' => 'Test Province', - 'ZIP code' => 4908))), JSON_PRETTY_PRINT); + 'product_id' => $p_id, + 'taxes' => array (array ('teatax' => $teatax)), + 'delivery_date' => "Some Date Format", + 'delivery_location' => 'LNAME1')), + 'timestamp' => "/Date(" . $now->getTimestamp() . ")/", + 'expiry' => "/Date(" . $now->add(new DateInterval('P2W'))->getTimestamp() . ")/", + 'refund_deadline' => "/Date(" . $now->add(new DateInterval('P3M'))->getTimestamp() . ")/", + 'merchant' => array ('address' => 'LNAME2', + 'name' => 'test merchant', + 'jurisdiction' => 'LNAME3'), + + 'locations' => array ('LNAME1' => array ('country' => 'Test Country', + 'city' => 'Test City', + 'state' => 'Test State', + 'region' => 'Test Region', + 'province' => 'Test Province', + 'ZIP code' => 4908, + 'street' => 'test street', + 'street number' => 20), + 'LNAME2' => array ('country' => 'Test Country', + 'city' => 'Test City', + 'state' => 'Test State', + 'region' => 'Test Region', + 'province' => 'Test Province', + 'ZIP code' => 4908, + 'street' => 'test street', + 'street number' => 20), + 'LNAME3' => array ('country' => 'Test Country', + 'city' => 'Test City', + 'state' => 'Test State', + 'region' => 'Test Region', + 'province' => 'Test Province', + 'ZIP code' => 4908))); +$json = json_encode (array ('contract' => $contract, + 'pay_url' => "/taler/pay", + 'exec_url' => "exec")); if ($cli_debug && !$backend_test) { echo $json . "\n"; |