Index: civicrm/trunk/sites/all/modules/queue2civicrm/queue2civicrm.module |
— | — | @@ -89,6 +89,13 @@ |
90 | 90 | '#required' => TRUE, |
91 | 91 | '#default_value' => variable_get('queue2civicrm_subscription', '/queue/test'), |
92 | 92 | ); |
| 93 | + |
| 94 | + $form['queue2civicrm_OWA_log'] = array( |
| 95 | + '#type' => 'textfield', |
| 96 | + '#title' => t('OWA log path'), |
| 97 | + '#required' => TRUE, |
| 98 | + '#default_value' => variable_get('queue2civicrm_OWA_log', 'http://analytics.tesla.usability.wikimedia.org/wiki/d/extensions/owa/log.php'), |
| 99 | + ); |
93 | 100 | |
94 | 101 | $form['queue2civicrm_batch'] = array( |
95 | 102 | '#type' => 'select', |
— | — | @@ -248,8 +255,8 @@ |
249 | 256 | 'contact_type' => 'Individual', |
250 | 257 | 'first_name' => $msg['first_name'], |
251 | 258 | 'middle_name' => $msg['middle_name'], |
252 | | - 'last_name' => $msg['last_name'], |
253 | | - 'do_not_trade' => ($msg['anonymous'] ? 1 : 0 ), |
| 259 | + 'last_name' => $msg['last_name'], |
| 260 | + 'do_not_trade' => ($msg['anonymous'] ? 1 : 0 ), |
254 | 261 | 'contact_source' => 'online donation' |
255 | 262 | ); |
256 | 263 | // Honor the opt-out checkbox, if present |
— | — | @@ -346,9 +353,45 @@ |
347 | 354 | 'contact_id' => $contact['id'] |
348 | 355 | ); |
349 | 356 | $tag_result = &civicrm_entity_tag_add( $tag ); |
| 357 | + if(defined(OWA)){ |
| 358 | + queue2civicrm_record_OWA_contribution($msg); |
| 359 | + } |
| 360 | + |
350 | 361 | return TRUE; |
| 362 | + |
351 | 363 | } |
352 | 364 | |
| 365 | +function queue2civicrm_record_OWA_contribution($msg){ |
| 366 | + //NEED: |
| 367 | + //utm_campaign |
| 368 | + //referer URL |
| 369 | + //owa_session_id |
| 370 | + //OWA log URL |
| 371 | + |
| 372 | + $query_params = array( |
| 373 | + "owa_event_type" => "ecommerce.transaction", |
| 374 | + "owa_ct_order_id" => $msg[ 'contribution_tracking_id' ], |
| 375 | + "owa_ct_order_source" => $data['utm_campaign'], |
| 376 | + "owa_ct_total" => $msg['gross'], |
| 377 | + "owa_ct_tax" => 0, |
| 378 | + "owa_ct_shipping" => 0, |
| 379 | + "owa_ct_gateway" => $msg['gateway'], |
| 380 | + "owa_page_url" => $encodedReqURL, |
| 381 | + //ct_line_items[li_product_name]=foo& |
| 382 | + "owa_session_id"=> "some_id" |
| 383 | + ); |
| 384 | + |
| 385 | + //$owa_log_url = "http://analytics.tesla.usability.wikimedia.org/wiki/d/extensions/owa/log.php"; |
| 386 | + $owa_log_url = variable_get('queue2civicrm_OWA_log', 'http://analytics.tesla.usability.wikimedia.org/wiki/d/extensions/owa/log.php'); |
| 387 | + $ch = curl_init(); |
| 388 | + curl_setopt($ch, CURLOPT_URL, $owa_log_url . "?". http_build_query($query_params)); |
| 389 | + curl_setopt($ch, CURLOPT_USERAGENT, "WMF Ecommerce web service 1.0"); |
| 390 | + curl_exec($ch); |
| 391 | + curl_close($ch); |
| 392 | +} |
| 393 | + |
| 394 | + |
| 395 | + |
353 | 396 | /** |
354 | 397 | * Make the form to insert a test message into the queue |
355 | 398 | */ |