|
|
@@ -13,6 +13,8 @@
|
|
|
var freeTicketPromotionCode = isFreeTicketMode
|
|
|
? Context.Session.GetString("Millions.FreeTicket.PromotionCode")
|
|
|
: null;
|
|
|
+ var hasFreeTicketPromotion = isFreeTicketMode
|
|
|
+ && !string.IsNullOrWhiteSpace(freeTicketPromotionCode);
|
|
|
}
|
|
|
|
|
|
@section Styles {
|
|
|
@@ -527,6 +529,7 @@ else
|
|
|
|
|
|
const maxBalls = @(Model.termType == Constants.PIC10_BASIC_CODE ? 10 : (Model.termType == Constants.Millions_CODE ? 6 : (Model.termType == Constants.PIC10_BIGSMALL_CODE ? 13 : 15)));
|
|
|
const isFreeTicketMode = @(isFreeTicketMode ? "true" : "false");
|
|
|
+ const hasFreeTicketPromotion = @(hasFreeTicketPromotion ? "true" : "false");
|
|
|
const freeTicketPromotionCode = @Html.Raw(System.Text.Json.JsonSerializer.Serialize(freeTicketPromotionCode));
|
|
|
|
|
|
function reindexTickets() {
|
|
|
@@ -952,7 +955,9 @@ else
|
|
|
filledTickets++;
|
|
|
}
|
|
|
});
|
|
|
- const pricePerTicket = @(Model.termType == Constants.PIC10_BASIC_CODE ? "10" : (Model.termType == Constants.Millions_CODE ? "20" : "50"));
|
|
|
+ const pricePerTicket = hasFreeTicketPromotion
|
|
|
+ ? 0
|
|
|
+ : @(Model.termType == Constants.PIC10_BASIC_CODE ? "10" : (Model.termType == Constants.Millions_CODE ? "20" : "50"));
|
|
|
$("#totalPrice").text(formatMoneyV2(filledTickets * pricePerTicket));
|
|
|
$("#totalTicketCount").text(filledTickets);
|
|
|
}
|
|
|
@@ -1055,6 +1060,10 @@ else
|
|
|
}
|
|
|
|
|
|
pendingTickets = tickets;
|
|
|
+ if (hasFreeTicketPromotion) {
|
|
|
+ selectPaymentChannel('@Constants.BASIC_WALLET_TICKET');
|
|
|
+ return;
|
|
|
+ }
|
|
|
$("#paymentChannelModal").removeClass("hidden").addClass("flex");
|
|
|
}
|
|
|
|
|
|
@@ -1139,7 +1148,7 @@ else
|
|
|
</div>
|
|
|
<div class="w-24 shrink-0 bg-white border border-gray-200 rounded-2xl p-2.5 flex items-center justify-center shadow-sm">
|
|
|
<div class="flex items-baseline gap-0.5">
|
|
|
- <span class="text-[20px] font-black text-black">${formatMoneyV2(t.money)}</span>
|
|
|
+ <span class="text-[20px] font-black text-black">${formatMoneyV2(hasFreeTicketPromotion ? 0 : t.money)}</span>
|
|
|
<span class="text-[12px] font-black text-[#0062FF]">HTG</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -1149,7 +1158,9 @@ else
|
|
|
});
|
|
|
|
|
|
$("#summaryTotalCount").text(displayTickets.length);
|
|
|
- const totalMoney = apiData.totalMoneyPayment || apiData.totalMoney || "0";
|
|
|
+ const totalMoney = hasFreeTicketPromotion
|
|
|
+ ? "0"
|
|
|
+ : (apiData.totalMoneyPayment || apiData.totalMoney || "0");
|
|
|
$("#summaryTotalAmount").text(formatMoneyV2(totalMoney));
|
|
|
|
|
|
summaryModal.removeClass("hidden").addClass("flex");
|
|
|
@@ -1160,6 +1171,12 @@ else
|
|
|
}
|
|
|
|
|
|
function confirmCheckout(btn) {
|
|
|
+ if (hasFreeTicketPromotion) {
|
|
|
+ hideOrderSummary();
|
|
|
+ finalizePurchase(btn, true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (currentChannelPayment === '@Constants.NATCASH_WALLET_TICKET') {
|
|
|
showOtpModal(true);
|
|
|
return;
|
|
|
@@ -1359,14 +1376,17 @@ else
|
|
|
$("#receiptSuccessModal").removeClass("hidden").addClass("flex");
|
|
|
}
|
|
|
|
|
|
- function finalizePurchase(btn) {
|
|
|
+ function finalizePurchase(btn, skipOtpValidation) {
|
|
|
+ const isFreeTicketPurchase = hasFreeTicketPromotion && skipOtpValidation === true;
|
|
|
const isWalletPayment = currentChannelPayment === '@Constants.NATCASH_WALLET_TICKET';
|
|
|
- let otpCode = isWalletPayment ? $("#walletPinInput").val().trim() : "";
|
|
|
- if (!isWalletPayment) {
|
|
|
+ let otpCode = isFreeTicketPurchase
|
|
|
+ ? ""
|
|
|
+ : (isWalletPayment ? $("#walletPinInput").val().trim() : "");
|
|
|
+ if (!isFreeTicketPurchase && !isWalletPayment) {
|
|
|
$("#otpInputs input").each(function() { otpCode += $(this).val(); });
|
|
|
}
|
|
|
|
|
|
- if ((isWalletPayment && otpCode.length === 0) || (!isWalletPayment && otpCode.length < 6)) {
|
|
|
+ if (!isFreeTicketPurchase && ((isWalletPayment && otpCode.length === 0) || (!isWalletPayment && otpCode.length < 6))) {
|
|
|
showNotification(isWalletPayment ? '@Html.Raw(Lang.payment_wallet_pin_instruction.Replace("'", "\\'"))' : "Please enter full 6-digit OTP", "warning");
|
|
|
return;
|
|
|
}
|
|
|
@@ -1377,12 +1397,12 @@ else
|
|
|
const finalData = {
|
|
|
transIdByTicket: currentTransId,
|
|
|
gameId: isFreeTicketMode ? "@Constants.Millions_CODE" : "@Model.termType",
|
|
|
- paymentCode: currentChannelPayment === '@Constants.NATCASH_WALLET_TICKET' ? null : otpCode,
|
|
|
- walletPin: currentChannelPayment === '@Constants.NATCASH_WALLET_TICKET' ? otpCode : null,
|
|
|
+ paymentCode: isFreeTicketPurchase || currentChannelPayment === '@Constants.NATCASH_WALLET_TICKET' ? null : otpCode,
|
|
|
+ walletPin: !isFreeTicketPurchase && currentChannelPayment === '@Constants.NATCASH_WALLET_TICKET' ? otpCode : null,
|
|
|
channelPayment: currentChannelPayment
|
|
|
};
|
|
|
|
|
|
- // Call the unified backend action that verifies OTP and then buys the ticket
|
|
|
+ // Free-ticket transactions skip OTP; paid transactions keep the existing verification flow.
|
|
|
$.ajax({
|
|
|
url: subDomain + '@Url.Action("ConfirmBuyingTicketV2", "Home")',
|
|
|
type: 'POST',
|