Esempio n. 1
0
 function send_void()
 {
     // initialize
     $dbTrans = PaycardLib::paycard_db();
     if (!$dbTrans) {
         PaycardLib::paycard_reset();
         return $this->setErrorMsg(PaycardLib::PAYCARD_ERR_NOSEND);
     }
     $request = new PaycardVoidRequest($this->refnum(CoreLocal::get('paycard_id')));
     $request->setProcessor('AuthDotNot');
     $mode = 'void';
     $cardPAN = $this->trans_pan['pan'];
     $request->setPAN($cardPAN);
     $request->setIssuer(CoreLocal::get("paycard_issuer"));
     $cardExM = substr(CoreLocal::get("paycard_exp"), 0, 2);
     $cardExY = substr(CoreLocal::get("paycard_exp"), 2, 2);
     $cardTr1 = $this->trans_pan['tr1'];
     $cardTr2 = $this->trans_pan['tr2'];
     $request->setCardholder(CoreLocal::get("paycard_name"));
     // x_login and x_tran_key need to
     // be filled in to work
     $postValues = array("x_login" => AUTHDOTNET_LOGIN, "x_tran_key" => AUTHDOTNET_TRANS_KEY, "x_market_type" => "2", "x_device_type" => "5", "cp_version" => "1.0", "x_text_request" => "1", "x_amount" => $request->formattedAmount(), "x_user_ref" => $request->refNum, "x_type" => "VOID", "x_card_num" => $cardPAN, "x_exp_date" => $cardExM . $cardExY);
     try {
         $res = $request->findOriginal();
         $request->saveRequest();
     } catch (Exception $ex) {
         return $this->setErrorMsg(PaycardLib::PAYCARD_ERR_NOSEND);
     }
     $TransactionID = $res['xTransactionID'];
     $postValues["x_ref_trans_id"] = $TransactionID;
     $this->last_request = $request;
     $postData = $this->array2post($postValues);
     $this->GATEWAY = "https://test.authorize.net/gateway/transact.dll";
     return $this->curlSend($postData, 'POST', False);
 }
Esempio n. 2
0
 private function send_void()
 {
     // initialize
     $dbTrans = Database::tDataConnect();
     if (!$dbTrans) {
         return $this->setErrorMsg(PaycardLib::PAYCARD_ERR_NOSEND);
         // database error, nothing sent (ok to retry)
     }
     $request = new PaycardVoidRequest($this->valutecIdentifier(CoreLocal::get('paycard_id')));
     $program = 'Gift';
     // valutec also has 'Loyalty' cards which store arbitrary point values
     $mode = 'void';
     $cardPAN = $this->getPAN();
     $identifier = date('mdHis');
     // the void itself needs a unique identifier, so just use a timestamp minus the year (10 digits only)
     $termID = $this->getTermID();
     try {
         $log = $request->findOriginal();
         $request->saveRequest();
     } catch (Exception $ex) {
         return PaycardLib::PAYCARD_ERR_NOSEND;
         // database error, nothing sent (ok to retry)
     }
     $log = $dbTrans->fetch_array($search);
     $authcode = $log['xAuthorizationCode'];
     $this->temp = $authcode;
     // assemble and send void request
     $vdMethod = 'Void';
     $vdFields = array('ProgramType' => $program, 'CardNumber' => $cardPAN, 'RequestAuthCode' => $authcode, 'ServerID' => $request->cashierNo, 'Identifier' => $request->refNum);
     $this->GATEWAY = "https://www.valutec.net/customers/transactions/valutec.asmx/";
     $getData = urlencode($vdMethod) . "?";
     $getData .= "TerminalID=" . urlencode($termID);
     foreach ($vdFields as $field => $value) {
         $getData .= "&" . urlencode($field) . "=" . urlencode($value);
     }
     $this->last_request = $request;
     return $this->curlSend($getData, 'GET');
 }
Esempio n. 3
0
 /**
   Updated for E2E
 */
 private function send_void($skipReversal = False, $domain = "w1.mercurypay.com")
 {
     // initialize
     $dbTrans = PaycardLib::paycard_db();
     if (!$dbTrans) {
         PaycardLib::paycard_reset();
         return $this->setErrorMsg(PaycardLib::PAYCARD_ERR_NOSEND);
     }
     if ($skipReversal) {
         CoreLocal::set("MercuryE2ESkipReversal", true);
     } else {
         CoreLocal::set("MercuryE2ESkipReversal", false);
     }
     $request = new PaycardVoidRequest($this->refnum(CoreLocal::get('paycard_id')));
     $request->setProcessor('MercuryE2E');
     $request->setMode('VoidSaleByRecordNo');
     $termID = $this->getTermID();
     $password = $this->getPw();
     $mcTerminalID = CoreLocal::get('PaycardsTerminalID');
     if ($mcTerminalID === '') {
         $mcTerminalID = CoreLocal::get('laneno');
     }
     $this->voidTrans = $transID;
     $this->voidRef = CoreLocal::get("paycard_trans");
     try {
         $res = $request->findOriginal();
     } catch (Exception $ex) {
         PaycardLib::paycard_reset();
         return $this->setErrorMsg(PaycardLib::PAYCARD_ERR_NOSEND);
     }
     try {
         $request->saveRequest();
     } catch (Exception $ex) {
         return $this->setErrorMsg(PaycardLib::PAYCARD_ERR_NOSEND);
     }
     $type = 'Credit';
     if (substr($res['mode'], 0, 6) == 'Debit_') {
         $type = 'Debit';
         if (substr($res['mode'], -5) == "_Sale") {
             $mode = 'ReturnByRecordNo';
         } else {
             if (substr($res['mode'], -7) == "_Return") {
                 $mode = 'SaleByRecordNo';
             }
         }
         CoreLocal::set("MercuryE2ESkipReversal", true);
     } else {
         if (substr($res['mode'], -7) == "_Return") {
             $mode = 'VoidReturnByRecordNo';
         }
     }
     $msgXml = "<?xml version=\"1.0\"" . "?" . ">\n            <TStream>\n            <Transaction>\n            <MerchantID>{$termID}</MerchantID>\n            <OperatorID>" . $request->cashierNo . "</OperatorID>\n            <LaneID>{$mcTerminalID}</LaneID>\n            <TranType>{$type}</TranType>\n            <TranCode>{$mode}</TranCode>\n            <InvoiceNo>" . $request->refNum . "</InvoiceNo>\n            <RefNo>" . $res['xTransactionID'] . "</RefNo>\n            <Memo>CORE POS 1.0.0</Memo>\n            <RecordNo>" . $res['token'] . "</RecordNo>\n            <Frequency>OneTime</Frequency>\n            <Amount>\n                <Purchase>" . $request->formattedAmount() . "</Purchase>\n            </Amount>\n            <TransInfo>";
     if (!$skipReversal) {
         $msgXml .= "<AcqRefData>" . $res['acqRefData'] . "</AcqRefData>\n                <ProcessData>" . $res['processData'] . "</ProcessData>";
     }
     $msgXml .= "<AuthCode>" . $res['xApprovalNumber'] . "</AuthCode>\n            </TransInfo>\n            </Transaction>\n            </TStream>";
     $soaptext = $this->soapify("CreditTransaction", array("tran" => $msgXml, "pw" => $password), "http://www.mercurypay.com");
     if (CoreLocal::get("training") == 1) {
         $this->GATEWAY = "https://w1.mercurydev.net/ws/ws.asmx";
     } else {
         $this->GATEWAY = "https://{$domain}/ws/ws.asmx";
     }
     return $this->curlSend($soaptext, 'SOAP');
 }