File: /var/www/vhost/disk-apps/pwa.sports-crowd.com/src/app/services/online-payment.service.ts
import { Injectable } from "@angular/core";
import { ApiService } from "./api.service";
import { InAppBrowser, ToolBarType } from '@capgo/inappbrowser'
import { TranslateService } from "@ngx-translate/core";
import { Capacitor } from "@capacitor/core";
@Injectable({
providedIn: "root",
})
export class OnlinePaymentService {
constructor(private api: ApiService, public translateService: TranslateService) { }
// Gateway
async goToPayment(extraParam: any, paymentGatewayId) {
let url = this.api.getUrl();
url = `${url}/store/webcheckout?paymentGatewayId=` + paymentGatewayId + extraParam;
if (Capacitor.isNativePlatform()) {
url += '&appOrigin=app'
InAppBrowser.openWebView({
url: url,
isInspectable: false,
toolbarType: ToolBarType.DEFAULT,
title: this.translateService.instant("academy.segment_1")
});
} else {
url += '&appOrigin=pwa'
window.open(url);
}
}
}