diff --git a/angular/src/app/presentation-options/default-option/pages/guest-card/guest-card.component.ts b/angular/src/app/presentation-options/default-option/pages/guest-card/guest-card.component.ts index ede5375..a70a80f 100644 --- a/angular/src/app/presentation-options/default-option/pages/guest-card/guest-card.component.ts +++ b/angular/src/app/presentation-options/default-option/pages/guest-card/guest-card.component.ts @@ -55,6 +55,7 @@ export class GuestCardComponent implements OnInit { this.loyaltyProgram.getLastPurchase( environment.systemId, token || '', + this.customerInfo.id ); }, }); diff --git a/angular/src/app/services/loyalty-program.service.ts b/angular/src/app/services/loyalty-program.service.ts index 98a8263..5781650 100644 --- a/angular/src/app/services/loyalty-program.service.ts +++ b/angular/src/app/services/loyalty-program.service.ts @@ -93,11 +93,11 @@ export class LoyaltyProgramService { return lvlPeriods[this.currentLvl]; } - getLastPurchase(systemId: string, token: string) { + getLastPurchase(systemId: string, token: string, customerId: string) { this.purchaseData.$loading = true; this.wpJsonService.getLastPurchase(systemId, token).subscribe({ next: (res) => { - this.purchaseData.lastPurchase = res; + this.purchaseData.lastPurchase = res[customerId][0]; }, complete: () => { this.purchaseData.$loading = false; diff --git a/angular/src/app/services/wp-json.service.ts b/angular/src/app/services/wp-json.service.ts index 86959e8..09e2f10 100644 --- a/angular/src/app/services/wp-json.service.ts +++ b/angular/src/app/services/wp-json.service.ts @@ -56,7 +56,7 @@ export class WpJsonService { ) } - getLastPurchase(systemId: string, token: string): Observable { + getLastPurchase(systemId: string, token: string): Observable { return this._request(`last_trans/${systemId}/${token}/`, 'GET', null, false, environment.icardProxy); }