Пример #1
0
 public function cleanup($json)
 {
     switch (CoreLocal::get("paycard_mode")) {
         case PaycardLib::PAYCARD_MODE_AUTH:
             // cast to string. tender function expects string input
             // numeric input screws up parsing on negative values > $0.99
             $amt = "" . -1 * CoreLocal::get("paycard_amount");
             $t_type = 'CC';
             if (CoreLocal::get('paycard_issuer') == 'American Express') {
                 $t_type = 'AX';
             }
             // if the transaction has a non-zero paycardTransactionID,
             // include it in the tender line
             $record_id = $this->last_paycard_transaction_id;
             $charflag = $record_id != 0 ? 'PT' : '';
             TransRecord::addFlaggedTender("Credit Card", $t_type, $amt, $record_id, $charflag);
             CoreLocal::set("boxMsg", "<b>Approved</b>\n                        <font size=-1>\n                        <p>Please verify cardholder signature\n                        <p>[enter] to continue\n                        <br>\"rp\" to reprint slip\n                        <br>[void] " . _('to reverse the charge') . "\n                        </font>");
             if (CoreLocal::get("paycard_amount") <= CoreLocal::get("CCSigLimit") && CoreLocal::get("paycard_amount") >= 0) {
                 CoreLocal::set("boxMsg", "<b>Approved</b>\n                            <font size=-1>\n                            <p>No signature required\n                            <p>[enter] to continue\n                            <br>[void] " . _('to reverse the charge') . "\n                            </font>");
             } else {
                 if (CoreLocal::get('PaycardsSigCapture') != 1) {
                     $json['receipt'] = 'ccSlip';
                 }
             }
             break;
         case PaycardLib::PAYCARD_MODE_VOID:
             $v = new Void();
             $v->voidid(CoreLocal::get("paycard_id"), array());
             CoreLocal::set("boxMsg", "<b>Voided</b>\n                                           <p><font size=-1>[enter] to continue\n                                           <br>\"rp\" to reprint slip</font>");
             break;
     }
     return $json;
 }
Пример #2
0
 public function cleanup($json)
 {
     switch (CoreLocal::get("paycard_mode")) {
         case PaycardLib::PAYCARD_MODE_BALANCE:
             $resp = CoreLocal::get("paycard_response");
             CoreLocal::set("boxMsg", "<b>Success</b><font size=-1>\n                                           <p>Gift card balance: \$" . $resp["Balance"] . "\n                                           <p>\"rp\" to print\n                                           <br>[enter] to continue</font>");
             break;
         case PaycardLib::PAYCARD_MODE_ADDVALUE:
         case PaycardLib::PAYCARD_MODE_ACTIVATE:
             CoreLocal::set("autoReprint", 1);
             $ttl = CoreLocal::get("paycard_amount");
             PrehLib::deptkey($ttl * 100, 9020);
             $resp = CoreLocal::get("paycard_response");
             CoreLocal::set("boxMsg", "<b>Success</b><font size=-1>\n                                           <p>New card balance: \$" . $resp["Balance"] . "\n                                           <p>[enter] to continue\n                                           <br>\"rp\" to reprint slip</font>");
             break;
         case PaycardLib::PAYCARD_MODE_AUTH:
             CoreLocal::set("autoReprint", 1);
             $record_id = $this->last_paycard_transaction_id;
             $charflag = $record_id != 0 ? 'PT' : '';
             TransRecord::addFlaggedTender("Gift Card", "GD", $amt, $record_id, $charflag);
             $resp = CoreLocal::get("paycard_response");
             CoreLocal::set("boxMsg", "<b>Approved</b><font size=-1>\n                                           <p>Used: \$" . CoreLocal::get("paycard_amount") . "\n                                           <br />New balance: \$" . $resp["Balance"] . "\n                                           <p>[enter] to continue\n                                           <br>\"rp\" to reprint slip\n                                           <br>[void] to cancel and void</font>");
             break;
         case PaycardLib::PAYCARD_MODE_VOID:
         case PaycardLib::PAYCARD_MODE_VOIDITEM:
             CoreLocal::set("autoReprint", 1);
             $v = new Void();
             $v->voidid(CoreLocal::get("paycard_id"), array());
             $resp = CoreLocal::get("paycard_response");
             CoreLocal::set("boxMsg", "<b>Voided</b><font size=-1>\n                                           <p>New balance: \$" . $resp["Balance"] . "\n                                           <p>[enter] to continue\n                                           <br>\"rp\" to reprint slip</font>");
             break;
     }
     return $json;
 }
