diff --git a/ng-seed/src/app/end-user/booking-summary/booking-summary.component.ts b/ng-seed/src/app/end-user/booking-summary/booking-summary.component.ts index 6e9e3aa..31b9a67 100644 --- a/ng-seed/src/app/end-user/booking-summary/booking-summary.component.ts +++ b/ng-seed/src/app/end-user/booking-summary/booking-summary.component.ts @@ -28,6 +28,20 @@ export class BookingSummaryComponent implements OnInit { constructor(public end_user:EndUserService,private router:Router,) { this.logo = localStorage.getItem('logo') this.busName = localStorage.getItem('busName') + + this.end_user.bookedDetails_observable$.subscribe((res) => { + console.log('booked2', res); + + if(res instanceof Array){ + + if(res.length == 0){ + this.backRedireact() + } + + } + + + }) this.end_user.summmarylist_observable$.subscribe((res) => { console.log('booked', res); if(res.length>0){ diff --git a/ng-seed/src/app/end-user/customer-info/customer-info.component.html b/ng-seed/src/app/end-user/customer-info/customer-info.component.html index 899c961..d2926db 100644 --- a/ng-seed/src/app/end-user/customer-info/customer-info.component.html +++ b/ng-seed/src/app/end-user/customer-info/customer-info.component.html @@ -239,7 +239,7 @@ - + diff --git a/ng-seed/src/app/end-user/customer-info/customer-info.component.ts b/ng-seed/src/app/end-user/customer-info/customer-info.component.ts index 35f6f79..ee042bb 100644 --- a/ng-seed/src/app/end-user/customer-info/customer-info.component.ts +++ b/ng-seed/src/app/end-user/customer-info/customer-info.component.ts @@ -40,6 +40,7 @@ export class CustomerInfoComponent implements OnInit { currency:any=[]; noChangeNo: any = 0; private apiUrl = environment.apiEndpoint; + private apiUrlkey = environment; logo: any; formData:any =[]; url ="https://api.payaidpayments.com/v2/paymentrequest"; @@ -50,6 +51,14 @@ export class CustomerInfoComponent implements OnInit { 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); + + if(res instanceof Array){ + + if(res.length == 0){ + this.backRedireact() + } + + } this.bookedDetails = res console.log(this.bookedDetails) @@ -59,6 +68,16 @@ export class CustomerInfoComponent implements OnInit { } ngOnInit() { + + if (performance.navigation.type === 1) { + console.log(0) + // This condition checks if the page is refreshed + // Type 1 represents a page reload event + + // Redirect to another page using the Router navigate method + // this.router.navigate(['/booking/practitioner/lytv3lm']); + } + let URL = this.router.url; console.log(URL) let URL_AS_LIST = URL.split('/'); @@ -109,13 +128,13 @@ export class CustomerInfoComponent implements OnInit { return prefix + randomNum; } let payment = { - api_key: '4cb964d4-9ef4-4a25-8f85-a2a13f43cbba', + api_key: ''+this.apiUrlkey.payment_api_key+'', hash: '', amount: ""+this.bookedDetails.amount+"", order_id: generateRandomString(), description: 'testing', - mode: 'TEST', - return_url: 'http://localhost:8080/api/paymentResponse', + mode: ''+this.apiUrlkey.payment_mode+'', + return_url: this.apiUrl+'paymentResponse', currency: 'INR', country: 'IND', udf1: ''+busId+'', @@ -325,10 +344,10 @@ export class CustomerInfoComponent implements OnInit { console.log(URL_AS_LIST); if(URL_AS_LIST[2] == 'practitioner'){ - this.router.navigate(['booking/'+URL_AS_LIST[2]+'/'+URL_AS_LIST[3]]) + this.router.navigate(['/booking/'+URL_AS_LIST[2]+'/'+URL_AS_LIST[3]]) console.log('practitioner') }else{ - this.router.navigate(['booking/'+URL_AS_LIST[2]+'/'+URL_AS_LIST[3]]) + this.router.navigate(['/booking/'+URL_AS_LIST[2]+'/'+URL_AS_LIST[3]]) console.log('Business') } } @@ -371,7 +390,8 @@ export class CustomerInfoComponent implements OnInit { }else { if(this.verifyOTP == 1){ let payment = { - api_key: "4cb964d4-9ef4-4a25-8f85-a2a13f43cbba", + // api_key: "4cb964d4-9ef4-4a25-8f85-a2a13f43cbba", + api_key: ''+this.apiUrlkey.payment_api_key+'', hash: '', amount: this.bookedDetails.amount, name: row_obj.cusName, @@ -381,8 +401,8 @@ export class CustomerInfoComponent implements OnInit { address_line_2: row_obj.address_1, order_id: generateRandomString(), description: 'testing', - mode: 'TEST', - return_url: 'http://localhost:8080/api/paymentResponse', + mode: ''+this.apiUrlkey.payment_mode+'', + return_url: this.apiUrl+'paymentResponse', currency: 'INR', country: 'IND', zip_code: row_obj.pincode, @@ -455,6 +475,18 @@ this.paymentform = payment; onclickfun(){ + + if(this.verifyOTP == 0){ + this.getOTP(1) + } + + if(!this.form.valid ){ + + return + }else { + if(this.verifyOTP == 1){ + + let URL = this.router.url; let busId = localStorage.getItem('busId') @@ -471,11 +503,7 @@ onclickfun(){ console.log(addFormData) -function generateRandomString() { - const prefix = "ORD-"; - const randomNum = (Math.random() + 1).toString(36).substring(7); - return prefix + randomNum; - } + this._cus.addCusDetails(addFormData).subscribe(async (res1) => { if (res1.status == 200) { @@ -486,6 +514,9 @@ if (res1.status == 200) { } }) + +} +} } @@ -550,13 +581,14 @@ let paramsmap= { let appointmentId = res[0].id let payment = { - api_key: '4cb964d4-9ef4-4a25-8f85-a2a13f43cbba', + // api_key: '4cb964d4-9ef4-4a25-8f85-a2a13f43cbba', + api_key: ''+this.apiUrlkey.payment_api_key+'', hash: '', amount: ""+this.bookedDetails.amount+"", order_id: ''+bookingId+'', description: 'testing', - mode: 'TEST', - return_url: 'http://localhost:8080/api/paymentResponse', + mode: ''+this.apiUrlkey.payment_mode+'', + return_url: this.apiUrl+'paymentResponse', currency: 'INR', country: 'IND', udf1: ''+busId+'', diff --git a/ng-seed/src/app/end-user/doctor-profile/doctor-profile.component.html b/ng-seed/src/app/end-user/doctor-profile/doctor-profile.component.html index 0e9dff5..3a466a6 100644 --- a/ng-seed/src/app/end-user/doctor-profile/doctor-profile.component.html +++ b/ng-seed/src/app/end-user/doctor-profile/doctor-profile.component.html @@ -42,6 +42,7 @@ --> +
@@ -168,4 +169,5 @@
--> +

Please Wait......

diff --git a/ng-seed/src/environments/environment.prod.ts b/ng-seed/src/environments/environment.prod.ts index 95d3667..775d3c9 100644 --- a/ng-seed/src/environments/environment.prod.ts +++ b/ng-seed/src/environments/environment.prod.ts @@ -8,7 +8,8 @@ export const environment = { //EndUser URL endUserUrl: window.location.origin+'/#/booking/', mailUrl:window.location.origin, - + payment_api_key :'4cb964d4-9ef4-4a25-8f85-a2a13f43cbba', + payment_mode:'LIVE', firebase: { apiKey: "AIzaSyCKbfDJ5Qf0rDP3WKppa94u9xuVaVabaDw", diff --git a/ng-seed/src/environments/environment.ts b/ng-seed/src/environments/environment.ts index 8ffc279..009557a 100644 --- a/ng-seed/src/environments/environment.ts +++ b/ng-seed/src/environments/environment.ts @@ -13,7 +13,9 @@ export const environment = { //EndUser URL endUserUrl: window.location.origin+'/#/booking/', mailUrl:window.location.origin, - + payment_api_key :'4cb964d4-9ef4-4a25-8f85-a2a13f43cbba', + payment_mode:'TEST', + firebase: { apiKey: "AIzaSyCKbfDJ5Qf0rDP3WKppa94u9xuVaVabaDw", authDomain: "venba-appointment.firebaseapp.com", @@ -24,6 +26,8 @@ export const environment = { measurementId: "G-48RM8BFRFK" }, + + // web:{ // client_id:"1070360493694-f47l99s7bjqf7of1n7amgkg3mfk7l425.apps.googleusercontent.com", // project_id:"neon-nexus-386307",