Exemple #1
0
 protected function varied_message($ref, $reprint = false, $sigSlip = false)
 {
     if (CoreLocal::get('autoReprint') == 1) {
         $sigSlip = true;
     }
     $date = ReceiptLib::build_time(time());
     list($emp, $reg, $trans) = explode('-', $ref);
     $slip = '';
     // query database for gc receipt info
     $db = Database::tDataConnect();
     if ($reprint) {
         $db = Database::mDataConnect();
     }
     $order = $sigSlip ? 'DESC' : 'ASC';
     $trans_type = $db->concat('p.cardType', "' '", 'p.transType', '');
     $sql = "SELECT {$trans_type} AS tranType,\n                    CASE WHEN p.transType = 'Return' THEN -1*p.amount ELSE p.amount END as amount,\n                    p.registerNo as terminalID,\n                    p.PAN,\n                    CASE WHEN p.manual=1 THEN 'Manual' ELSE 'Swiped' END as entryMethod,\n                    CASE WHEN transType='VOID' THEN '' ELSE p.xApprovalNumber END AS xAuthorizationCode,\n                    p.xBalance,\n                    CASE WHEN transType='VOID' THEN p.xApprovalNumber ELSE '' END AS xVoidCode,\n                    p.transID,\n                    p.requestDatetime AS datetime\n                FROM PaycardTransactions AS p\n                WHERE dateID=" . date('Ymd') . "\n                    AND empNo=" . $emp . "\n                    AND registerNo=" . $reg . "\n                    AND transNo=" . $trans . "\n                    AND p.validResponse=1\n                    AND p.xResultMessage LIKE '%Appro%'\n                    AND p.cardType = 'Gift'\n                ORDER BY p.requestDatetime " . $order;
     $result = $db->query($sql);
     $num = $db->num_rows($result);
     while ($row = $db->fetch_row($result)) {
         $slip .= ReceiptLib::centerString("................................................") . "\n";
         // store header
         for ($i = 1; $i <= CoreLocal::get('chargeSlipCount'); $i++) {
             $slip .= ReceiptLib::centerString(CoreLocal::get("chargeSlip" . $i)) . "\n";
         }
         $slip .= "\n";
         $col1 = array();
         $col2 = array();
         $col1[] = $row['tranType'];
         $col2[] = "Date: " . date('m/d/y h:i a', strtotime($row['datetime']));
         $col1[] = "Terminal ID: " . $row['terminalID'];
         $col2[] = "Reference: " . $ref . "-" . $row['transID'];
         $col1[] = "Card: " . $row['PAN'];
         $col2[] = "Entry Method: " . $row['entryMethod'];
         if ((int) $row['xVoidCode'] > 0) {
             $col1[] = "Void Auth: " . $row['xVoidCode'];
             $col2[] = "Orig Auth: " . $row['xAuthorizationCode'];
         } else {
             $col1[] = "Authorization: " . $row['xAuthorizationCode'];
             $col2[] = "";
         }
         $col1[] = ReceiptLib::boldFont() . "Amount: " . PaycardLib::paycard_moneyFormat($row['amount']) . ReceiptLib::normalFont();
         // bold ttls apbw 11/3/07
         $col2[] = "New Balance: " . PaycardLib::paycard_moneyFormat($row['xBalance']);
         $slip .= ReceiptLib::twoColumns($col1, $col2);
         // name/phone on activation only
         if (($row['tranType'] == 'Gift Card Activation' || $row['tranType'] == 'Gift Card Issue') && $sigSlip) {
             $slip .= "\n" . ReceiptLib::centerString("Name:  ___________________________________") . "\n" . "\n" . ReceiptLib::centerString("Phone: ___________________________________") . "\n";
         }
         $slip .= ReceiptLib::centerString("................................................") . "\n";
     }
     return $slip;
 }
Exemple #2
0
 function body_content()
 {
     ?>
     <div class="baseHeight">
     <?php 
     // generate message to print
     $amt = CoreLocal::get("paycard_amount");
     if ($amt > 0) {
         echo PaycardLib::paycard_msgBox($type, "Void " . PaycardLib::paycard_moneyFormat($amt) . " Payment?", "Please enter password then", "[enter] to continue voiding or<br>[clear] to cancel the void");
     } else {
         echo PaycardLib::paycard_msgBox($type, "\n                Void " . PaycardLib::paycard_moneyFormat($amt) . " Refund?", "Please enter password then", "[enter] to continue voiding or<br>[clear] to cancel the void");
     }
     ?>
     </div>
     <?php 
 }
