dev #14490 WPA CoffeeLike добавление в wallet вместо установки для iOS

This commit is contained in:
nikolay 2023-06-13 15:31:04 +04:00
parent 425ef99af2
commit 30854f4cb9
2 changed files with 44 additions and 36 deletions

View File

@ -68,9 +68,10 @@ export class DownloadAppDirective implements OnInit {
if (event) {
event.preventDefault();
}
if (this.deviceType === 'ios') {
await this.addCardToWallet();
return;
if (this.deviceType === 'ios') {
}
if (!this.deferredPrompt) {
this.messageService.add({
@ -95,6 +96,7 @@ export class DownloadAppDirective implements OnInit {
async addCardToWallet() {
const token = this.cookiesService.getItem('token');
try {
const accountData = (
await lastValueFrom(
this.jsonrpc.rpc(
@ -107,6 +109,7 @@ export class DownloadAppDirective implements OnInit {
)
)
).data;
if (token && accountData.user_id) {
this.appleWallet.generateCard(token, accountData.user_id).subscribe({
next: (res: any) => {
@ -117,5 +120,9 @@ export class DownloadAppDirective implements OnInit {
},
});
}
} catch (e) {
console.log(e);
}
}
}

View File

@ -45,6 +45,7 @@ export class GuestCardComponent implements OnInit {
.subscribe({
next: (value) => {
this.customerInfo = value.customer_info;
this.cookiesService.setCookie('phone-number', this.customerInfo?.phone?.substr(2))
this.getPurchases().subscribe((value) => {
this.purchases = this.loyaltyProgram.filterPurchases(value[this.customerInfo?.id])
@ -55,7 +56,7 @@ export class GuestCardComponent implements OnInit {
const currentAmount = this.loyaltyProgram.purchaseData.currentAmount || 0
this.loyaltyProgram.setCurrentLvl(currentAmount)
// this.currentLvlPeriod = this.lvlPeriods.find((item) => item.start <= currentAmount && currentAmount <= (item.end || Infinity))!
this.loyaltyProgram.purchaseData.$loading = false;
});
},