Пример #3
0
 public function cleanup($json)
 {
     switch (CoreLocal::get("paycard_mode")) {
         case PaycardLib::PAYCARD_MODE_ADDVALUE:
         case PaycardLib::PAYCARD_MODE_ACTIVATE:
             CoreLocal::set("autoReprint", 1);
             $ttl = CoreLocal::get("paycard_amount");
             PrehLib::deptkey($ttl * 100, 9020);
             $bal = CoreLocal::get('GiftBalance');
             CoreLocal::set("boxMsg", "<b>Success</b><font size=-1>\n                                           <p>New card balance: \$" . $bal . "\n                                           <p>[enter] to continue\n                                           <br>\"rp\" to reprint slip</font>");
             break;
         case PaycardLib::PAYCARD_MODE_BALANCE:
             $bal = CoreLocal::get('DatacapBalanceCheck');
             CoreLocal::set("boxMsg", "<b>Success</b><font size=-1>\n                                           <p>Card balance: \$" . $bal . "\n                                           <p>\"rp\" to print\n                                           <br>[enter] to continue</font>");
             break;
         case PaycardLib::PAYCARD_MODE_AUTH:
             // cast to string. tender function expects string input
             // numeric input screws up parsing on negative values > $0.99
             $amt = "" . -1 * CoreLocal::get("paycard_amount");
             $type = CoreLocal::get("CacheCardType");
             $t_type = 'CC';
             if (CoreLocal::get('paycard_issuer') == 'American Express') {
                 $t_type = 'AX';
             }
             if ($type == 'EBTFOOD') {
                 // extra tax exemption steps
                 TransRecord::addfsTaxExempt();
                 CoreLocal::set("fntlflag", 0);
                 Database::setglobalvalue("FntlFlag", 0);
             }
             list($tender_code, $tender_description) = PaycardLib::getTenderInfo($type, CoreLocal::get('paycard_issuer'));
             // if the transaction has a non-zero paycardTransactionID,
             // include it in the tender line
             $record_id = $this->last_paycard_transaction_id;
             $charflag = $record_id != 0 ? 'PT' : '';
             TransRecord::addFlaggedTender($tender_description, $tender_code, $amt, $record_id, $charflag);
             $appr_type = 'Approved';
             if (CoreLocal::get('paycard_partial')) {
                 $appr_type = 'Partial Approval';
             } elseif (CoreLocal::get('paycard_amount') == 0) {
                 $appr_type = 'Declined';
                 $json['receipt'] = 'ccDecline';
             }
             CoreLocal::set('paycard_partial', false);
             $isCredit = CoreLocal::get('CacheCardType') == 'CREDIT' || CoreLocal::get('CacheCardType') == '' ? true : false;
             $needSig = CoreLocal::get('paycard_amount') > CoreLocal::get('CCSigLimit') || CoreLocal::get('paycard_amount') < 0 ? true : false;
             if (($isCredit || CoreLocal::get('EmvSignature') === true) && $needSig) {
                 CoreLocal::set("boxMsg", "<b>{$appr_type}</b>\n                            <font size=-1>\n                            <p>Please verify cardholder signature\n                            <p>[enter] to continue\n                            <br>\"rp\" to reprint slip\n                            <br>[void] " . _('to reverse the charge') . "\n                            </font>");
                 if (CoreLocal::get('PaycardsSigCapture') != 1) {
                     $json['receipt'] = 'ccSlip';
                 }
             } else {
                 CoreLocal::set("boxMsg", "<b>{$appr_type}</b>\n                            <font size=-1>\n                            <p>No signature required\n                            <p>[enter] to continue\n                            <br>[void] " . _('to reverse the charge') . "\n                            </font>");
             }
             break;
         case PaycardLib::PAYCARD_MODE_VOID:
             $void = new Void();
             $void->voidid(CoreLocal::get("paycard_id"), array());
             // advanced ID to the void line
             CoreLocal::set('paycard_id', CoreLocal::get('paycard_id') + 1);
             CoreLocal::set("boxMsg", "<b>Voided</b>\n                                           <p><font size=-1>[enter] to continue\n                                           <br>\"rp\" to reprint slip</font>");
             break;
     }
     return $json;
 }