Index: branches/fundraising/extensions/DonationInterface/gateway_common/donation.api.php |
— | — | @@ -10,24 +10,27 @@ |
11 | 11 | |
12 | 12 | $params = $this->extractRequestParams(); |
13 | 13 | |
| 14 | + $gateway = $params['gateway']; |
| 15 | + |
14 | 16 | // If you want to test with fake data, pass a 'test' param set to true. |
15 | 17 | // You still have to set the gateway you are testing though. |
16 | 18 | if ( array_key_exists( 'test', $params ) && $params['test'] ) { |
17 | | - $params = $this->getTestData(); |
| 19 | + $params = $this->getTestData( $gateway ); |
18 | 20 | } |
19 | 21 | |
20 | | - $gateway = $params['gateway']; |
21 | 22 | $method = $params['payment_method']; |
22 | 23 | |
23 | 24 | if ( $gateway == 'payflowpro' ) { |
24 | 25 | $gatewayObj = new PayflowProAdapter(); |
25 | 26 | switch ( $method ) { |
| 27 | + // TODO: add other payment methods |
26 | 28 | default: |
27 | 29 | $result = $gatewayObj->do_transaction( 'Card' ); |
28 | 30 | } |
29 | 31 | } else if ( $gateway == 'globalcollect' ) { |
30 | 32 | $gatewayObj = new GlobalCollectAdapter(); |
31 | 33 | switch ( $method ) { |
| 34 | + // TODO: add other payment methods |
32 | 35 | default: |
33 | 36 | $result = $gatewayObj->do_transaction( 'TEST_CONNECTION' ); |
34 | 37 | } |
— | — | @@ -35,16 +38,18 @@ |
36 | 39 | $this->dieUsage( "Invalid gateway <<<$gateway>>> passed to Donation API.", 'unknown_gateway' ); |
37 | 40 | } |
38 | 41 | |
39 | | - $normalizedData = $gatewayObj->getData(); |
| 42 | + //$normalizedData = $gatewayObj->getData(); |
40 | 43 | |
41 | 44 | // Some output |
42 | 45 | $this->getResult()->setIndexedTagName( $result, 'response' ); |
| 46 | + $this->getResult()->addValue( 'data', 'request', $params ); |
43 | 47 | $this->getResult()->addValue( 'data', 'result', $result ); |
44 | 48 | } |
45 | 49 | |
46 | 50 | public function getAllowedParams() { |
47 | 51 | return array( |
48 | 52 | 'gateway' => $this->defineParam( 'gateway', true ), |
| 53 | + 'test' => $this->defineParam( 'test', false ), |
49 | 54 | 'amount' => $this->defineParam( 'amount', false ), |
50 | 55 | 'currency' => $this->defineParam( 'currency', false ), |
51 | 56 | 'fname' => $this->defineParam( 'fname', false ), |
— | — | @@ -74,8 +79,9 @@ |
75 | 80 | return $param; |
76 | 81 | } |
77 | 82 | |
78 | | - private function getTestData() { |
| 83 | + private function getTestData( $gateway ) { |
79 | 84 | $params = array( |
| 85 | + 'gateway' => $gateway, |
80 | 86 | 'amount' => "35", |
81 | 87 | 'currency' => 'USD', |
82 | 88 | 'fname' => 'Tester', |