Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php |
— | — | @@ -40,14 +40,14 @@ |
41 | 41 | //TODO: This is short-circuiting what I really want to do here. |
42 | 42 | //so stop it. |
43 | 43 | $data = $this->adapter->getDisplayData(); |
44 | | - |
| 44 | + |
45 | 45 | // dispatch forms/handling |
46 | 46 | if ( $this->adapter->checkTokens() ) { |
47 | 47 | if ( $this->adapter->posted) { |
48 | 48 | // The form was submitted and the payment method has been set |
49 | 49 | $this->adapter->log( "Form posted and payment method set." ); |
50 | 50 | // Check form for errors |
51 | | - $form_errors = $this->validateForm( $data, $this->errors, array( 'address', 'amount', 'creditCard', 'email', 'name' ) ); |
| 51 | + $form_errors = $this->validateForm( $data, $this->errors ); |
52 | 52 | // If there were errors, redisplay form, otherwise proceed to next step |
53 | 53 | if ( $form_errors ) { |
54 | 54 | $this->displayForm( $data, $this->errors ); |
Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php |
— | — | @@ -127,7 +127,6 @@ |
128 | 128 | 'values' => array( |
129 | 129 | 'ACTION' => 'INSERT_ORDERWITHPAYMENT', |
130 | 130 | 'HOSTEDINDICATOR' => '1', |
131 | | - //'PAYMENTPRODUCTID' => '11', |
132 | 131 | ), |
133 | 132 | 'do_validation' => true, |
134 | 133 | 'addDonorDataToSession' => true, |
— | — | @@ -229,7 +228,7 @@ |
230 | 229 | 'paymentproductid' => 0, |
231 | 230 | 'label' => 'Any', |
232 | 231 | 'group' => 'cc', |
233 | | - 'validation' => array( 'address' => true, 'amount' => true, 'creditCard' => true, 'email' => true, 'name' => true, ), |
| 232 | + 'validation' => array( 'address' => true, 'amount' => true, 'email' => true, 'name' => true, ), |
234 | 233 | ); |
235 | 234 | |
236 | 235 | /* |
— | — | @@ -241,7 +240,7 @@ |
242 | 241 | 'paymentproductid' => 1, |
243 | 242 | 'label' => 'Visa', |
244 | 243 | 'group' => 'cc', |
245 | | - 'validation' => array( 'address' => true, 'amount' => true, 'creditCard' => true, 'email' => true, 'name' => true, ), |
| 244 | + 'validation' => array( 'address' => true, 'amount' => true, 'email' => true, 'name' => true, ), |
246 | 245 | ); |
247 | 246 | |
248 | 247 | // MasterCard |
— | — | @@ -249,7 +248,7 @@ |
250 | 249 | 'paymentproductid' => 3, |
251 | 250 | 'label' => 'MasterCard', |
252 | 251 | 'group' => 'cc', |
253 | | - 'validation' => array( 'address' => true, 'amount' => true, 'creditCard' => true, 'email' => true, 'name' => true, ), |
| 252 | + 'validation' => array( 'address' => true, 'amount' => true, 'email' => true, 'name' => true, ), |
254 | 253 | ); |
255 | 254 | |
256 | 255 | // American Express |
— | — | @@ -257,7 +256,7 @@ |
258 | 257 | 'paymentproductid' => 2, |
259 | 258 | 'label' => 'American Express', |
260 | 259 | 'group' => 'cc', |
261 | | - 'validation' => array( 'address' => true, 'amount' => true, 'creditCard' => true, 'email' => true, 'name' => true, ), |
| 260 | + 'validation' => array( 'address' => true, 'amount' => true, 'email' => true, 'name' => true, ), |
262 | 261 | ); |
263 | 262 | |
264 | 263 | // Maestro |
Index: trunk/extensions/DonationInterface/gateway_common/GatewayForm.php |
— | — | @@ -94,39 +94,36 @@ |
95 | 95 | * |
96 | 96 | * @see GatewayForm::fnValidateForm() |
97 | 97 | */ |
98 | | - public function validateForm( &$data, &$error, $options = array( ) ) { |
| 98 | + public function validateForm( &$data, &$error, $options = false ) { |
99 | 99 | |
100 | | - //TODO: Should parts of this fail closed? Probably. Right now, with no |
101 | | - //options sent, nothing will validate. |
| 100 | + $validateAll = false; |
| 101 | + if ($options === false){ |
| 102 | + $validateAll = true; |
| 103 | + } |
| 104 | + |
| 105 | + if ( is_array( $options ) ){ |
| 106 | + extract( $options ); |
| 107 | + } |
102 | 108 | |
103 | | - extract( $options ); |
104 | | - |
105 | | - // Set which items will be validated |
106 | | - $address = isset( $address ) ? ( boolean ) $address : true; |
107 | | - $amount = isset( $amount ) ? ( boolean ) $amount : true; |
108 | | - $creditCard = isset( $creditCard ) ? ( boolean ) $creditCard : false; |
109 | | - $email = isset( $email ) ? ( boolean ) $email : true; |
110 | | - $name = isset( $name ) ? ( boolean ) $name : true; |
111 | | - |
112 | 109 | // These are set in the order they will most likely appear on the form. |
113 | | - |
114 | | - if ( $name ) { |
| 110 | + |
| 111 | + if ( $validateAll || isset( $name ) ) { |
115 | 112 | $this->validateName( $data, $error ); |
116 | 113 | } |
117 | 114 | |
118 | | - if ( $address ) { |
| 115 | + if ( $validateAll || isset( $address ) ) { |
119 | 116 | $this->validateAddress( $data, $error ); |
120 | 117 | } |
121 | 118 | |
122 | | - if ( $amount ) { |
| 119 | + if ( $validateAll || isset( $amount ) ) { |
123 | 120 | $this->validateAmount( $data, $error ); |
124 | 121 | } |
125 | 122 | |
126 | | - if ( $email ) { |
| 123 | + if ( $validateAll || isset( $email ) ) { |
127 | 124 | $this->validateEmail( $data, $error ); |
128 | 125 | } |
129 | 126 | |
130 | | - if ( $creditCard ) { |
| 127 | + if ( $validateAll || isset( $creditCard ) ) { |
131 | 128 | $this->validateCreditCard( $data, $error ); |
132 | 129 | } |
133 | 130 | |