diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-03-02 14:36:24 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-03-02 14:36:24 +0100 |
commit | d5ebd6cac98b44cf88eae9b26820bb744cf92c19 (patch) | |
tree | 07076f5e91bc67999e229faccea6ccacbdf5ad00 /copylib | |
parent | 51c8aca5a82ba80f36fe34ac4679a99d6c7d3ff6 (diff) |
refactor
Diffstat (limited to 'copylib')
-rw-r--r-- | copylib/merchants.php | 72 |
1 files changed, 1 insertions, 71 deletions
diff --git a/copylib/merchants.php b/copylib/merchants.php index 1ae763c9..4f3c229a 100644 --- a/copylib/merchants.php +++ b/copylib/merchants.php @@ -6,7 +6,7 @@ * Taler-style amount (so it has the usual <amount,fration,currency> * triple). Moreover, `teatax` should be a *list* of taxes */ -function _generate_contract($args){ +function generate_contract($args){ $contract = array ('amount' => array ('value' => $args['amount_value'], 'fraction' => $args['amount_fraction'], @@ -68,76 +68,6 @@ function _generate_contract($args){ return $json; } -/** - * Return a contract proposition to forward to the backend - * Note that `teatax` is an associative array representing a - * Taler-style amount (so it has the usual <amount,fration,currency> - * triple). Moreover, `teatax` should be a *list* of taxes - */ -function generate_contract($amount_value, - $amount_fraction, - $currency, - $transaction_id, - $desc, - $p_id, - $corr_id, - $taxes, - $now, - $fulfillment_url){ - include("../frontend_lib/config.php"); - $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), - 'product_id' => $p_id, - 'taxes' => $taxes, - '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($REFUND_DELTA))->getTimestamp() . ")/", - 'repurchase_correlation_id' => $corr_id, - 'fulfillment_url' => $fulfillment_url, - 'merchant' => array ('address' => 'LNAME2', - 'name' => 'Free Software Foundation (demo)', - '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), JSON_PRETTY_PRINT); - return $json; -} - - /** * Feed `$json` to the backend and return the "(pecl) http response object" |