Beispiel #1
0
 /**
  * @param $key
  * @return array
  */
 private function requestArray($key)
 {
     if (!$this->_requestArray) {
         //check address
         if (strlen($this->shippingAddressModel->address1) < 2) {
             $this->shippingAddressModel->address1 = 'Address ' . $this->shippingAddressModel->address1;
         }
         if (strlen($this->billingAddressModel->address1) < 2) {
             $this->billingAddressModel->address1 = 'Address ' . $this->billingAddressModel->address1;
         }
         if (strlen($this->shippingAddressModel->city) < 2) {
             $this->shippingAddressModel->city = 'City ' . $this->shippingAddressModel->city;
         }
         if (strlen($this->billingAddressModel->city) < 2) {
             $this->billingAddressModel->city = 'City ' . $this->billingAddressModel->city;
         }
         // Check fname and lname
         if (strlen($this->shippingAddressModel->fname) < 2) {
             $this->shippingAddressModel->fname = 'Name ' . $this->shippingAddressModel->fname;
         }
         if (strlen($this->shippingAddressModel->lname) < 2) {
             $this->shippingAddressModel->lname = 'Last Name ' . $this->shippingAddressModel->lname;
         }
         if (strlen($this->billingAddressModel->fname) < 2) {
             $this->billingAddressModel->fname = 'Name ' . $this->billingAddressModel->fname;
         }
         if (strlen($this->billingAddressModel->lname) < 2) {
             $this->billingAddressModel->lname = 'Last Name ' . $this->billingAddressModel->lname;
         }
         $this->shippingAddressModel->fname = substr($this->shippingAddressModel->fname, 0, 42);
         $this->shippingAddressModel->lname = substr($this->shippingAddressModel->lname, 0, 42);
         $this->billingAddressModel->fname = substr($this->billingAddressModel->fname, 0, 42);
         $this->billingAddressModel->lname = substr($this->billingAddressModel->lname, 0, 42);
         $this->_requestArray = array('shopper-contact-info' => array('first-name' => preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->fname), 'last-name' => preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->lname), 'email' => $this->customerModel->email, 'address1' => substr(preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->address1), 0, 42), 'city' => substr(preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->city), 0, 42), 'state' => in_array($this->shippingAddressModel->country_id, array('ca', 'us')) ? $this->shippingAddressModel->state_id : '', 'zip' => $this->shippingAddressModel->zip, 'country' => $this->shippingAddressModel->country_id, 'phone' => $this->shippingAddressModel->phone), 'invoice-contact-info' => array('default' => 'true', 'first-name' => preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->fname), 'last-name' => preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->lname), 'email' => $this->customerModel->email, 'address1' => substr(preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->address1), 0, 42), 'city' => substr(preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->city), 0, 42), 'state' => in_array($this->shippingAddressModel->country_id, array('ca', 'us')) ? $this->shippingAddressModel->state_id : '', 'zip' => $this->shippingAddressModel->zip, 'country' => $this->shippingAddressModel->country_id, 'phone' => $this->shippingAddressModel->phone), 'billing-contact-info' => array('first-name' => preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->billingAddressModel->fname), 'last-name' => preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->billingAddressModel->lname), 'address1' => substr(preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->billingAddressModel->address1), 0, 42), 'city' => substr(preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->billingAddressModel->city), 0, 42), 'state' => in_array($this->billingAddressModel->country_id, array('ca', 'us')) ? $this->billingAddressModel->state_id : '', 'zip' => $this->billingAddressModel->zip, 'country' => $this->billingAddressModel->country_id), 'credit-card' => array('encrypted-card-number' => $this->paymentModel->txt3 ? $this->paymentModel->txt3 : $this->paymentModel->cc_number_encrypt, 'encrypted-security-code' => $this->paymentModel->txt4 ? $this->paymentModel->txt4 : $this->paymentModel->cc_cvv_encrypt, 'card-type' => strtoupper(Bin::getCardType($this->paymentModel->num2)), 'expiration-month' => $this->paymentModel->exp_date_month_formatted, 'expiration-year' => $this->paymentModel->exp_date_year_formatted), 'web-info' => array('ip' => $this->orderModel->ip_formatted, 'remote-host' => gethostbyname($this->orderModel->ip_formatted), 'user-agent' => 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0)'));
     }
     if (self::$isTest && in_array($key, array('credit-card')) && isset($this->_requestArray[$key])) {
         fb($this->_requestArray[$key]);
     }
     return isset($this->_requestArray[$key]) ? $this->_requestArray[$key] : array();
 }
Beispiel #2
0
 public function crmFormat()
 {
     if (!$this->method_id) {
         return array();
     }
     if (stripos($this->method->method_ref, 'cc_') !== false) {
         // CC Methods
         return array('Payment ID' => $this->payment_id, 'Card Type' => strtoupper(Bin::getCardType($this->num2)), 'Card Number' => substr($this->num2, 0, 4) . str_pad('', $this->num4 - 8, 'X', STR_PAD_LEFT) . str_pad($this->num3, 4, '0', STR_PAD_LEFT), 'Expiration' => $this->exp_date_formatted);
     } else {
         //return $this->getDataArray();
         return array('Payment ID' => $this->payment_id, 'Card Type' => $this->method->method_name, 'Card Number' => $this->txt1 . ' ' . $this->txt2 . ' ' . $this->txt3 . ' ' . $this->txt4, 'Expiration' => '');
     }
 }
