Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php |
— | — | @@ -1276,15 +1276,26 @@ |
1277 | 1277 | * @param string $transaction The transaction these codes map to. |
1278 | 1278 | * @param string $key The (incoming) field name containing the numeric codes |
1279 | 1279 | * we're defining here. |
1280 | | - * @param string $action Should be limited to the values 'complete', |
1281 | | - * 'pending', 'pending-poke', 'failed' and 'revised'... but for now you're |
1282 | | - * on the honor system, kids. TODO: Limit these values in this function, |
1283 | | - * once we are slightly more certain we don't need more values. |
| 1280 | + * @param string $action Limited to the values 'complete', 'pending', |
| 1281 | + * 'pending-poke', 'failed' and 'revised'. |
1284 | 1282 | * @param int $lower The integer value of the lower-bound in this code range. |
1285 | 1283 | * @param int $upper Optional: The integer value of the upper-bound in the |
1286 | 1284 | * code range. If omitted, it will make a range of one value: The lower bound. |
1287 | 1285 | */ |
1288 | 1286 | protected function addCodeRange( $transaction, $key, $action, $lower, $upper = null ) { |
| 1287 | + //our choices here are: |
| 1288 | + //TODO: Move this somewhere both this function and |
| 1289 | + //setTransactionWMFStatus can get to it. |
| 1290 | + $statuses = array( |
| 1291 | + 'complete', |
| 1292 | + 'pending', |
| 1293 | + 'pending-poke', |
| 1294 | + 'failed', |
| 1295 | + 'revised' |
| 1296 | + ); |
| 1297 | + if ( !in_array( $action, $statuses ) ) { |
| 1298 | + throw new MWException( "Transaction WMF Status $action is invalid." ); |
| 1299 | + } |
1289 | 1300 | if ( $upper === null ) { |
1290 | 1301 | $this->return_value_map[$transaction][$key][$lower] = $action; |
1291 | 1302 | } else { |
— | — | @@ -1573,11 +1584,23 @@ |
1574 | 1585 | * process to completion: This status being set at all, denotes the very end |
1575 | 1586 | * of the donation process on our end. Further attempts by the same user |
1576 | 1587 | * will be seen as starting over. |
1577 | | - * @param string $status Only five strings will do anything good in the rest |
1578 | | - * of the code so far: |
1579 | | - * 'complete', 'pending', 'pending-poke', 'failed', 'revised' |
| 1588 | + * @param string $status The final status of one discrete donation attempt, |
| 1589 | + * can be one of five values: 'complete', 'pending', 'pending-poke', |
| 1590 | + * 'failed', 'revised' |
1580 | 1591 | */ |
1581 | 1592 | public function setTransactionWMFStatus( $status ) { |
| 1593 | + //our choices here are: |
| 1594 | + $statuses = array( |
| 1595 | + 'complete', |
| 1596 | + 'pending', |
| 1597 | + 'pending-poke', |
| 1598 | + 'failed', |
| 1599 | + 'revised' |
| 1600 | + ); |
| 1601 | + if ( !in_array( $status, $statuses ) ) { |
| 1602 | + throw new MWException( "Transaction WMF Status $status is invalid." ); |
| 1603 | + } |
| 1604 | + |
1582 | 1605 | $this->transaction_results['WMF_STATUS'] = $status; |
1583 | 1606 | } |
1584 | 1607 | |
Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php |
— | — | @@ -110,7 +110,7 @@ |
111 | 111 | $this->addCodeRange( 'GET_ORDERSTATUS', 'STATUSID', 'pending', 300 ); |
112 | 112 | $this->addCodeRange( 'GET_ORDERSTATUS', 'STATUSID', 'failed', 310, 350 ); |
113 | 113 | $this->addCodeRange( 'GET_ORDERSTATUS', 'STATUSID', 'revised', 400 ); |
114 | | - $this->addCodeRange( 'GET_ORDERSTATUS', 'STATUSID', 'pending_poke', 525 ); |
| 114 | + $this->addCodeRange( 'GET_ORDERSTATUS', 'STATUSID', 'pending-poke', 525 ); |
115 | 115 | $this->addCodeRange( 'GET_ORDERSTATUS', 'STATUSID', 'pending', 550, 650 ); |
116 | 116 | $this->addCodeRange( 'GET_ORDERSTATUS', 'STATUSID', 'complete', 800, 975 ); //these are all post-authorized, but technically pre-settled... |
117 | 117 | $this->addCodeRange( 'GET_ORDERSTATUS', 'STATUSID', 'complete', 1000, 1050 ); |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | * Allowed: |
132 | 132 | * - complete |
133 | 133 | * - pending |
134 | | - * - pending_poke |
| 134 | + * - pending-poke |
135 | 135 | * - revised |
136 | 136 | * |
137 | 137 | * Denied: |
— | — | @@ -143,7 +143,7 @@ |
144 | 144 | $this->goToThankYouOn = array( |
145 | 145 | 'complete', |
146 | 146 | 'pending', |
147 | | - 'pending_poke', |
| 147 | + 'pending-poke', |
148 | 148 | 'revised', |
149 | 149 | ); |
150 | 150 | } |
— | — | @@ -289,7 +289,7 @@ |
290 | 290 | ), |
291 | 291 | 'loop_for_status' => array( |
292 | 292 | //'pending', |
293 | | - 'pending_poke', |
| 293 | + 'pending-poke', |
294 | 294 | 'complete', |
295 | 295 | 'failed', |
296 | 296 | 'revised', |