Index: trunk/extensions/DonationInterface/payflowpro_gateway/api_payflowpro_gateway.php |
— | — | @@ -51,6 +51,9 @@ |
52 | 52 | 'gateway' => array( |
53 | 53 | ApiBase::PARAM_TYPE => 'string', |
54 | 54 | ), |
| 55 | + 'payment_method' => array( |
| 56 | + ApiBase::PARAM_TYPE => 'string', |
| 57 | + ), |
55 | 58 | ); |
56 | 59 | } |
57 | 60 | |
— | — | @@ -58,6 +61,8 @@ |
59 | 62 | return array( |
60 | 63 | 'dispatch' => 'the API method from which to return data', |
61 | 64 | 'tracking_data' => 'A JSON formatted string of data to insert into contribution_tracking', |
| 65 | + 'gateway' => 'The current gateway', |
| 66 | + 'payment_method' => 'The current payment method' |
62 | 67 | ); |
63 | 68 | } |
64 | 69 | |
— | — | @@ -148,10 +153,8 @@ |
149 | 154 | * pageref => the url-encoded referrer to the full user-requested URL |
150 | 155 | */ |
151 | 156 | $tracking_data = $this->parseTrackingData( json_decode( $params[ 'tracking_data' ], true ) ); |
152 | | - |
153 | 157 | //instantiate a new DonationData that behaves like it's owned by the correct gateway. |
154 | 158 | $donationDataObj = new DonationData( $gateway_class, false, $tracking_data ); |
155 | | - |
156 | 159 | // fetch the order_id |
157 | 160 | $order_id = $donationDataObj->getVal( 'order_id' ); |
158 | 161 | |
Index: trunk/extensions/DonationInterface/payflowpro_gateway/pfp_api_controller.js |
— | — | @@ -17,7 +17,11 @@ |
18 | 18 | 'action' : 'pfp', |
19 | 19 | 'dispatch' : 'get_required_dynamic_form_elements', |
20 | 20 | 'format' : 'json', |
21 | | - 'tracking_data' : '{"url": "'+escape(window.location)+'", "pageref": "'+escape(document.referrer)+'"}' |
| 21 | + 'tracking_data' : '{"url": "'+escape(window.location)+ |
| 22 | + '", "pageref": "'+escape(document.referrer)+ |
| 23 | + '", "gateway": "'+escape(document.gateway)+ |
| 24 | + '", "payment_method": "'+escape(document.payment_method)+ |
| 25 | + '"}' |
22 | 26 | }, processFormElements, 'json' ); |
23 | 27 | }; |
24 | 28 | |
Index: trunk/extensions/DonationInterface/gateway_forms/Form.php |
— | — | @@ -423,6 +423,7 @@ |
424 | 424 | 'action' => $this->form_data['action'], |
425 | 425 | 'owa_session' => $this->form_data['owa_session'], |
426 | 426 | 'owa_ref' => $this->form_data['owa_ref'], |
| 427 | + 'gateway' => $this->form_data['gateway'], |
427 | 428 | ); |
428 | 429 | } |
429 | 430 | |
Index: trunk/extensions/DonationInterface/gateway_common/DonationData.php |
— | — | @@ -259,23 +259,22 @@ |
260 | 260 | * assigned. |
261 | 261 | */ |
262 | 262 | function handleContributionTrackingID(){ |
263 | | - //TODO: test with _cache_ on. |
264 | | - |
265 | | - //what follows here is the original horrible if statement for comparison to the new line (below). |
266 | | - //TODO: whack this when we know the replacement is solid. |
267 | | -// if ( !empty( $this->normalized ) && |
268 | | -// ( $this->getVal( 'numAttempt' ) == '0' && |
269 | | -// ((!$this->getVal( 'utm_source_id' ) == false ) || |
270 | | -// is_null($this->getVal( '_cache_' )) ) ) ) { |
271 | | -// $this->saveContributionTracking(); |
272 | | -// } |
273 | | - |
274 | 263 | if ( !$this->isSomething( 'contribution_tracking_id' ) && |
275 | | - ( $this->getVal( 'utm_source_id' ) !== false || !$this->isSomething( '_cache_' ) ) ){ |
| 264 | + ( !$this->canCache() ) ){ |
276 | 265 | $this->saveContributionTracking(); |
277 | 266 | } |
278 | 267 | } |
279 | | - |
| 268 | + |
| 269 | + |
| 270 | + function canCache(){ |
| 271 | + if ( $this->getVal( '_cache_' ) === 'true' ){ //::head. hit. keyboard.:: |
| 272 | + if ( $this->isSomething( 'utm_source_id' ) && $this->getVal( 'utm_source_id' ) !== false ){ |
| 273 | + return true; |
| 274 | + } |
| 275 | + } |
| 276 | + return false; |
| 277 | + } |
| 278 | + |
280 | 279 | /** |
281 | 280 | * normalizeAndSanitize helper function. |
282 | 281 | * Takes all possible sources for the intended donation amount, and |
— | — | @@ -554,8 +553,14 @@ |
555 | 554 | |
556 | 555 | $utm_source = $this->getVal( 'utm_source' ); |
557 | 556 | $utm_source_id = $this->getVal( 'utm_source_id' ); |
558 | | - $payment_method = $this->getVal( 'payment_method' ); |
559 | 557 | |
| 558 | + //TODO: Seriously, you need to move this. |
| 559 | + if ( $this->isSomething('payment_method') ){ |
| 560 | + $payment_method = $this->getVal( 'payment_method' ); |
| 561 | + } else { |
| 562 | + $payment_method = 'cc'; |
| 563 | + } |
| 564 | + |
560 | 565 | // this is how the payment method portion of the utm_source should be defined |
561 | 566 | $correct_payment_method_source = ( $utm_source_id ) ? $payment_method . $utm_source_id . '.' . $payment_method : $payment_method; |
562 | 567 | |