/**
  *   Constructor.
  *   Set up the pp_data array.
  */
 function __construct($A = array())
 {
     $this->gw_id = 'authorizenetsim';
     parent::__construct($A);
     $this->pp_data['txn_id'] = $A['x_trans_id'];
     $this->pp_data['payer_email'] = $A['x_email'];
     $this->pp_data['payer_name'] = $A['x_first_name'] . ' ' . $A['x_last_name'];
     $this->pp_data['pmt_date'] = strftime('%d %b %Y %H:%M:%S', time());
     $this->pp_data['pmt_gross'] = (double) $A['x_amount'];
     $this->pp_data['gw_name'] = $this->gw->Description();
     $this->pp_data['pmt_status'] = $A['x_response_code'];
     $this->pp_data['pmt_shipping'] = $A['x_freight'];
     $this->pp_data['pmt_handling'] = 0;
     // not supported?
     $this->pp_data['pmt_tax'] = $A['x_tax'];
     // Check a couple of vars to see if a shipping address was supplied
     if (isset($A['x_ship_to_address']) && !empty($a['x_ship_to_address']) || isset($A['x_ship_to_city']) && !empty($A['x_ship_to_city'])) {
         $this->pp_data['shipto'] = array('name' => $A['x_ship_to_first_name'] . ' ' . $A['x_ship_to_last_name'], 'address1' => $A['x_ship_to_address'], 'address2' => '', 'city' => $A['x_ship_to_city'], 'state' => $A['x_ship_to_state'], 'country' => $A['x_ship_to_country'], 'zip' => $A['x_ship_to_zip'], 'phone' => $A['x_phone']);
     }
     $custom = explode(';', $A['custom']);
     foreach ($custom as $name => $temp) {
         list($name, $value) = explode(':', $temp);
         $this->pp_data['custom'][$name] = $value;
     }
     $items = explode('::', $A['item_var']);
     foreach ($items as $item) {
         list($itm_id, $price, $qty) = explode(';', $item);
         $this->AddItem($itm_id, $qty, $price);
     }
 }
示例#2
0
 /**
  *   Constructor.
  *   Set up the pp_data array.
  */
 function __construct($A = array())
 {
     $this->gw_id = 'amazon';
     parent::__construct($A);
     list($ccode, $amount) = preg_split('/\\ +/', $A['transactionAmount']);
     $this->pp_data['txn_id'] = $A['transactionId'];
     $this->pp_data['payer_email'] = $A['buyerEmail'];
     $this->pp_data['payer_name'] = $A['buyerName'];
     $this->pp_data['pmt_date'] = strftime('%d %b %Y %H:%M:%S', $A['transactionDate']);
     $this->pp_data['pmt_gross'] = (double) $amount;
     $this->pp_data['gw_name'] = $this->gw->Description();
     $this->pp_data['pmt_status'] = $A['status'];
     // Check a couple of vars to see if a shipping address was supplied
     if (isset($A['addressLine1']) || isset($A['city'])) {
         $this->pp_data['shipto'] = array('name' => $A['addressName'], 'address1' => $A['addressLine1'], 'address2' => $A['addressLine2'], 'city' => $A['city'], 'state' => $A['state'], 'country' => $A['country'], 'zip' => $A['zip'], 'phone' => $A['phoneNumber']);
     }
     $custom = explode(';', $A['referenceId']);
     foreach ($custom as $name => $temp) {
         list($name, $value) = explode(':', $temp);
         $this->pp_data['custom'][$name] = $value;
     }
     if ($this->pp_data['custom']['transtype'] == 'cart') {
         USES_paypal_class_cart();
         $cart = new ppCart($this->pp_data['custom']['cart_id']);
         foreach ($cart->Cart() as $itm_id => $data) {
             $this->AddItem($itm_id, $data['quantity'], $data['price']);
         }
     } else {
         $items = explode('::', $A['paymentReason']);
         foreach ($items as $item) {
             list($itm_id, $price, $qty) = explode(';', $item);
             $this->AddItem($itm_id, $qty, $price);
         }
     }
 }
示例#3
0
 /**
  *   Constructor.  Set up variables received from Paypal.
  *
  *   @param  array   $A      $_POST'd variables from Paypal
  */
 function __construct($A = array())
 {
     $this->gw_id = 'paypal';
     parent::__construct($A);
     $this->pp_data['txn_id'] = $A['txn_id'];
     $this->pp_data['payer_email'] = $A['payer_email'];
     $this->pp_data['payer_name'] = $A['first_name'] . ' ' . $A['last_name'];
     $this->pp_data['pmt_date'] = $A['payment_date'];
     $this->pp_data['pmt_gross'] = (double) $A['mc_gross'];
     $this->pp_data['pmt_tax'] = (double) $A['tax'];
     $this->pp_data['gw_desc'] = $this->gw->Description();
     $this->pp_data['gw_name'] = $this->gw->Name();
     $this->pp_data['pmt_status'] = $A['payment_status'];
     $this->pp_data['currency'] = $A['mc_currency'];
     if (isset($A['invoice'])) {
         $this->pp_data['invoice'] = $A['invoice'];
     }
     if (isset($A['parent_txn_id'])) {
         $this->pp_data['parent_txn_id'] = $A['parent_txn_id'];
     }
     // Check a couple of vars to see if a shipping address was supplied
     if (isset($A['address_street']) || isset($A['address_city'])) {
         $this->pp_data['shipto'] = array('name' => $A['address_name'], 'address1' => $A['address_street'], 'address2' => '', 'city' => $A['address_city'], 'state' => $A['address_state'], 'country' => $A['address_country'], 'zip' => $A['address_zip']);
     }
     // Set the custom data into an array.  If it can't be unserialized,
     // then treat it as a single value which contains only the user ID.
     if (isset($A['custom'])) {
         $this->custom = @unserialize(str_replace('\'', '"', $A['custom']));
         if (!$this->custom) {
             $this->custom = array('uid' => $A['custom']);
         }
     }
     switch ($this->pp_data['pmt_status']) {
         case 'Pending':
             $this->pp_data['status'] = 'pending';
             break;
         case 'Completed':
             $this->pp_data['status'] = 'paid';
             break;
         case 'Refunded':
             $this->pp_data['status'] = 'refunded';
             break;
     }
     switch ($A['txn_type']) {
         case 'web_accept':
         case 'send_money':
             $this->pp_data['pmt_shipping'] = (double) $A['shipping'];
             $this->pp_data['pmt_handling'] = (double) $A['handling'];
             break;
         case 'cart':
             $this->pp_data['pmt_shipping'] = (double) $A['mc_shipping'];
             $this->pp_data['pmt_handling'] = (double) $A['mc_handling'];
             break;
     }
 }