Пример #1
0
 /**
  * Get payment data for SERVER and DIRECT
  *
  * @param boolean $statusOk
  *
  * @return array
  */
 protected function getPaymentResultData($statusOk = false)
 {
     $result = array();
     if (filter_input(INPUT_GET, 'vtx')) {
         $payment = new ModelPayment();
         $result = $payment->getByVendorTxCode(filter_input(INPUT_GET, 'vtx'));
     }
     if (empty($result)) {
         $this->helperError('Transaction code is invalid: this can happen if you try to pay for multiple baskets at the same time. ' . 'Please contact [your customer service details] to check the status of your order.', url(array('server')));
     }
     $items = array();
     $basket = $this->getBasketFromProducts();
     if ($basket) {
         foreach ($basket->getItems() as $item) {
             $items[] = array('quantity' => $item->getQuantity(), 'urlImage' => $this->getProductUrlImage($item->getDescription()), 'description' => $item->getDescription());
         }
     }
     $errorMessage = '';
     if (!$statusOk) {
         switch ($result['status']) {
             case 'REJECTED':
                 $errorMessage = 'Your order did not meet our minimum fraud screening requirements.';
                 break;
             case 'ABORT':
                 $errorMessage = 'You chose to Cancel your order on the payment pages.';
                 break;
             default:
                 $errorMessage = 'ERROR.';
         }
     }
     return array('env' => $this->sagepayConfig->getEnv(), 'vendorName' => $this->sagepayConfig->getVendorName(), 'integrationType' => $this->integrationType, 'basket' => array('items' => $items), 'ord' => $result, 'stOk' => $statusOk, 'errorMessage' => $errorMessage);
 }
Пример #2
0
    /**
     * Populate data that is read from configurations
     */
    protected function addConfiguredValues()
    {
        $data = array(
            'Vendor' => $this->config->getVendorName(),
            'VPSProtocol' => $this->config->getProtocolVersion(),
            'Currency' => $this->config->getCurrency(),
            'TxType' => $this->config->getTxType(),
            'SendEMail' => $this->config->getSendEmail(),
            'VendorEMail' => $this->config->getVendorEmail(),
            'Apply3DSecure' => $this->config->getApply3dSecure(),
            'ApplyAVSCV2' => $this->config->getApplyAvsCv2(),
        );

        $partnerId = $this->config->getPartnerId();
        if (!empty($partnerId))
        {
            $data['ReferrerID'] = $partnerId;
        }
        if ($data['SendEMail'] == 1)
        {
            $data['eMailMessage'] = $this->config->getEmailMessage();
        }
        $allowGiftAid = $this->config->getAllowGiftAid();
        if (!isset($this->data['AllowGiftAid']))
        {
            $data['AllowGiftAid'] = $allowGiftAid;
        }

        $this->updateData($data);
    }
Пример #3
0
 /**
  * Prepare data for remove request
  * 
  * @param string $token
  * @return array
  */
 private function _prepareRemoveData($token) 
 {
     return array(
         'VPSProtocol' => $this->_config->getProtocolVersion(),
         'TxType' => self::REMOVETOKEN,
         'Vendor' => $this->_config->getVendorName(),
         'Token' => $token,
     );
 }