Exemple #3
0
 private function handleResponseAuth($authResult)
 {
     $xml = new xmlData($authResult["response"]);
     $request = $this->last_request;
     $this->last_paycard_transaction_id = $request->last_paycard_transaction_id;
     $response = new PaycardResponse($request, $authResult);
     // initialize
     $dbTrans = Database::tDataConnect();
     $program = 'Gift';
     $validResponse = $xml->isValid() ? 1 : 0;
     $errorMsg = $xml->get_first("ERRORMSG");
     $balance = $xml->get("BALANCE");
     if ($validResponse) {
         /*
                     tendering more than the available balance returns an "NSF" error message, 
                     but no Balance field however, the available balance is buried in the 
                     RawOutput field, so we can dig it out and fill in the missing Balance field
                     -- as of 1/22/08, valutec appears to now be returning the Balance field normally 
                     (in its own XML field, not in RawOutput), but we still need to append it to 
                     the Message so the cashier can see it
         */
         if ($errorMsg && substr($errorMsg, 0, 3) == "NSF") {
             if (!$balance || $balance === "") {
                 $rawOutput = $xml->get("RAWOUTPUT");
                 $begin = strpos($rawOutput, "%1cBAL%3a");
                 if ($begin !== false) {
                     $end = strpos($rawOutput, "%1c", $begin + 1);
                     if ($end !== false && $end > $begin) {
                         $balance = trim(urldecode(substr($rawOutput, $begin + 9, $end - $begin - 9)));
                     }
                 }
             } else {
                 if ($balance && $balance !== "") {
                     $errorMsg = "NSF, BAL: " . PaycardLib::paycard_moneyFormat($balance);
                 }
             }
         }
         // verify that echo'd fields match our request
         if ($xml->get('TRANSACTIONTYPE') && $xml->get('TRANSACTIONTYPE') == $program && $xml->get('IDENTIFIER') && $xml->get('IDENTIFIER') == $identifier && $xml->get('AUTHORIZED')) {
             $validResponse = 1;
             // response was parsed normally, echo'd fields match, and other required fields are present
         } else {
             $validResponse = 4;
             // response was parsed as XML but fields didn't match
         }
     }
     $response->setBalance($balance);
     $resultCode = 0;
     $apprNumber = $xml->get('AUTHORIZATIONCODE');
     $response->setApprovalNum($apprNumber);
     $rMsg = '';
     if ($apprNumber != '' && $xml->get('AUTHORIZED') == 'true') {
         $validResponse = 1;
         $resultCode = 1;
         $rMsg = 'Approved';
     } else {
         $rMsg = substr($xml->get_first('ERRORMSG'), 0, 100);
     }
     $response->setResultMsg($rMsg);
     $response->setResultCode($resultCode);
     $response->setResponseCode($resultCode);
     $response->setNormalizedCode($resultCode);
     $response->setValid($validResponse);
     try {
         $response->saveResponse();
     } catch (Exception $ex) {
     }
     // check for communication errors (any cURL error or any HTTP code besides 200)
     if ($authResult['curlErr'] != CURLE_OK || $authResult['curlHTTP'] != 200) {
         if ($authResult['curlHTTP'] == '0') {
             CoreLocal::set("boxMsg", "No response from processor<br />\n                                The transaction did not go through");
             return PaycardLib::PAYCARD_ERR_PROC;
         }
         return $this->setErrorMsg(PaycardLib::PAYCARD_ERR_COMM);
     }
     // check for data errors (any failure to parse response XML or echo'd field mismatch
     if ($validResponse != 1) {
         // invalid server response, we don't know if the transaction was processed (use carbon)
         return $this->setErrorMsg(PaycardLib::PAYCARD_ERR_DATA);
     }
     $amtUsed = $xml->get('CARDAMOUNTUSED');
     if ($amtUsed) {
         $request->changeAmount($amtUsed);
     }
     // put the parsed response into session so the caller, receipt printer, etc can get the data they need
     CoreLocal::set("paycard_response", array());
     CoreLocal::set("paycard_response", $xml->array_dump());
     $temp = CoreLocal::get("paycard_response");
     $temp["Balance"] = $temp["BALANCE"];
     CoreLocal::set("paycard_response", $temp);
     // comm successful, check the Authorized, AuthorizationCode and ErrorMsg fields
     if ($xml->get('AUTHORIZED') == 'true' && $xml->get('AUTHORIZATIONCODE') != '' && $xml->get_first('ERRORMSG') == '') {
         return PaycardLib::PAYCARD_ERR_OK;
         // authorization approved, no error
     }
     // the authorizor gave us some failure code
     // authorization failed, response fields in $_SESSION["paycard_response"]
     CoreLocal::set("boxMsg", "Processor error: " . $errorMsg);
     return PaycardLib::PAYCARD_ERR_PROC;
 }
