123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594 |
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let Transact;
- (function (Transact) {
- let Controls;
- (function (Controls) {
- let Subscriptions;
- (function (Subscriptions) {
- class SubcribeUserRegistrations extends Unibase.Platform.Core.BaseComponent {
- cssFiles() {
- return ['apps/transact/controls/subscriptions/style.subscription.css'];
- }
- jsFiles() {
- return ["platform/bundle/index.subscriptions.components.min.js"];
- }
- html(id, containerid) {
- var html = `<div class="row p-md-5"> <div class="col-sm-8"> <div class="registration_form d-none"> <form class="biz-contact-form" id="biz-contact-form"><div class="d-flex align-items-center"><a class="btn btn-flush-biz-theme btn-icon back_report btn-rounded flush-soft-hover d-26 mr-2 registration_back_btn" onclick="Bizgaze.Apps.Transact.Controls.Subscriptions.OrderDetails.Instance().backProceedHtml();"><span class="btn-icon-wrap"><i data-icon="l"></i></span></a> <h2 class="font-weight-700 form-heading"> Registration </h2></div> <div class="row"> <div class="col-6"> <div><input type="text" class="mb-0 " placeholder="Company Name" name="companyName*" id="companyName" required autocomplete="off"></div><div><input type="text" class="mb-0 " placeholder="Contact Name*" name="contactName" id="contactName" required autocomplete="off"> </div><div><input type="email" class="mb-0 " placeholder="Email*" name="email" id="contactEmail" required autocomplete="off"></div><div class="text-danger emailValidText d-none"> Please enter a valid email </div><div><input type="text" class="mb-0 " placeholder="Address Line*" name="AddressName" id="AddressName" required autocomplete="off"> </div></div><div class="col-6"> <div class="mt-4 biz-select2-wrap"><input type="hidden" id="hf_CitiId"><select type="text" class="form-control floating-label-control" id="txt_city" data-label="Select" value=""><option></option></select><input type="hidden" id="hf_txtcity"></div><div><input type="text" class="mb-0 " placeholder="GSTIN" name="GSTIN" id="GSTIN" required autocomplete="off" maxlength="15"> </div><div class="text-danger gstValidText d-none"> Please enter a valid GSTIN </div><div> <div class="position-relative"><input type="number" maxlength="10" oninput="javascript: if (this.value.length > this.maxLength) this.value=this.value.slice(0, this.maxLength);" ; class="mb-0 " placeholder="Phone*" name="phone" id="contactPhone" required autocomplete="off"> <div class="position-absolute d-none" style="right:10px;top:40px"> <button type="submit" id="verify_btn" class="py-1 btn btn-primary btn-block">verify</button> </div></div></div></div></div></form> </div><div id="addon-list"></div></div><div class="col-sm-4"> <div class="ml-auto w-50"><img src="../../../../imgs/biz-logo.svg" class="img-fluid" alt="Bizgaze-Logo"></div><div id="errordiv"><span id="error_message" style="word-wrap: break-word; " class="text-danger"></span> </div><div id="cart_items_list"></div></div></div>`;
- return html;
- }
- load(id, containerid, callback) {
- var instance = this;
- Unibase.Platform.Helpers.FileCacheHelper.Instance().addCacheFiles(["apps/transact/controls/subscriptions/addons.component.js", "apps/transact/controls/subscriptions/registeremail.component.js"]);
- SubcribeUserRegistrations.Instance().autoComplete();
- Bizgaze.Apps.Transact.Controls.Subscriptions.OrderDetails.Instance().getPlanItem_List(instance.PlanItemId, instance.Tenureid);
- $(`#${containerid}`).addClass("registration-modal bg-white bg-registration").removeClass('bg-light');
- instance.isVerified = false;
- $('.biz-contact-form').find('input[type = "email"]').on("input", function () {
- var enteredEmail = $(this).val();
- if (enteredEmail == "") {
- if ($('.emailValidText').hasClass('d-none') == false) {
- $('.emailValidText').addClass('d-none');
- }
- }
- });
- $('.biz-contact-form').find('input').on("input", function () {
- if ($(this).attr('id') == 'contactEmail') {
- var enteredEmail = $(this).val();
- if (enteredEmail) {
- $('.emailValidText').addClass('d-none');
- $(this).attr("style", "");
- }
- }
- else {
- $(this).attr("style", "");
- }
- });
- $('.biz-contact-form').find('#txt_city').on("input", function () {
- $(this).parent().find('.select2-selection').removeClass('border-red');
- });
- function alphaOnly(event) {
- var key = event.keyCode;
- if (((key >= 65 && key <= 90) || key == 8) == false) {
- MessageHelper.Instance().showError("Please Enter valid GST Number", "div_errroMessage");
- }
- else if ((key >= 65 && key <= 90) || key == 8) {
- if ($('#Bizgaze-messageInfo')) {
- $('#Bizgaze-messageInfo').click();
- }
- }
- return ((key >= 65 && key <= 90) || key == 8);
- }
- ;
- function numericOnly(event) {
- var key = event.keyCode;
- if (((key >= 47 && key <= 58) || key == 8 || (key > 95 && key < 106)) == false) {
- MessageHelper.Instance().showError("Please Enter valid GST Number", "div_errroMessage");
- }
- else if ((key >= 47 && key <= 58) || key == 8 || (key > 95 && key < 106)) {
- if ($('#Bizgaze-messageInfo')) {
- $('#Bizgaze-messageInfo').click();
- }
- }
- return ((key > 47 && key < 58) || key == 8 || (key > 95 && key < 106));
- }
- ;
- function alphaNumeric(event) {
- var key = event.keyCode;
- return ((key > 47 && key < 58) || key == 8 || (key >= 65 && key <= 90));
- }
- ;
- $('#GSTIN').on('keydown', function () {
- $(this).addClass('text-uppercase');
- var gst_val = $('#GSTIN').val().toString();
- if (gst_val.length < 2) {
- return numericOnly(event);
- }
- else if ((gst_val.length >= 2) && (gst_val.length < 7)) {
- return alphaOnly(event);
- }
- else if ((gst_val.length >= 7) && (gst_val.length < 11)) {
- return numericOnly(event);
- }
- else if ((gst_val.length >= 11) && (gst_val.length < 12)) {
- return alphaOnly(event);
- }
- else if ((gst_val.length >= 12) && (gst_val.length < 13)) {
- return numericOnly(event);
- }
- else if ((gst_val.length >= 13) && (gst_val.length < 14)) {
- return alphaOnly(event);
- }
- else if ((gst_val.length >= 14) && (gst_val.length < 15)) {
- return alphaNumeric(event);
- }
- });
- }
- init() {
- }
- saveDetails() {
- var companyName = $("#companyName").val();
- var contactName = $("#contactName").val();
- var contactEmail = $("#contactEmail").val();
- var contactPhone = $("#contactPhone").val();
- var AddressName = $("#AddressName").val();
- var cityName = $("#txt_city").val();
- var GSTIN = $("#GSTIN").val();
- function validEmail(email) {
- var regex = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
- return regex.test(email);
- }
- function validGst(gstin) {
- var regex = /^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$/;
- /^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$/;
- return regex.test(gstin);
- }
- $('.biz-contact-form').find('input').on("input", function () {
- if ($(this).attr('id') == 'GSTIN') {
- var enteredGstin = $(this).val();
- if (validGst(enteredGstin)) {
- $('.gstValidText').addClass('d-none');
- }
- }
- });
- $('#biz-contact-form input').each(function () {
- var val = $(this).val();
- if (val == "") {
- var id = $(this).attr('id');
- if (id != 'companyName' && id != 'GSTIN') {
- $(this).css("border-color", "red");
- }
- }
- else {
- $(this).attr("style", "");
- }
- });
- if ($('#txt_city').val() == '') {
- $('#txt_city').parent().find('.select2-selection').addClass('border-red');
- }
- else {
- $('#txt_city').parent().find('.select2-selection').removeClass('border-red');
- }
- if (contactName == "" || contactPhone == "" || contactEmail == "" || AddressName == "" || cityName == "") {
- MessageHelper.Instance().showError("Mandatory fields are missing", "error_message");
- $('.emailValidText').addClass('d-none');
- }
- else {
- if (validEmail(contactEmail) == false) {
- $('.emailValidText').removeClass('d-none');
- $('#contactEmail').css("border-color", "red");
- return;
- }
- if (GSTIN != '') {
- if (validGst(GSTIN.toString().toUpperCase()) == false) {
- MessageHelper.Instance().showError("Please enter valid GSTIN", "error_message");
- return;
- }
- }
- if (this.isVerified == false) {
- $('#Bizgaze-messageInfo').click();
- if ($('.emailValidText').hasClass('d-none') == false) {
- $('.emailValidText').addClass('d-none');
- }
- var obj = {};
- obj = {
- UserName: contactName.toString().trim(),
- Email: contactEmail,
- ContactNumber: contactPhone,
- Organigationname: companyName.toString().trim(),
- };
- this.fileCacheHelper.loadJsFile('apps/transact/managers/subscriptions/subscriptionmanager.js', function () {
- Bizgaze.Apps.Transact.Managers.Subscriptions.SubscriptionManager.Instance().SubscriptionsUserValidationInfo(obj).then(function (response) {
- var res = response.result;
- if (response.result == null) {
- MessageHelper.Instance().showError(response.message, "error_message");
- }
- else {
- Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().sendOtp();
- }
- });
- });
- }
- }
- }
- autoComplete() {
- Bizgaze.Apps.Transact.Managers.Subscriptions.SubscriptionManager.Instance().getCityName().then(function (res) {
- return __awaiter(this, void 0, void 0, function* () {
- let response = res.result, data = [];
- response.forEach(function (item, index) {
- data.push({ id: item.cityid, text: item.cityname });
- });
- $('#txt_city').select2({
- placeholder: "Select City*",
- allowClear: true,
- data: data
- });
- });
- });
- }
- subcribeUserRegistration(planid, tenureid) {
- Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
- SubcribeUserRegistrations.instance.PlanItemId = Number(planid);
- SubcribeUserRegistrations.instance.Tenureid = Number(tenureid);
- var instance = this;
- instance.navigationHelper.popup(0, "", Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance(), null, Unibase.Platform.Helpers.Size.ExtraLarge);
- }
- proceedToPay() {
- this.saveDetails();
- }
- sendOtp() {
- var instance = this;
- var ContactText = $("#contactPhone").val().toString();
- let Ismail = ContactText.includes("@");
- if (ContactText != "") {
- if (Ismail == false) {
- if (ContactText.length == 10) {
- var token = "123456";
- SubcribeUserRegistrations.instance.isMail = Ismail;
- instance.fileCacheHelper.loadJsFile("apps/crm/contacts/managers/contactmanager.js", function () {
- Bizgaze.Apps.Transact.Managers.Subscriptions.SubscriptionManager.Instance().getUserInfoByContactNo(ContactText).then(function (response) {
- var data = response.result;
- Bizgaze.Apps.Transact.Managers.Subscriptions.SubscriptionManager.Instance().getContactnumuberdetails(ContactText).then(function (res) {
- var info = res.result;
- if (data != null && data != "" || info != null && info != "") {
- MessageHelper.Instance().showError("Contact Number Alredy Exist", "error_message");
- }
- else {
- Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().otpVerificationModal();
- Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().sendEmail(ContactText, Ismail);
- }
- });
- });
- });
- }
- else {
- $('#contactPhone').css("border-color", "red");
- MessageHelper.Instance().showError("Please Enter Valid Mobile Number!", "error_message");
- }
- }
- if (Ismail == true) {
- SubcribeUserRegistrations.instance.isMail = Ismail;
- var token = "123456";
- Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().otpVerificationModal();
- Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().sendEmail(ContactText, Ismail);
- }
- }
- else {
- MessageHelper.Instance().showError("Please Enter Valid Input Details!", "error_message");
- }
- }
- otpVerificationModal() {
- const html = `<div class="modal fade otp-verification-modal" id="otpVerificationModal">
- <div class="modal-dialog modal-dialog-centered" role="document">
- <div class="modal-content">
- <div class="modal-body">
- <div class="otp-err-msg" id="otpErrMsg"></div>
- <img src="./imgs/otp-verify-img.png" class="otp-verify-img h-100p w-100p">
- <div class="otp-heading-wrap">
- <h5 class="otp-heading font-weight-bold mb-10">OTP Verification</h5>
- <p class="otp-desc">Enter 6 Digit Verification Code sent</p>
- </div>
- <div class="otp-input-group">
- <input class="otp-input" type="text" onkeyup="Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().otpInputTabChange(1);" maxlength=1>
- <input class="otp-input" type="text" onkeyup="Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().otpInputTabChange(2);" maxlength=1>
- <input class="otp-input" type="text" onkeyup="Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().otpInputTabChange(3);" maxlength=1>
- <input class="otp-input" type="text" onkeyup="Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().otpInputTabChange(4);" maxlength=1>
- <input class="otp-input" type="text" onkeyup="Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().otpInputTabChange(5);" maxlength=1>
- <input class="otp-input" type="text" onkeyup="Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().otpInputTabChange(6);" maxlength=1>
- </div>
- <div class="otp-modal-footer mt-30">
- <p class="otp-timer text-danger d-none">Time: <span class="otp-expire-time">00:46</span></p>
- <a href="javascript:;" onclick="Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().sendOtp();" class="otp-resend-link">Resend Code</a>
- <a href="javascript:;" class="btn subs-btn-outline-primary otp-submit-btn" id="otpSubmitBtn" onclick="Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().otpSubmitHandler();">Submit</a>
- </div>
- <a href="javascript:;" class="modal-close-btn btn btn-icon btn-flush-danger btn-rounded flush-soft-hover w-30p h-30p" id="otpModalCloseBtn"><span class="btn-icon-wrap"><i class="las la-times"></i></span></a>
- </div>
- </div>
- </div>
- </div>`;
- const containerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1];
- $('.otp-verification-modal').remove();
- $(`#${containerId}`).append(html);
- const otpModalEl = $('#otpVerificationModal');
- otpModalEl.addClass('show d-block');
- $('.otp-input').first().focus();
- $('#otpModalCloseBtn').click(function () {
- otpModalEl.removeClass('show d-block');
- });
- $('.otp-input-group .otp-input').on('input', function (e) {
- const inputEl = this;
- inputEl.value = inputEl.value.replace(/[^0-9]/g, '');
- });
- }
- sendEmail(email, Ismail) {
- this.fileCacheHelper.loadJsFile('apps/transact/managers/subscriptions/subscriptionmanager.js', function () {
- Bizgaze.Apps.Transact.Managers.Subscriptions.SubscriptionManager.Instance().sendRegistrationMail(email, Ismail).then(function (response) {
- var resinfo = response.result;
- var res = response.message;
- if (resinfo == null || resinfo == "") {
- MessageHelper.Instance().showError('OTP sending failed', 'otpErrMsg');
- }
- else {
- SubcribeUserRegistrations.instance.registertoken = response.result;
- MessageHelper.Instance().showSuccess('OTP Send Succefully', 'otpErrMsg');
- }
- });
- });
- }
- otpInputTabChange(val) {
- const ele = $('.otp-input');
- if (ele[val - 1].value != '') {
- if (ele[val])
- ele[val].focus();
- }
- else if (ele[val - 1].value == '') {
- if (ele[val - 2])
- ele[val - 2].focus();
- }
- }
- otpSubmitHandler() {
- var instance = this;
- let enteredOtp = '';
- $('.otp-input').each(function () {
- enteredOtp += $(this).val();
- });
- if (enteredOtp != '' || enteredOtp != "") {
- let otpId = SubcribeUserRegistrations.instance.registertoken;
- this.fileCacheHelper.loadJsFile('apps/transact/managers/subscriptions/subscriptionmanager.js', function () {
- Bizgaze.Apps.Transact.Managers.Subscriptions.SubscriptionManager.Instance().VerifyOtp(otpId, enteredOtp).then(function (response) {
- var res = response.result;
- if (res != null && res == true) {
- $('#otpVerificationModal').removeClass('show d-block');
- instance.isVerified = true;
- $('.registration-proceed-btn').removeClass('d-none');
- MessageHelper.Instance().showSuccess('Mobile Number verified Successfully', '');
- Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().SaveSubcriptionUserInfo();
- }
- else {
- MessageHelper.Instance().showError('Invalid OTP!', 'otpErrMsg');
- }
- });
- });
- }
- else {
- MessageHelper.Instance().showError('Please Enter OTP!', 'otpErrMsg');
- }
- }
- SaveSubcriptionUserInfo() {
- var companyName = $("#companyName").val();
- var contactName = $("#contactName").val();
- var contactEmail = $("#contactEmail").val();
- var contactPhone = $("#contactPhone").val();
- var AddressName = $("#AddressName").val();
- var cityName = $("#txt_city").val();
- var GSTIN = $("#GSTIN").val();
- var tenurePeriod = $('#select_period').val();
- if (contactName == "") {
- MessageHelper.Instance().showError("Mandatory fields are missing", "error_message");
- }
- else {
- var instance = this;
- instance.navigationHelper.showLoading();
- var jsFiles = ["apps/transact/enums/enum.js", "apps/transact/managers/orders/ordermanager.js", "apps/transact/managers/subscriptions/subscriptionmanager.js"];
- instance.fileCacheHelper.loadJsFiles(jsFiles, function () {
- Subscriptions.OrderDetails.instance.OrderData = [];
- Subscriptions.OrderDetails.instance.ItemData = [];
- for (var i = 0; i < Subscriptions.OrderDetails.instance.CartItems.length; ++i) {
- var addonQuantity = Subscriptions.OrderDetails.instance.CartItems[i].addonQuantity;
- var addonSku = Subscriptions.OrderDetails.instance.CartItems[i].addonSku;
- var addonItemId = Subscriptions.OrderDetails.instance.CartItems[i].addonItemId;
- var unitPrice = Subscriptions.OrderDetails.instance.CartItems[i].unitPrice;
- var discountPercent = Subscriptions.OrderDetails.instance.CartItems[i].discountPercent;
- var discountValue = Subscriptions.OrderDetails.instance.CartItems[i].discountValue;
- var refItemId = Number($(this).find("#hf_refItemId").val());
- Subscriptions.OrderDetails.instance.ItemData.push({
- SKU: addonSku,
- Quantity: addonQuantity,
- ItemId: addonItemId,
- UnitPrice: unitPrice,
- DiscountPercent: isNaN(discountPercent) ? 0 : discountPercent,
- DiscountValue: isNaN(discountValue) ? 0 : discountValue,
- RefItemId: isNaN(refItemId) ? 0 : refItemId
- });
- }
- instance.ItemObj = JSON.stringify(Subscriptions.OrderDetails.instance.ItemData);
- var PlanId = SubcribeUserRegistrations.instance.PlanItemId;
- var TenureId = SubcribeUserRegistrations.instance.Tenureid;
- SubcribeUserRegistrations.instance.contactNumber = contactPhone;
- SubcribeUserRegistrations.instance.contactEmail = contactEmail;
- var obj = {};
- obj = {
- UserName: contactName.toString().trim(),
- Email: contactEmail,
- ContactNumber: contactPhone,
- Organigationname: companyName.toString().trim(),
- PlanId: PlanId,
- TenureId: TenureId,
- GSTNO: GSTIN,
- City: cityName,
- AddressLine1: AddressName.toString().trim(),
- TenurePeriod: Number(tenurePeriod),
- OrderObject: instance.ItemObj
- };
- Bizgaze.Apps.Transact.Managers.Subscriptions.SubscriptionManager.Instance().SaveSubscriptionsUserInfo(obj).then(function (response) {
- var res = response.result;
- if (response.result == null) {
- instance.navigationHelper.hideLoading();
- MessageHelper.Instance().showError(response.message, "error_message");
- }
- else {
- var customerUserId = res.SubscriptionsUserId;
- var PaymentStatus = true;
- var TotalAmt = Subscriptions.OrderDetails.instance.NetTotal;
- Bizgaze.Apps.Transact.Controls.Subscriptions.SubcribeUserRegistrations.Instance().paymentgateway(TotalAmt, customerUserId, PaymentStatus);
- }
- });
- });
- }
- }
- paymentgateway(invoiceamount, customerUserId, PaymentStatus) {
- var customerdetails = {};
- var subcribeuserobj = {};
- SubcribeUserRegistrations.instance.data = [];
- var customerUserId = customerUserId;
- if (isNaN(customerUserId)) {
- customerUserId = customerUserId;
- }
- var custContactNumber = SubcribeUserRegistrations.instance.contactNumber;
- var custEmailAdress = SubcribeUserRegistrations.instance.contactEmail;
- var instance = this;
- instance.fileCacheHelper.loadJsFiles(['apps/transact/managers/subscriptions/subscriptionmanager.js', 'settings/settings.js', 'platform/core/infos/status.js'], function () {
- var retunrUrl = window.location.origin + '/#/paymentorder/order_id={order_id}/order_token={order_token}';
- var dt = new Date();
- dt.setDate(dt.getDate() + 5);
- customerdetails = {
- CustomerId: String(customerUserId),
- CustomerEmail: custEmailAdress,
- CustomerPhone: custContactNumber,
- };
- SubcribeUserRegistrations.instance.data.push({
- OrderAmount: invoiceamount,
- OrderCurrency: "INR",
- customer_details: customerdetails,
- order_meta: {
- "ReturnUrl": retunrUrl
- },
- OrderExpiryTime: dt
- });
- Bizgaze.Apps.Transact.Managers.Subscriptions.SubscriptionManager.Instance().createGateWayOrder(instance.data[0]).then(function (response) {
- var res = response.result;
- if (response.status === Unibase.Data.Status.Error) {
- instance.navigationHelper.hideLoading();
- MessageHelper.Instance().showError(response.message, "error_message");
- }
- if (response.result != null) {
- var res = response.result;
- var url = res.payment_link;
- subcribeuserobj = {
- SubscriptionsUserId: customerUserId,
- OrderId: res.order_id,
- OrderToken: res.order_token,
- TotalAmount: invoiceamount
- };
- var paymentDetails = {};
- paymentDetails = {
- OrderId: res.order_id,
- OrderToken: res.order_token,
- TenureId: Number(SubcribeUserRegistrations.instance.Tenureid),
- TotalAmount: invoiceamount,
- };
- var obj = {};
- if (PaymentStatus == true) {
- obj = {
- SubscriptionsUserId: customerUserId,
- PaymentDetails: paymentDetails
- };
- }
- instance.fileCacheHelper.loadJsFile('apps/transact/managers/subscriptions/subscriptionmanager.js', function () {
- if (PaymentStatus == true) {
- Bizgaze.Apps.Transact.Managers.Subscriptions.SubscriptionManager.Instance().SaveSubscriptionsUserInfo(subcribeuserobj).then(function (response) {
- var savinfo = response.result;
- instance.navigationHelper.hideLoading();
- window.open(url, "_self");
- });
- }
- });
- }
- });
- });
- }
- retryPayement(invoiceamount, customerUserId, PaymentStatus, Cust_Email, custContactNumber) {
- var customerdetails = {};
- var subcribeuserobj = {};
- SubcribeUserRegistrations.instance.data = [];
- var customerUserId = customerUserId;
- if (isNaN(customerUserId)) {
- customerUserId = customerUserId;
- }
- var custContactNumber = custContactNumber;
- var custEmailAdress = Cust_Email;
- var instance = this;
- instance.fileCacheHelper.loadJsFiles(['apps/transact/managers/subscriptions/subscriptionmanager.js', 'settings/settings.js', 'platform/core/infos/status.js'], function () {
- var retunrUrl = window.location.origin + '/#/paymentorder/order_id ={order_id}/order_token={order_token}';
- var dt = new Date();
- dt.setDate(dt.getDate() + 5);
- customerdetails = {
- CustomerId: String(customerUserId),
- CustomerEmail: custEmailAdress,
- CustomerPhone: custContactNumber,
- };
- SubcribeUserRegistrations.instance.data.push({
- OrderAmount: invoiceamount,
- OrderCurrency: "INR",
- customer_details: customerdetails,
- order_meta: {
- "ReturnUrl": retunrUrl
- },
- OrderExpiryTime: dt
- });
- Bizgaze.Apps.Transact.Managers.Subscriptions.SubscriptionManager.Instance().createGateWayOrder(instance.data[0]).then(function (response) {
- var res = response.result;
- if (res.status === Unibase.Data.Status.Error) {
- instance.navigationHelper.hideLoading();
- MessageHelper.Instance().showError(res.message, "error_message");
- }
- if (response.result != null) {
- var res = response.result;
- var url = res.payment_link;
- subcribeuserobj = {
- SubscriptionsUserId: customerUserId,
- OrderId: res.order_id,
- OrderToken: res.order_token,
- TotalAmount: invoiceamount
- };
- var paymentDetails = {};
- paymentDetails = {
- OrderId: res.order_id,
- OrderToken: res.order_token,
- TenureId: Number(SubcribeUserRegistrations.instance.Tenureid),
- TotalAmount: invoiceamount,
- };
- var obj = {};
- if (PaymentStatus == true) {
- obj = {
- SubscriptionsUserId: customerUserId,
- PaymentDetails: paymentDetails
- };
- }
- instance.fileCacheHelper.loadJsFile('apps/transact/managers/subscriptions/subscriptionmanager.js', function () {
- if (PaymentStatus == true) {
- Bizgaze.Apps.Transact.Managers.Subscriptions.SubscriptionManager.Instance().SaveSubscriptionsUserInfo(subcribeuserobj).then(function (response) {
- var savinfo = response.result;
- instance.navigationHelper.hideLoading();
- window.open(url, "_self");
- });
- }
- });
- }
- });
- });
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new SubcribeUserRegistrations();
- }
- return this.instance;
- }
- }
- Subscriptions.SubcribeUserRegistrations = SubcribeUserRegistrations;
- })(Subscriptions = Controls.Subscriptions || (Controls.Subscriptions = {}));
- })(Controls = Transact.Controls || (Transact.Controls = {}));
- })(Transact = Apps.Transact || (Apps.Transact = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
|