Skip to content

Commit

Permalink
fix: Adjust billing address feature to change to sapBillingAddress ke…
Browse files Browse the repository at this point in the history
…y in API
  • Loading branch information
rmch91 committed Oct 18, 2024
1 parent 5f1b9a7 commit 6a1a3f5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions feature-libs/cart/base/root/models/cart.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export interface Cart {
paymentInfo?: PaymentDetails;
paymentType?: PaymentType;
paymentAddress?: Address;
sapBillingAddress?: Address;
pickupItemsQuantity?: number;
pickupOrderGroups?: PickupOrderEntryGroup[];
potentialOrderPromotions?: PromotionResult[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('OpfCheckoutBillingAddressFormService', () => {
mockActiveCartFacade = {
reloadActiveCart: () => of(true),
isStable: () => of(true),
getActive: () => of({ paymentAddress: mockPaymentAddress } as Cart),
getActive: () => of({ sapBillingAddress: mockPaymentAddress } as Cart),
};

mockGlobalMessageService = {
Expand Down Expand Up @@ -167,7 +167,7 @@ describe('OpfCheckoutBillingAddressFormService', () => {

it('should get payment address', () => {
spyOn(mockActiveCartFacade, 'getActive').and.returnValue(
of({ paymentAddress: mockPaymentAddress } as Cart)
of({ sapBillingAddress: mockPaymentAddress } as Cart)
);

service['getPaymentAddress']().subscribe((result) => {
Expand All @@ -177,7 +177,7 @@ describe('OpfCheckoutBillingAddressFormService', () => {

it('should not get payment address when not present', () => {
spyOn(mockActiveCartFacade, 'getActive').and.returnValue(
of({ paymentAddress: undefined } as Cart)
of({ sapBillingAddress: undefined } as Cart)
);

service['getPaymentAddress']().subscribe((result) => {
Expand All @@ -196,7 +196,7 @@ describe('OpfCheckoutBillingAddressFormService', () => {

it('should not get payment address when it is not present', (done) => {
spyOn(mockActiveCartFacade, 'getActive').and.returnValue(
of({ paymentAddress: undefined } as Cart)
of({ sapBillingAddress: undefined } as Cart)
);

service['getPaymentAddress']().subscribe((result) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import {
} from '@spartacus/core';
import {
BehaviorSubject,
combineLatest,
EMPTY,
Observable,
combineLatest,
throwError,
} from 'rxjs';
import {
Expand Down Expand Up @@ -174,7 +174,7 @@ export class OpfCheckoutBillingAddressFormService {
protected getPaymentAddress(): Observable<Address | undefined> {
return this.activeCartService
.getActive()
.pipe(map((cart: Cart) => cart.paymentAddress));
.pipe(map((cart: Cart) => cart.sapBillingAddress));
}

protected getAddressWithId(address: Address): Address {
Expand Down

0 comments on commit 6a1a3f5

Please sign in to comment.