Пример #1
0
 /**
  * Return data for result query
  *
  * @param boolean $isSuccess
  * @return array
  * @throws SagepayApiException
  */
 private function _resultData($isSuccess = false)
 {
     $formPassword = $this->sagepayConfig->getFormPassword();
     $env = $this->sagepayConfig->getEnv();
     $crypt = filter_input(INPUT_GET, 'crypt');
     $decrypt = SagepayUtil::decryptAes($crypt, $formPassword[$env]);
     $decryptArr = SagepayUtil::queryStringToArray($decrypt);
     if (!$decrypt || empty($decryptArr)) {
         throw new SagepayApiException('Invalid crypt input');
     }
     $helperMessage = new HelperMessage();
     $basket = $this->getBasketFromProducts();
     $items = array();
     // Get products from basket
     if ($basket) {
         foreach ($basket->getItems() as $item) {
             $items[] = array('productUrlImage' => $this->getProductUrlImage($item->getDescription()), 'description' => $item->getDescription(), 'quantity' => $item->getQuantity());
         }
     }
     return array('env' => $env, 'vendorName' => $this->sagepayConfig->getVendorName(), 'integrationType' => $this->integrationType, 'basket' => array('items' => $items), 'decrypt' => $decryptArr, 'currency' => $this->sagepayConfig->getCurrency(), 'isSuccess' => $isSuccess, 'message' => $helperMessage->getMessage($decryptArr['Status']), 'res' => array('vpsTxId' => $decryptArr['VPSTxId'], 'txAuthNo' => isset($decryptArr['TxAuthNo']) ? $decryptArr['TxAuthNo'] : '', 'Surcharge' => isset($decryptArr['Surcharge']) ? $decryptArr['Surcharge'] : '', 'BankAuthCode' => isset($decryptArr['BankAuthCode']) ? $decryptArr['BankAuthCode'] : '', 'DeclineCode' => isset($decryptArr['DeclineCode']) ? $decryptArr['DeclineCode'] : '', 'GiftAid' => isset($decryptArr['GiftAid']) && $decryptArr['GiftAid'] == 1, 'avsCv2' => isset($decryptArr['AVSCV2']) ? $decryptArr['AVSCV2'] : '', 'addressResult' => isset($decryptArr['AddressResult']) ? $decryptArr['AddressResult'] : '', 'postCodeResult' => isset($decryptArr['PostCodeResult']) ? $decryptArr['PostCodeResult'] : '', 'cv2Result' => isset($decryptArr['CV2Result']) ? $decryptArr['CV2Result'] : '', '3DSecureStatus' => isset($decryptArr['3DSecureStatus']) ? $decryptArr['3DSecureStatus'] : '', 'CAVV' => isset($decryptArr['CAVV']) ? $decryptArr['CAVV'] : '', 'cardType' => isset($decryptArr['CardType']) ? $decryptArr['CardType'] : '', 'last4Digits' => isset($decryptArr['Last4Digits']) ? $decryptArr['Last4Digits'] : '', 'expiryDate' => isset($decryptArr['ExpiryDate']) ? $decryptArr['ExpiryDate'] : '', 'addressStatus' => isset($decryptArr['AddressStatus']) ? $decryptArr['AddressStatus'] : '', 'payerStatus' => isset($decryptArr['PayerStatus']) ? $decryptArr['PayerStatus'] : ''));
 }
Пример #2
0
function eme_sagepay_notification()
{
    $sagepay_demo = get_option('eme_sagepay_demo');
    if ($sagepay_demo == 1) {
        $sagepay_pwd = get_option('eme_sagepay_test_pwd');
    } else {
        $sagepay_pwd = get_option('eme_sagepay_live_pwd');
    }
    require_once 'payment_gateways/sagepay/eme-sagepay-util.php';
    $decrypt = SagepayUtil::decryptAes($crypt, $sagepay_pwd);
    $decryptArr = SagepayUtil::queryStringToArray($decrypt);
    if ($decrypt && !empty($decryptArr)) {
        if ($decryptArr['Status'] == 'OK') {
            $payment_id = $decryptArr['VendorTxCode'];
            eme_update_payment_payed($payment_id);
        }
    }
}