payment gateway intergration
This commit is contained in:
parent
1e82c698a7
commit
57e9cc7ec8
@ -22,14 +22,16 @@
|
||||
</div>
|
||||
|
||||
<div style=" text-align: center;">
|
||||
|
||||
<h3 >Your appointment has been successfully registered.</h3>
|
||||
|
||||
<p>
|
||||
An email with the appointment details has been sent to you. </p>
|
||||
<p style="color:rgb(13, 218, 13)">
|
||||
Thank You..! Your order status is {{resPayment.response_message}}.
|
||||
Your Transaction ID for this transaction is {{resPayment.transaction_id}}.
|
||||
We have received a payment of Rs {{resPayment.amount}} </p>
|
||||
|
||||
<p>
|
||||
<strong>
|
||||
Please check your spam folder if the email does not arrive within a few minutes. </strong>
|
||||
|
||||
</p>
|
||||
|
||||
<div >
|
||||
|
||||
@ -19,6 +19,7 @@ export class BookingSummaryComponent implements OnInit {
|
||||
busName: any;
|
||||
logo: any;
|
||||
currency:any =[];
|
||||
resPayment:any=[];
|
||||
private apiUrl = environment.apiEndpoint;
|
||||
customerBookingDetails: any = [];
|
||||
busCurrency: any = [];
|
||||
@ -35,7 +36,7 @@ export class BookingSummaryComponent implements OnInit {
|
||||
console.log(URL)
|
||||
let URL_AS_LIST = URL.split('/');
|
||||
console.log(URL_AS_LIST);
|
||||
this.router.navigate(['customer/business/'+URL_AS_LIST[3]])
|
||||
// this.router.navigate(['customer/business/'+URL_AS_LIST[3]])
|
||||
}
|
||||
|
||||
})
|
||||
@ -43,29 +44,113 @@ export class BookingSummaryComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
let slot_array = JSON.parse(localStorage.getItem("slotData"))
|
||||
|
||||
|
||||
let service = localStorage.getItem("servicedetails")
|
||||
let serviceDetails = JSON.parse(service)
|
||||
console.log(serviceDetails)
|
||||
|
||||
let URL = this.router.url;
|
||||
console.log(URL,slot_array)
|
||||
let URL_AS_LIST = URL.split('/');
|
||||
console.log(URL_AS_LIST);
|
||||
// if(serviceDetails.hasOwnProperty('userId')){
|
||||
serviceDetails.userId = localStorage.getItem('user_id')
|
||||
let paramPay = {"cusId":URL_AS_LIST[9]}
|
||||
this.end_user.paymentstatus(paramPay).subscribe(resPay => {
|
||||
|
||||
|
||||
if (resPay.status == 200) {
|
||||
console.log(resPay)
|
||||
this.resPayment = resPay.data[0]
|
||||
|
||||
|
||||
// }
|
||||
let paramsmap= {
|
||||
"serviceId": ""+serviceDetails.serviceId+"",
|
||||
"userId": serviceDetails.userId,
|
||||
"busId": serviceDetails.busId
|
||||
}
|
||||
console.log(paramsmap)
|
||||
this.end_user.CreatecusServicesMapDetails(paramsmap).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
console.log(res)
|
||||
let serviceMap = res['data'][0].id
|
||||
let time = new Date().toLocaleTimeString()
|
||||
let params= {
|
||||
"busId": serviceDetails.busId,
|
||||
"cusId": URL_AS_LIST[9],
|
||||
"appoinmentDate": slot_array[0].date,
|
||||
"appoinmentTime": time,
|
||||
"serviceMap": serviceMap,
|
||||
"appoinmentSlots": JSON.stringify(slot_array[0].slots)
|
||||
//"servicemap" :this.bookedAppointment_servicemap
|
||||
}
|
||||
console.log(params)
|
||||
this.end_user.CreateAppoinmentsCus(params).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
console.log(res)
|
||||
res = res.data;
|
||||
// this.end_user.summmarylist.next(res.data)
|
||||
console.log('booked2', res);
|
||||
this.customerBookingDetails = res[0].customer[0]
|
||||
console.log(this.customerBookingDetails)
|
||||
this.bookingSummary = res[0]
|
||||
if(this.bookingSummary.appoinmentSlots instanceof Array){
|
||||
this.bookingSummary.appoinmentSlots =this.bookingSummary.appoinmentSlots
|
||||
}else{
|
||||
this.bookingSummary.appoinmentSlots =JSON.parse(this.bookingSummary.appoinmentSlots)
|
||||
}
|
||||
// this.bookingSummary.appoinmentSlots =JSON.parse(this.bookingSummary.appoinmentSlots)
|
||||
|
||||
// this.end_user.getcusServicesMapDetails()
|
||||
let param ={id:this.bookingSummary.serviceMap}
|
||||
this.end_user.getcusServicesMapDetails(param).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
console.log(res)
|
||||
this.serviceMapDetails = res['data'][0]
|
||||
this.busCurrency = this.serviceMapDetails['business'][0].currency
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
// localStorage.setItem('summarylist',JSON.stringify(res.data))
|
||||
// this.router.navigate([URL+"/bts"])
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
this.currency = localStorage.getItem('currency')
|
||||
this.end_user.summmarylist_observable$.subscribe((res) => {
|
||||
console.log('booked2', res);
|
||||
this.customerBookingDetails = res[0].customer[0]
|
||||
console.log(this.customerBookingDetails)
|
||||
this.bookingSummary = res[0]
|
||||
if(this.bookingSummary.appoinmentSlots instanceof Array){
|
||||
this.bookingSummary.appoinmentSlots =this.bookingSummary.appoinmentSlots
|
||||
}else{
|
||||
this.bookingSummary.appoinmentSlots =JSON.parse(this.bookingSummary.appoinmentSlots)
|
||||
}
|
||||
// this.bookingSummary.appoinmentSlots =JSON.parse(this.bookingSummary.appoinmentSlots)
|
||||
// console.log('booked2', res);
|
||||
// this.customerBookingDetails = res[0].customer[0]
|
||||
// console.log(this.customerBookingDetails)
|
||||
// this.bookingSummary = res[0]
|
||||
// if(this.bookingSummary.appoinmentSlots instanceof Array){
|
||||
// this.bookingSummary.appoinmentSlots =this.bookingSummary.appoinmentSlots
|
||||
// }else{
|
||||
// this.bookingSummary.appoinmentSlots =JSON.parse(this.bookingSummary.appoinmentSlots)
|
||||
// }
|
||||
// // this.bookingSummary.appoinmentSlots =JSON.parse(this.bookingSummary.appoinmentSlots)
|
||||
|
||||
// this.end_user.getcusServicesMapDetails()
|
||||
let param ={id:this.bookingSummary.serviceMap}
|
||||
this.end_user.getcusServicesMapDetails(param).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
console.log(res)
|
||||
this.serviceMapDetails = res['data'][0]
|
||||
this.busCurrency = this.serviceMapDetails['business'][0].currency
|
||||
// // this.end_user.getcusServicesMapDetails()
|
||||
// let param ={id:this.bookingSummary.serviceMap}
|
||||
// this.end_user.getcusServicesMapDetails(param).subscribe(res => {
|
||||
// if (res.status == 200) {
|
||||
// console.log(res)
|
||||
// this.serviceMapDetails = res['data'][0]
|
||||
// this.busCurrency = this.serviceMapDetails['business'][0].currency
|
||||
|
||||
}
|
||||
})
|
||||
// }
|
||||
// })
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@ -16,13 +16,13 @@
|
||||
<div class="container mt-1">
|
||||
<mat-card class="card-mat">
|
||||
<h2 class="base-border">Customer Information</h2>
|
||||
<form [formGroup]="form" (ngSubmit)="submit()">
|
||||
<form [formGroup]="form" #testForm ngNoForm [action]="url" method="POST" (ngSubmit)="submit()" name='payaidpaymentsForm'>
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="64" fxFlex.lg="64" fxFlex.xl="64" class="p-gap" fxLayoutAlign="center center">
|
||||
|
||||
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center">
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center">
|
||||
<mat-form-field style="width: 80%">
|
||||
<input matInput placeholder="Name" type="text" name="cusName" formControlName="cusName" required>
|
||||
<mat-error *ngIf="myError('cusName', 'required')">Name is required</mat-error>
|
||||
@ -35,7 +35,7 @@
|
||||
<mat-error *ngIf="!form.get('email')?.errors?.required && (form.get('email')?.errors?.pattern)">
|
||||
Please enter a valid email address
|
||||
</mat-error>
|
||||
<!-- <mat-error *ngIf="myError('email', 'required')">email is required</mat-error> -->
|
||||
|
||||
<mat-error *ngIf="form.get('email')?.invalid && (form.get('email')?.dirty || form.get('email')?.touched) && form.get('email')?.errors?.required">
|
||||
Email is required
|
||||
</mat-error>
|
||||
@ -87,14 +87,167 @@
|
||||
<mat-error *ngIf="myError('pincode', 'required')">City is required</mat-error>
|
||||
<mat-error *ngIf="myError('pincode', 'maxlength')">Limit exceed</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none;">
|
||||
<input matInput placeholder="api_key" type="text" name="api_key" formControlName="api_key" value="4cb964d4-9ef4-4a25-8f85-a2a13f43cbba" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
|
||||
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none;">
|
||||
<input matInput placeholder="hash" type="text" name="hash" formControlName="hash" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none;">
|
||||
<input matInput placeholder="amount" type="text" name="amount" formControlName="amount" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center">
|
||||
<mat-form-field style="width: 80%">
|
||||
<input matInput placeholder="Name" type="text" name="name" formControlName="name" >
|
||||
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center">
|
||||
<mat-form-field style="width: 80%">
|
||||
<input matInput placeholder="Email" type="text" name="email" formControlName="email" >
|
||||
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center">
|
||||
<mat-form-field style="width: 80%">
|
||||
<input matInput placeholder="Phone No" type="text" name="phone" formControlName="phone" >
|
||||
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center">
|
||||
<mat-form-field style="width: 80%">
|
||||
<input matInput placeholder="Address" type="text" name="address_line_1" formControlName="address_line_1" >
|
||||
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none;">
|
||||
<input matInput placeholder="address_line_2" type="text" name="address_line_2" formControlName="address_line_2" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none;">
|
||||
<input matInput placeholder="order_id" type="text" name="order_id" formControlName="order_id" value="sfs2e2" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none;">
|
||||
<input matInput placeholder="description" type="text" name="description" formControlName="description" value="testing" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none;">
|
||||
<input matInput placeholder="mode" type="text" name="mode" formControlName="mode" value="TEST" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none;">
|
||||
<input matInput placeholder="return_url" type="text" name="return_url" formControlName="return_url" value="http://localhost:8080/api/paymentResponse" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none;">
|
||||
<input matInput placeholder="currency" type="text" name="currency" formControlName="currency" value="INR" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none;">
|
||||
<input matInput placeholder="country" type="text" name="country" formControlName="country" value="IND" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
|
||||
|
||||
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center">
|
||||
<mat-form-field style="width: 80%">
|
||||
<input matInput placeholder="State" type="text" name="state" formControlName="state" >
|
||||
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center">
|
||||
<mat-form-field style="width: 80%">
|
||||
<input matInput placeholder="City" type="text" name="city" formControlName="city" >
|
||||
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center">
|
||||
<mat-form-field style="width: 80%">
|
||||
<input matInput placeholder="Pincode" type="text" name="zip_code" formControlName="zip_code" >
|
||||
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none; ">
|
||||
<input matInput placeholder="udf1" type="text" name="udf1" formControlName="udf1" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none;">
|
||||
<input matInput placeholder="udf2" type="text" name="udf2" formControlName="udf2" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none;">
|
||||
<input matInput placeholder="udf3" type="text" name="udf3" formControlName="udf3" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none;">
|
||||
<input matInput placeholder="udf4" type="text" name="udf4" formControlName="udf4" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
<!-- <div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="50" fxFlex.lg="50" fxFlex.xl="50" class="p-gap" fxLayoutAlign="center center"> -->
|
||||
<mat-form-field style="width: 80%;display:none;">
|
||||
<input matInput placeholder="udf5" type="text" name="udf5" formControlName="udf5" >
|
||||
|
||||
</mat-form-field>
|
||||
<!-- </div> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div style="border: 1px solid #ccc;" fxFlex.md="1"></div>
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="35" fxFlex.lg="35" fxFlex.xl="35" class="p-gap">
|
||||
<div class="card-mat">
|
||||
<!-- <p class="param"><img src="assets/images/Location.svg" alt="Avatar" class="img">Business </p>
|
||||
<span class="span-text">{{busName}}</span> -->
|
||||
|
||||
<p class="param"><img src="assets/images/person.svg" alt="Avatar" class="img">Practitioner </p>
|
||||
<span class="span-text">{{bookedDetails.doctor}}</span>
|
||||
<p class="param"><img src="assets/images/information.svg" alt="Avatar" class="img"> Service </p>
|
||||
@ -105,15 +258,12 @@
|
||||
<span class="span-text">{{bookedDetails.time | date:'shortTime'}}</span>
|
||||
<p class="param"><img src="assets/images/Location.svg" alt="Avatar" class="img">Amount </p>
|
||||
<span class="span-text"><span class="ex" style="font-size: 12px;padding-bottom: 10px;line-height: 17px;">{{currency}}</span> {{bookedDetails.amount}}</span>
|
||||
<!-- <div>
|
||||
<hr>
|
||||
<button mat-raised-button mat-button-sm class="mr-1 mb-1 mt-1 btn-red" [ngStyle]="{'background':slot_array.length ==0 ? '#ccc':'#4caf50' }" [disabled]="slot_array.length ==0" (click)="submit()">PROCEED</button>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: end;" >
|
||||
<button class="mat-green" type="submit" mat-raised-button>Submit</button>
|
||||
<button class="mat-green" type="button" (click)="onclickfun()" mat-raised-button>Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</mat-card>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, HostListener, NgZone, OnInit } from '@angular/core';
|
||||
import { Component, HostListener, NgZone, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup, RequiredValidator, Validators } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { EndUserService } from '../end-user.service';
|
||||
@ -41,7 +41,12 @@ export class CustomerInfoComponent implements OnInit {
|
||||
noChangeNo: any = 0;
|
||||
private apiUrl = environment.apiEndpoint;
|
||||
logo: any;
|
||||
formData:any =[];
|
||||
url ="https://api.payaidpayments.com/v2/paymentrequest";
|
||||
paymentform:any=[];
|
||||
|
||||
bookedDetails: any = [];
|
||||
@ViewChild('testForm') testFormEl;
|
||||
constructor(private _location: Location,public dialog: MatDialog,private router: Router,private formBuilder: FormBuilder,public _cus:EndUserService, private ngZone: NgZone) {
|
||||
this._cus.bookedDetails_observable$.subscribe((res) => {
|
||||
console.log('booked2', res);
|
||||
@ -49,25 +54,76 @@ export class CustomerInfoComponent implements OnInit {
|
||||
console.log(this.bookedDetails)
|
||||
|
||||
})
|
||||
this.formData= new FormData();
|
||||
// firebase.initializeApp(config)
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
let URL = this.router.url;
|
||||
console.log(URL)
|
||||
let URL_AS_LIST = URL.split('/');
|
||||
console.log(URL_AS_LIST);
|
||||
this.busName = localStorage.getItem('busName')
|
||||
this.currency = localStorage.getItem('currency')
|
||||
this.logo = localStorage.getItem('logo')
|
||||
this.form = new FormGroup({
|
||||
cusName: new FormControl('', [Validators.required]),
|
||||
email: new FormControl('', [Validators.required, Validators.email,Validators.pattern(
|
||||
'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,63}$',
|
||||
),]),
|
||||
phoneNo: new FormControl('', [Validators.required, Validators.minLength(10),Validators.maxLength(10)]),
|
||||
address_1: new FormControl('', [Validators.required,Validators.maxLength(100)]),
|
||||
city: new FormControl('',[Validators.required]),
|
||||
state: new FormControl('',[Validators.required]),
|
||||
otp: new FormControl('', [ Validators.maxLength(6),Validators.minLength(6)]),
|
||||
pincode: new FormControl('',[Validators.required]),
|
||||
api_key:new FormControl('', [Validators.required]),
|
||||
hash:new FormControl('', []),
|
||||
amount: new FormControl('', []),
|
||||
name: new FormControl('', [Validators.required]),
|
||||
email: new FormControl('', [Validators.required]),
|
||||
phone: new FormControl('', [Validators.required, Validators.minLength(10),Validators.maxLength(10)]),
|
||||
address_line_1: new FormControl('', [Validators.required]),
|
||||
address_line_2:new FormControl('', []),
|
||||
order_id: new FormControl('', []),
|
||||
description: new FormControl('', []),
|
||||
mode: new FormControl('', []),
|
||||
return_url: new FormControl('', []),
|
||||
currency: new FormControl('', []),
|
||||
country: new FormControl('', []),
|
||||
zip_code: new FormControl('', []),
|
||||
state: new FormControl('', []),
|
||||
city: new FormControl('', []),
|
||||
udf1: new FormControl('', []),
|
||||
udf2: new FormControl('', []),
|
||||
udf3: new FormControl('', []),
|
||||
udf4: new FormControl('', []),
|
||||
udf5:new FormControl('', [])
|
||||
// cusName: new FormControl('', [Validators.required]),
|
||||
// email: new FormControl('', [Validators.required, Validators.email,Validators.pattern(
|
||||
// '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,63}$',
|
||||
// ),]),
|
||||
// phoneNo: new FormControl('', [Validators.required, Validators.minLength(10),Validators.maxLength(10)]),
|
||||
// address_1: new FormControl('', [Validators.required,Validators.maxLength(100)]),
|
||||
// city: new FormControl('',[Validators.required]),
|
||||
// state: new FormControl('',[Validators.required]),
|
||||
// otp: new FormControl('', [ Validators.maxLength(6),Validators.minLength(6)]),
|
||||
// pincode: new FormControl('',[Validators.required]),
|
||||
});
|
||||
let busId = localStorage.getItem('busId')
|
||||
function generateRandomString() {
|
||||
const prefix = "ORD-";
|
||||
const randomNum = (Math.random() + 1).toString(36).substring(7);
|
||||
return prefix + randomNum;
|
||||
}
|
||||
let payment = {
|
||||
api_key: '4cb964d4-9ef4-4a25-8f85-a2a13f43cbba',
|
||||
hash: '',
|
||||
amount: ""+this.bookedDetails.amount+"",
|
||||
order_id: generateRandomString(),
|
||||
description: 'testing',
|
||||
mode: 'TEST',
|
||||
return_url: 'http://localhost:8080/api/paymentResponse',
|
||||
currency: 'INR',
|
||||
country: 'IND',
|
||||
udf1: ''+busId+'',
|
||||
udf2: ''+window.location.origin+'/#'+URL+'/',
|
||||
udf3: '',
|
||||
udf4: '',
|
||||
udf5: ''
|
||||
}
|
||||
|
||||
this.form.patchValue(payment)
|
||||
}
|
||||
|
||||
public myError = (controlName: string, errorName: string) =>{
|
||||
@ -75,15 +131,58 @@ export class CustomerInfoComponent implements OnInit {
|
||||
}
|
||||
|
||||
submit(){
|
||||
let row_obj = this.form.value
|
||||
let payment = {
|
||||
|
||||
amount: this.bookedDetails.amount,
|
||||
name: row_obj.cusName,
|
||||
email: row_obj.email,
|
||||
phone: row_obj.phoneNo,
|
||||
address_line_1: row_obj.address_1,
|
||||
address_line_2: row_obj.address_1,
|
||||
// order_id: 'r959659swd',
|
||||
// description: 'testing',
|
||||
// mode: 'TEST',
|
||||
// return_url: 'http://localhost:8080/api/paymentResponse',
|
||||
currency: 'INR',
|
||||
country: 'IND',
|
||||
zip_code: row_obj.pincode,
|
||||
state: row_obj.state,
|
||||
city: row_obj.city,
|
||||
udf1: '',
|
||||
udf2: '',
|
||||
udf3: '',
|
||||
udf4: '',
|
||||
udf5: ''
|
||||
}
|
||||
|
||||
// this.formData.append('amount', this.bookedDetails.amount);
|
||||
// this.formData.append('name', row_obj.cusName);
|
||||
// this.formData.append('email', row_obj.email);
|
||||
// this.formData.append('phone', row_obj.phoneNo);
|
||||
// this.formData.append('address_line_1', row_obj.address_1);
|
||||
// this.formData.append('address_line_2', row_obj.address_1);
|
||||
// this.formData.append('currency', 'INR');
|
||||
// this.formData.append('country', 'IND');
|
||||
// this.formData.append('zip_code', row_obj.pincode);
|
||||
// this.formData.append('state', row_obj.state);
|
||||
// this.formData.append('city', row_obj.city);
|
||||
// this.formData.append('udf1', '');
|
||||
// this.formData.append('udf2', '');
|
||||
// this.formData.append('udf3', '');
|
||||
// this.formData.append('udf4', '');
|
||||
// this.formData.append('udf5', '');
|
||||
|
||||
console.log(this.form.value)
|
||||
console.log('add')
|
||||
if(!this.form.valid && this.verifyOTP == 0){
|
||||
return
|
||||
}else {
|
||||
if(this.verifyOTP == 1){
|
||||
let row_obj = this.form.value
|
||||
|
||||
console.log(row_obj)
|
||||
let busId = localStorage.getItem('busId')
|
||||
|
||||
let addFormData = {
|
||||
busId: busId,
|
||||
cusName: row_obj.cusName,
|
||||
@ -96,15 +195,64 @@ export class CustomerInfoComponent implements OnInit {
|
||||
};
|
||||
console.log(addFormData)
|
||||
|
||||
this._cus.addCusDetails(addFormData).subscribe(res => {
|
||||
if (res.status == 200) {
|
||||
this._cus.paymentRequest(payment).subscribe(res => {
|
||||
if (res) {
|
||||
console.log(res)
|
||||
res =res.data
|
||||
// api_key: '4cb964d4-9ef4-4a25-8f85-a2a13f43cbba',
|
||||
// hash: '',
|
||||
this.formData.append('api_key', res.api_key);
|
||||
this.formData.append('hash', res.hash);
|
||||
|
||||
this.formData.append('order_id', res.order_id);
|
||||
this.formData.append('description', res.description);
|
||||
this.formData.append('mode', res.mode);
|
||||
this.formData.append('return_url', res.return_url);
|
||||
|
||||
|
||||
// order_id: 'r959659swd',
|
||||
// description: 'testing',
|
||||
// mode: 'TEST',
|
||||
// return_url: 'http://localhost:8080/api/paymentResponse',
|
||||
|
||||
|
||||
|
||||
this.formData.append('amount', res.amount);
|
||||
this.formData.append('name',res.name);
|
||||
this.formData.append('email', res.email);
|
||||
this.formData.append('phone', res.phone);
|
||||
this.formData.append('address_line_1', res.address_line_1);
|
||||
this.formData.append('address_line_2', res.address_line_1);
|
||||
this.formData.append('currency', 'INR');
|
||||
this.formData.append('country', 'IND');
|
||||
this.formData.append('zip_code', res.zip_code);
|
||||
this.formData.append('state', res.state);
|
||||
this.formData.append('city', res.city);
|
||||
this.formData.append('udf1', '');
|
||||
this.formData.append('udf2', '');
|
||||
this.formData.append('udf3', '');
|
||||
this.formData.append('udf4', '');
|
||||
this.formData.append('udf5', '');
|
||||
|
||||
|
||||
// this._cus.paymentRequestApi(this.paymentform).subscribe(res => {
|
||||
// console.log(res)
|
||||
// if (res) {
|
||||
// console.log(res)
|
||||
|
||||
// // let URL = this.router.url;
|
||||
// // console.log(URL)
|
||||
// // this.router.navigate([URL+"/"+res['data'].id+"/pt"])
|
||||
// }
|
||||
// });
|
||||
|
||||
let URL = this.router.url;
|
||||
console.log(URL)
|
||||
this.router.navigate([URL+"/"+res['data'].id+"/pt"])
|
||||
// let URL = this.router.url;
|
||||
// console.log(URL)
|
||||
// this.router.navigate([URL+"/"+res['data'].id+"/pt"])
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
} else{
|
||||
this.getOTP(1)
|
||||
}
|
||||
@ -191,4 +339,93 @@ export class CustomerInfoComponent implements OnInit {
|
||||
return this.apiUrl+'imageViewer?img_name='+image;
|
||||
}
|
||||
|
||||
|
||||
onclickfun(){
|
||||
console.log("worked")
|
||||
let row_obj = this.form.value
|
||||
function generateRandomString() {
|
||||
const prefix = "ORD-";
|
||||
const randomNum = (Math.random() + 1).toString(36).substring(7);
|
||||
return prefix + randomNum;
|
||||
}
|
||||
let payment = {
|
||||
api_key: "4cb964d4-9ef4-4a25-8f85-a2a13f43cbba",
|
||||
hash: '',
|
||||
amount: this.bookedDetails.amount,
|
||||
name: row_obj.cusName,
|
||||
email: row_obj.email,
|
||||
phone: row_obj.phoneNo,
|
||||
address_line_1: row_obj.address_1,
|
||||
address_line_2: row_obj.address_1,
|
||||
order_id: generateRandomString(),
|
||||
description: 'testing',
|
||||
mode: 'TEST',
|
||||
return_url: 'http://localhost:8080/api/paymentResponse',
|
||||
currency: 'INR',
|
||||
country: 'IND',
|
||||
zip_code: row_obj.pincode,
|
||||
state: row_obj.state,
|
||||
city: row_obj.city,
|
||||
udf1: '',
|
||||
udf2: '',
|
||||
udf3: '',
|
||||
udf4: '',
|
||||
udf5: ''
|
||||
}
|
||||
let busId = localStorage.getItem('busId')
|
||||
|
||||
let addFormData = {
|
||||
busId: busId,
|
||||
cusName: this.form.value.name,
|
||||
email: this.form.value.email,
|
||||
address_1: this.form.value.address_line_1,
|
||||
phoneNo: this.form.value.phone,
|
||||
pincode: this.form.value.zip_code,
|
||||
state: this.form.value.state,
|
||||
city: this.form.value.city,
|
||||
};
|
||||
console.log(addFormData)
|
||||
|
||||
this._cus.paymentRequest(this.form.value ).subscribe(res => {
|
||||
|
||||
console.log(this.form.value , res)
|
||||
|
||||
|
||||
//this._cus.addCusDetails(addFormData).subscribe(res1 => {
|
||||
//if (res1.status == 200) {
|
||||
// console.log(res1)
|
||||
|
||||
// let URL = this.router.url;
|
||||
// console.log(URL)
|
||||
this.form.controls['hash'].setValue(res.data)
|
||||
this.testFormEl.nativeElement.submit()
|
||||
//let cusId = ''+res1['data'].id+'';
|
||||
// this.form.controls['udf2'].setValue(""+cusId+"")
|
||||
|
||||
|
||||
// this.form.controls['udf1'].setValue(cusId)
|
||||
// this.form.controls['udf1'].setValue( this.form.value.udf1)
|
||||
|
||||
// console.log(this.form.value,cusId ,this.form.value.udf1)
|
||||
// setTimeout(() => {
|
||||
|
||||
// }, 500);
|
||||
|
||||
// this.router.navigate([URL+"/"+res['data'].id+"/pt"])
|
||||
// }
|
||||
//});
|
||||
|
||||
|
||||
|
||||
console.log(this.form.value , res)
|
||||
payment.hash = res.data
|
||||
console.log(res)
|
||||
this.paymentform = payment;
|
||||
//
|
||||
}
|
||||
|
||||
)
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -49,6 +49,24 @@ private apiUrl = environment.apiEndpoint;
|
||||
// catchError(this.handleError('role', []))
|
||||
// )
|
||||
}
|
||||
|
||||
|
||||
paymentRequest(Params): Observable<any> {
|
||||
return this._http.post(this.apiUrl + 'paymentRequest', Params)
|
||||
|
||||
}
|
||||
|
||||
paymentstatus(Params): Observable<any> {
|
||||
return this._http.post(this.apiUrl + 'paymentStatus', Params)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
paymentRequestApi(Params): Observable<any> {
|
||||
return this._http.post('https://api.payaidpayments.com/v2/paymentrequest', Params)
|
||||
|
||||
}
|
||||
addCusDetails(addParams): Observable<any> {
|
||||
return this._http.post(this.apiUrl + 'CreateCustomers', addParams)
|
||||
// .pipe(
|
||||
|
||||
@ -34,7 +34,10 @@ export class PaymentComponent implements OnInit {
|
||||
this.router.navigate(['customer/'+URL_AS_LIST[2]+'/'+URL_AS_LIST[3]])
|
||||
}
|
||||
})
|
||||
|
||||
this.router.getCurrentNavigation().extras;
|
||||
console.log( this.router.getCurrentNavigation().extras)
|
||||
console.log( this.route.snapshot.paramMap)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -254,8 +254,9 @@ if(this.getHours.length != 0){
|
||||
this.slotIndex = i
|
||||
this.slotTime = param
|
||||
|
||||
console.log(this.date,param)
|
||||
console.log(this.date,param,this.servicesName.duration)
|
||||
let thirtyMinutes = this.servicesName.duration * 60 * 1000; // convert 30 minutes to milliseconds
|
||||
console.log(thirtyMinutes)
|
||||
let date1 = new Date(param);
|
||||
let date2 = new Date(date1.getTime() + thirtyMinutes);
|
||||
console.log(date1);
|
||||
|
||||
@ -7,12 +7,12 @@ export const environment = {
|
||||
production: false,
|
||||
environmentName: 'Testing Environment',//Localhost Environment.
|
||||
// apiEndpoint:'http://venbainfotech.com:5000/api/',
|
||||
// apiEndpoint:'http://192.168.1.19:8080/api/',
|
||||
apiEndpoint:'http://192.168.1.10:8080/api/',
|
||||
// apiEndpoint:'https://api.venbait.in/api/',
|
||||
// apiEndpoint:'http://venbainfotech.com:5000/api/',
|
||||
// apiEndpoint:'http://192.168.1.19:8080/api/',
|
||||
|
||||
apiEndpoint:'https://api.venbait.in/api/',
|
||||
// apiEndpoint:'https://api.venbait.in/api/',
|
||||
|
||||
//EndUser URL
|
||||
endUserUrl: window.location.origin+'/#/customer/',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user