ShowBillingForm: boolean = true;
PlanId: any;
PlanRes: any = [];
PlanDetail: any = [];
CustomField: boolean = false;
placemntCount: any;
totalPlaceCost: any;
costPerPlace: any;
DiscountAmount: any = 30;
DiscountedAmount: any;
NetAmount: any;
// ************************Paytm Payment Process *********************
RequestedData: any;
responseBilling: any;
EmployerId: any;
timestamp: any;
TransactionFormshow: boolean = false;
RequestDataPay: any;
SubmitBillingDetail() {
this.EmployerId = this.userdetail.id;
this.timestamp = +new Date;
this.timestamp.toString();
this.PlanDetailForm.controls['BillingState'].value
this.RequestedData = {
"name": this.PlanDetailForm.controls.BillingName.value,
"email": this.PlanDetailForm.controls.Billingemail.value,
"contactnum": this.PlanDetailForm.controls.Billingcontactnum.value,
"address": this.PlanDetailForm.controls.Billingaddress.value,
"state": this.PlanDetailForm.controls.BillingState.value,
"district": this.PlanDetailForm.controls.BillingDistrict.value,
"employerid": this.EmployerId,
"cmpid": this.userdetail.companyID,
"createdby": this.EmployerId,
// "order_id": Math.random().toString(36).substr(2, 9),
"order_id": Math.floor(10000000000 + Math.random() * 90000000000),
"transaction_id": '',
"status": 'Pending',
"validfrom":this.PlanDetail.valiD_FROM? moment(this.PlanDetail.valiD_FROM).format('YYYY-MM-DD'):parseInt('null'),
"validto":this.PlanDetail.valiD_TO? moment(this.PlanDetail.valiD_TO).format('YYYY-MM-DD'):parseInt('null'),
"Response_msg": 'Successfull',
"TXN_AMOUNT": this.PlanDetailForm.controls.Amount.value,
"Payment_For": 'REGISTRATION',
"CALLBACK_URL": environment.apiUrl + "Payment/PaymentConfirmation",
};
this.spinnerService.show();
this.authenticationService.SaveBillingDetailforRegistration(this.RequestedData).subscribe(res => {
this.responseBilling = res;
this.PurchaseStatus = this.responseBilling.purchasePlanStatus;
this.TransactionFormshow = true;
this.spinnerService.show();
localStorage.setItem('PurchaseStatus', this.PurchaseStatus);
this.RequestDataPay = {
"MID": this.responseBilling.mid,
"WEBSITE": this.responseBilling.website,
"INDUSTRY_TYPE_ID": this.responseBilling.industrY_TYPE_ID,
"CHANNEL_ID": this.responseBilling.channeL_ID,
"ORDER_ID": this.responseBilling.ordeR_ID,
"CUST_ID": this.responseBilling.cusT_ID,
"MOBILE_NO": this.responseBilling.mobilE_NO,
"EMAIL": this.responseBilling.email,
"TXN_AMOUNT": this.responseBilling.txN_AMOUNT,
"CHECKSUMHASH": this.responseBilling.checksum,
"CALLBACK_URL": this.responseBilling.callbacK_URL
};
this.createPaytmForm();
});
}
createPaytmForm() {
const my_form: any = document.createElement('form');
my_form.name = 'paytm_form';
my_form.method = 'post';
// my_form.action = 'https://securegw-stage.paytm.in/order/process';
my_form.action = this.responseBilling.paytmgatway;
const myParams = Object.keys(this.RequestDataPay);
for (let i = 0; i < myParams.length; i++) {
const key = myParams[i];
let my_tb: any = document.createElement('input');
my_tb.type = 'hidden';
my_tb.name = key;
my_tb.value = this.RequestDataPay[key];
my_form.appendChild(my_tb);
};
document.body.appendChild(my_form);
my_form.submit();
}