summaryrefslogtreecommitdiff
path: root/php/contract.php
blob: 7582ae7484148687da8672da51645279090bce56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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&timestamp="
                 . $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);
  }
?>