dev #14490 WPA CoffeeLike добавление в wallet вместо установки для iOS
This commit is contained in:
parent
425ef99af2
commit
30854f4cb9
@ -68,9 +68,10 @@ export class DownloadAppDirective implements OnInit {
|
|||||||
if (event) {
|
if (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
if (this.deviceType === 'ios') {
|
|
||||||
await this.addCardToWallet();
|
await this.addCardToWallet();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (this.deviceType === 'ios') {
|
||||||
}
|
}
|
||||||
if (!this.deferredPrompt) {
|
if (!this.deferredPrompt) {
|
||||||
this.messageService.add({
|
this.messageService.add({
|
||||||
@ -95,6 +96,7 @@ export class DownloadAppDirective implements OnInit {
|
|||||||
|
|
||||||
async addCardToWallet() {
|
async addCardToWallet() {
|
||||||
const token = this.cookiesService.getItem('token');
|
const token = this.cookiesService.getItem('token');
|
||||||
|
try {
|
||||||
const accountData = (
|
const accountData = (
|
||||||
await lastValueFrom(
|
await lastValueFrom(
|
||||||
this.jsonrpc.rpc(
|
this.jsonrpc.rpc(
|
||||||
@ -107,6 +109,7 @@ export class DownloadAppDirective implements OnInit {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
).data;
|
).data;
|
||||||
|
|
||||||
if (token && accountData.user_id) {
|
if (token && accountData.user_id) {
|
||||||
this.appleWallet.generateCard(token, accountData.user_id).subscribe({
|
this.appleWallet.generateCard(token, accountData.user_id).subscribe({
|
||||||
next: (res: any) => {
|
next: (res: any) => {
|
||||||
@ -117,5 +120,9 @@ export class DownloadAppDirective implements OnInit {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,6 +45,7 @@ export class GuestCardComponent implements OnInit {
|
|||||||
.subscribe({
|
.subscribe({
|
||||||
next: (value) => {
|
next: (value) => {
|
||||||
this.customerInfo = value.customer_info;
|
this.customerInfo = value.customer_info;
|
||||||
|
|
||||||
this.cookiesService.setCookie('phone-number', this.customerInfo?.phone?.substr(2))
|
this.cookiesService.setCookie('phone-number', this.customerInfo?.phone?.substr(2))
|
||||||
this.getPurchases().subscribe((value) => {
|
this.getPurchases().subscribe((value) => {
|
||||||
this.purchases = this.loyaltyProgram.filterPurchases(value[this.customerInfo?.id])
|
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
|
const currentAmount = this.loyaltyProgram.purchaseData.currentAmount || 0
|
||||||
this.loyaltyProgram.setCurrentLvl(currentAmount)
|
this.loyaltyProgram.setCurrentLvl(currentAmount)
|
||||||
// this.currentLvlPeriod = this.lvlPeriods.find((item) => item.start <= currentAmount && currentAmount <= (item.end || Infinity))!
|
|
||||||
this.loyaltyProgram.purchaseData.$loading = false;
|
this.loyaltyProgram.purchaseData.$loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user