Exemple #4
0
 function body_content()
 {
     ?>
     <div class="baseHeight">
     <?php 
     // generate message to print
     $type = CoreLocal::get("paycard_type");
     $mode = CoreLocal::get("paycard_mode");
     $amt = CoreLocal::get("paycard_amount");
     if ($amt == 0) {
         if ($mode == PaycardLib::PAYCARD_MODE_ACTIVATE) {
             echo PaycardLib::paycard_msgBox($type, "Enter Activation Amount", "Enter the amount to put on the card", "[clear] to cancel");
         } else {
             if ($mode == PaycardLib::PAYCARD_MODE_ADDVALUE) {
                 echo PaycardLib::paycard_msgBox($type, "Enter Add-Value Amount", "Enter the amount to put on the card", "[clear] to cancel");
             }
         }
     } else {
         if (!is_numeric($amt) || $amt < 0.005) {
             echo PaycardLib::paycard_msgBox($type, "Invalid Amount", "Enter a positive amount to put on the card", "[clear] to cancel");
         } else {
             if ($mode == PaycardLib::PAYCARD_MODE_ACTIVATE) {
                 echo PaycardLib::paycard_msgBox($type, "Activate " . PaycardLib::paycard_moneyFormat($amt) . "?", "", "[enter] to continue if correct<br>Enter a different amount if incorrect<br>[clear] to cancel");
             } else {
                 if ($mode == PaycardLib::PAYCARD_MODE_ADDVALUE) {
                     echo PaycardLib::paycard_msgBox($type, "Add Value " . PaycardLib::paycard_moneyFormat($amt) . "?", "", "[enter] to continue if correct<br>Enter a different amount if incorrect<br>[clear] to cancel");
                 }
             }
         }
     }
     CoreLocal::set("msgrepeat", 2);
     ?>
     </div>
     <?php 
 }
Exemple #5
0
 function body_content()
 {
     ?>
     <div class="baseHeight">
     <?php 
     // generate message to print
     $type = CoreLocal::get("paycard_type");
     $mode = CoreLocal::get("paycard_mode");
     $amt = CoreLocal::get("paycard_amount");
     if ($mode == PaycardLib::PAYCARD_MODE_VOIDITEM) {
         echo PaycardLib::paycard_msgBox($type, "Void " . PaycardLib::paycard_moneyFormat($amt) . " Gift Card?", "", "[enter] to continue voiding<br>[clear] to cancel the void");
     } else {
         if ($amt > 0) {
             echo PaycardLib::paycard_msgBox($type, "Void " . PaycardLib::paycard_moneyFormat($amt) . " Payment?", "Please enter password then", "[enter] to continue voiding or<br>[clear] to cancel the void");
         } else {
             echo PaycardLib::paycard_msgBox($type, "Void " . PaycardLib::paycard_moneyFormat($amt) . " Refund?", "Please enter password then", "[enter] to continue voiding or<br>[clear] to cancel the void");
         }
     }
     CoreLocal::set("msgrepeat", 2);
     ?>
     </div>
     <?php 
 }