Beispiel #3
0
 function getpaymentAction()
 {
     $this->checkLogin();
     AF::setJsonHeaders('json');
     $payment_id = AF::get($_POST, 'payment_id', false);
     if (!$payment_id) {
         Message::echoJsonError(__('incorrect_payment_id'));
     }
     $model = new Payment();
     if (!$model->fillFromDbPk($payment_id)) {
         Message::echoJsonError(__('incorrect_campaign_id'));
     }
     $result['cc_number'] = $model->cc_number_formatted;
     $result['cc_type'] = isset($model->num2) && strlen($model->num2) == 6 ? strtoupper(Bin::getCardType($this->num2)) : PaymentSystem::getCardType($model->cc_number);
     $result['exp_date'] = strlen($model->exp_date) == 3 ? '0' . $model->exp_date : $model->exp_date;
     $result['fields_expmonth'] = substr($result['exp_date'], 0, 2);
     $result['fields_expyear'] = '20' . substr($result['exp_date'], 2, 2);
     $result['cc_cvv'] = 'xxx';
     Message::echoJsonSuccess(array('message' => array('data' => $result)));
 }
Beispiel #4
0
 public function getRow()
 {
     //$date = DateTime::CreateFromFormat("Y-m-d H:m:s", $this->orders[$this->main_order_id]->created);
     $date = new DateTime($this->orders[$this->main_order_id]->created);
     $now = new DateTime();
     $cc_expires_28 = DateTime::CreateFromFormat("d/m/Y", '28/' . $this->payment->getexp_date_formatted());
     $products = array();
     $this->products2 = array();
     //for($i=0;$i<count($this->products);$i++) {
     $s = 0;
     foreach ($this->products as $p) {
         $s++;
         $productSKU = '';
         if (isset($p->product_sku)) {
             if ($s == 1) {
                 $productSKU = $p->product_sku;
             } else {
                 $productSKU = $p->product_shipping_sku ? $p->product_shipping_sku : $p->product_sku;
             }
         }
         $productCat = isset($p->prodcat_id) && $p->prodcat_id > 1 ? $p->prodcat->name : '';
         $this->products2[] = $productSKU;
         $products = array_merge($products, array('Product ' . $s . ' Name' => isset($p->product_name) ? $p->product_name : '', 'Product ' . $s . ' Price' => isset($p->product_price) ? $p->product_price : '', 'Product ' . $s . ' SKU #' => $productSKU, 'Product ' . $s . ' Category' => $productCat, 'Product ' . $s . ' Description' => isset($p->product_name) ? $p->product_name : '', 'Product ' . $s . ' Quantity' => isset($p) ? 1 : '', 'Product ' . $s . ' Weight' => isset($p->product_weight) ? $p->product_weight : '', 'Product ' . $s . ' Declared Value' => ''));
     }
     // DEFAULT EXPORT COLUMNS.  If you add a new column here it needs to be added to the fulfillment_fields table
     // as well, with fulfillment_id = 0
     $array = array('Order Id' => $this->main_order_id, 'Bill First' => $this->billingAddress->fname, 'Bill Last' => $this->billingAddress->lname, 'Bill Address1' => $this->billingAddress->address1, 'Bill Address2' => $this->billingAddress->address2, 'Bill Address1and2' => $this->billingAddress->address1 . ' ' . $this->billingAddress->address2, 'Bill City' => $this->billingAddress->city, 'Bill State' => $this->billingAddress->state_name, 'Bill Zip' => $this->billingAddress->zip, 'Bill Country' => $this->billingAddress->country_name, 'Bill Phone' => $this->billingAddress->phone, 'Bill Email' => $this->customer->email, 'Ship First' => $this->shippingAddress->fname, 'Ship Last' => $this->shippingAddress->lname, 'Ship Address1' => $this->shippingAddress->address1, 'Ship Address2' => $this->shippingAddress->address2, 'Ship Address1and2' => $this->shippingAddress->address1 . ' ' . $this->shippingAddress->address2, 'Ship City' => $this->shippingAddress->city, 'Ship State' => $this->shippingAddress->state_name, 'Ship Zip' => $this->shippingAddress->zip, 'Ship Country' => $this->shippingAddress->country_name, 'Ship Phone' => $this->shippingAddress->phone, 'Ship Email' => $this->customer->email, 'Ship Method Name' => $this->shipMethodName, 'Ship Method Description' => '', 'Ship Group Name' => $this->shipGroupName, 'Ship Group Code' => $this->shipGroupCode, 'Total Weight' => 0, 'Delivery Confirmation' => 'Yes', 'Signature Confirmation' => 'No', 'Ship Price' => sprintf("%.2f", $this->shippingPrice), 'Non Taxable Total' => sprintf("%.2f", $this->total), 'Taxable Total' => sprintf("%.2f", '0'), 'Sub Total' => sprintf("%.2f", $this->total), 'Sales Tax Percent' => sprintf("%.2f", '0'), 'Sales Tax Factor' => sprintf("%.2f", '0'), 'Order Total' => sprintf("%.2f", $this->total), 'Date of Sale' => $date->format($this->dateFormat), 'Time of Sale' => $date->format('H:i:s'), 'Tracking Number' => '', 'Payment' => !$this->payment->payment_id ? '' : ucwords(Bin::getCardType($this->payment->num2)), 'Last 4 of CC' => !$this->payment->payment_id ? '' : $this->payment->num3, 'Credit Card Expiration' => !$this->payment->payment_id ? '' : $this->payment->num1, 'IP Address' => $this->orders[$this->main_order_id]->ip_formatted, 'Customer Number' => '', 'Gateway Id' => $this->gateway->gateway_id, 'Gateway Alias' => $this->gateway->alias, 'Confirmation' => '', 'Confirmation Date/Time' => '', 'Export Date' => $now->format($this->dateFormat), 'CC Expire 28/mm/yyyy' => !$this->payment->payment_id ? '' : $cc_expires_28->format($this->dateFormat), 'Currency' => $this->campaign->currency_id, 'Package Id' => $this->package_id);
     return array_merge($array, $products);
 }