summaryrefslogtreecommitdiff
path: root/php
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-11-19 19:39:39 +0100
committerChristian Grothoff <christian@grothoff.org>2016-11-19 19:39:39 +0100
commit9319c5693ac2017b3d713c76810c4b0eb16ccf23 (patch)
treeb197a068ebd66fa97198fff7c35deb940185669b /php
parente1ad41d04b4351421f2274f52ae06fb5396cdcc4 (diff)
downloadmerchant-frontend-examples-9319c5693ac2017b3d713c76810c4b0eb16ccf23.tar.gz
merchant-frontend-examples-9319c5693ac2017b3d713c76810c4b0eb16ccf23.tar.bz2
merchant-frontend-examples-9319c5693ac2017b3d713c76810c4b0eb16ccf23.zip
nicer PHP formatting, make fit within page boundaries
Diffstat (limited to 'php')
-rw-r--r--php/contract.php100
-rw-r--r--php/doc/Makefile2
2 files changed, 56 insertions, 46 deletions
diff --git a/php/contract.php b/php/contract.php
index 3af5ebf..49760d8 100644
--- a/php/contract.php
+++ b/php/contract.php
@@ -5,42 +5,58 @@
include_once 'helpers.php';
function make_contract($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&timestamp="
- . $now->getTimestamp()),
- 'repurchase_correlation_id' => '',
- 'pay_deadline' =>
- "/Date(" . $now->add(new DateInterval('P2W'))->getTimestamp() . ")/",
- 'refund_deadline' =>
- "/Date(" . $now->add(new DateInterval('P3M'))->getTimestamp() . ")/",
- 'merchant' =>
- array ('address' => 'LNAME2',
- 'name' => "Charity donation shop",
- 'jurisdiction' => 'LNAME3'),
- 'locations' =>
- array ('LNAME1' =>
+ $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&timestamp="
+ . $now->getTimestamp()),
+ 'repurchase_correlation_id' =>
+ '',
+ 'pay_deadline' =>
+ "/Date(" . $now->add(new DateInterval('P2W'))->getTimestamp() . ")/",
+ 'refund_deadline' =>
+ "/Date(" . $now->add(new DateInterval('P3M'))->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',
@@ -49,7 +65,7 @@
'ZIP code' => 49081,
'street' => 'test street 1',
'street number' => 201),
- 'LNAME2' =>
+ 'LNAME2' =>
array ('country' => 'Test Country 2',
'city' => 'Test City 2',
'state' => 'Test State 2',
@@ -57,14 +73,8 @@
'province' => 'Test Province 2',
'ZIP code' => 49082,
'street' => 'test street 2',
- 'street number' => 202),
- 'LNAME3' =>
- array ('country' => 'Test Country 3',
- 'city' => 'Test City 3',
- 'state' => 'Test State 3',
- 'region' => 'Test Region 3',
- 'province' => 'Test Province 3',
- 'ZIP code' => 49083)));
+ 'street number' => 202)
+ ));
return array ('contract' => $contract);
}
?>
diff --git a/php/doc/Makefile b/php/doc/Makefile
index f5573f2..56e08cd 100644
--- a/php/doc/Makefile
+++ b/php/doc/Makefile
@@ -13,5 +13,5 @@ clean:
rm -f arch.jpg arch.pdf tutorial.html tutorial.pdf
-info_TEXINFOS = manual.texi
+info_TEXINFOS = tutorial.texi
manual_TEXINFOS = version.texi