Exemple #6
0
 function body_content()
 {
     ?>
     <div class="baseHeight">
     <?php 
     // generate message to print
     $type = CoreLocal::get("paycard_type");
     $mode = CoreLocal::get("paycard_mode");
     $amt = CoreLocal::get("paycard_amount");
     $due = CoreLocal::get("amtdue");
     $cb = CoreLocal::get('CacheCardCashBack');
     $balance_limit = CoreLocal::get('PaycardRetryBalanceLimit');
     if ($type == 'EBTFOOD') {
         $due = CoreLocal::get('fsEligible');
     }
     if ($cb > 0) {
         $amt -= $cb;
     }
     if (!is_numeric($amt) || abs($amt) < 0.005) {
         echo PaycardLib::paycard_msgBox($type, "Invalid Amount: {$amt}", "Enter a different amount", "[clear] to cancel");
     } else {
         if ($amt > 0 && $due < 0) {
             echo PaycardLib::paycard_msgBox($type, "Invalid Amount", "Enter a negative amount", "[clear] to cancel");
         } else {
             if ($amt < 0 && $due > 0) {
                 echo PaycardLib::paycard_msgBox($type, "Invalid Amount", "Enter a positive amount", "[clear] to cancel");
             } else {
                 if ($amt - $due > 0.005 && $type != 'DEBIT' && $type != 'EBTCASH') {
                     echo PaycardLib::paycard_msgBox($type, "Invalid Amount", "Cannot exceed amount due", "[clear] to cancel");
                 } else {
                     if ($amt - $due - 0.005 > $cb && ($type == 'DEBIT' || $type == 'EBTCASH')) {
                         echo PaycardLib::paycard_msgBox($type, "Invalid Amount", "Cannot exceed amount due plus cashback", "[clear] to cancel");
                     } else {
                         if ($balance_limit > 0 && $amt - $balance_limit > 0.005) {
                             echo PaycardLib::paycard_msgBox($type, "Exceeds Balance", "Cannot exceed card balance", "[clear] to cancel");
                         } else {
                             if ($balance_limit > 0) {
                                 $msg = "Tender " . PaycardLib::paycard_moneyFormat($amt);
                                 if (CoreLocal::get("CacheCardType") != "") {
                                     $msg .= " as " . CoreLocal::get("CacheCardType");
                                 } elseif (CoreLocal::get('paycard_type') == PaycardLib::PAYCARD_TYPE_GIFT) {
                                     $msg .= ' as GIFT';
                                 }
                                 echo PaycardLib::paycard_msgBox($type, $msg . "?", "", "Card balance is {$balance_limit}<br>\n                    [enter] to continue if correct<br>Enter a different amount if incorrect<br>\n                    [clear] to cancel");
                             } elseif ($amt > 0) {
                                 $msg = "Tender " . PaycardLib::paycard_moneyFormat($amt);
                                 if (CoreLocal::get("CacheCardType") != "") {
                                     $msg .= " as " . CoreLocal::get("CacheCardType");
                                 } elseif (CoreLocal::get('paycard_type') == PaycardLib::PAYCARD_TYPE_GIFT) {
                                     $msg .= ' as GIFT';
                                 }
                                 if ($cb > 0) {
                                     $msg .= ' (CB:' . PaycardLib::paycard_moneyFormat($cb) . ')';
                                 }
                                 $msg .= '?';
                                 if (CoreLocal::get('CacheCardType') == 'EBTFOOD' && abs(CoreLocal::get('subtotal') - CoreLocal::get('fsEligible')) > 0.005) {
                                     $msg .= '<br />' . _('Not all items eligible');
                                 }
                                 echo PaycardLib::paycard_msgBox($type, $msg, "", "[enter] to continue if correct<br>Enter a different amount if incorrect<br>[clear] to cancel");
                             } elseif ($amt < 0) {
                                 echo PaycardLib::paycard_msgBox($type, "Refund " . PaycardLib::paycard_moneyFormat($amt) . "?", "", "[enter] to continue if correct<br>Enter a different amount if incorrect<br>[clear] to cancel");
                             } else {
                                 echo PaycardLib::paycard_errBox($type, "Invalid Entry", "Enter a different amount", "[clear] to cancel");
                             }
                         }
                     }
                 }
             }
         }
     }
     CoreLocal::set("msgrepeat", 2);
     ?>
     </div>
     <?php 
 }