Skip to content

Commit

Permalink
feat(cart,cart-store-credit)!: remove DaffCartShippingInformation (#…
Browse files Browse the repository at this point in the history
…2788)

BREAKING CHANGE: `DaffCartShippingInformation` has been removed. Use `DaffCartShippingRate` instead
  • Loading branch information
griest024 committed May 13, 2024
1 parent 0f20924 commit b4cc19b
Show file tree
Hide file tree
Showing 27 changed files with 74 additions and 320 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { faker } from '@faker-js/faker/locale/en_US';

import { MockCart } from '@daffodil/cart/testing';
import { DaffCartTotalFactory } from '@daffodil/cart/testing';
import { DaffCartShippingInformationFactory } from '@daffodil/cart/testing';
import { DaffCartShippingRateFactory } from '@daffodil/cart/testing';
import { DaffCartWithStoreCredit } from '@daffodil/cart-store-credit';
import { DaffModelFactory } from '@daffodil/core/testing';

Expand All @@ -23,7 +23,7 @@ export class MockDaffCartWithStoreCredit extends MockCart implements DaffCartWit
export class DaffCartWithStoreCreditFactory extends DaffModelFactory<DaffCartWithStoreCredit, typeof MockDaffCartWithStoreCredit>{
constructor(
totalFactory: DaffCartTotalFactory,
shippingInformationFactory: DaffCartShippingInformationFactory,
shippingInformationFactory: DaffCartShippingRateFactory,
) {
super(MockDaffCartWithStoreCredit, totalFactory, shippingInformationFactory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
DaffCartAddress,
DaffCartPaymentMethod,
DaffCartShippingRate,
DaffCartShippingInformation,
} from '@daffodil/cart';
import {
DaffCartFactory,
Expand Down Expand Up @@ -43,7 +42,7 @@ describe('DaffInMemoryBackendCartRootService | Integration', () => {
let mockBillingAddress: DaffCartAddress;
let mockPayment: DaffCartPaymentMethod;
let mockShippingMethod: DaffCartShippingRate;
let mockShippingInformation: DaffCartShippingInformation;
let mockShippingInformation: DaffCartShippingRate;
let cartId: DaffCart['id'];
let itemId: DaffCartItem['id'];

Expand Down Expand Up @@ -72,10 +71,7 @@ describe('DaffInMemoryBackendCartRootService | Integration', () => {
mockBillingAddress = cartAddressFactory.create();
mockPayment = cartPaymentFactory.create();
mockShippingMethod = cartShippingMethodFactory.create();
mockShippingInformation = {
...cartShippingMethodFactory.create(),
address_id: null,
};
mockShippingInformation = cartShippingMethodFactory.create();
cartId = mockCart.id;
itemId = mockCartItem.id;
mockCart.items.push(mockCartItem);
Expand Down Expand Up @@ -521,13 +517,10 @@ describe('DaffInMemoryBackendCartRootService | Integration', () => {

describe('processing an update shipping information request', () => {
let result;
let newShippingInformation: DaffCartShippingInformation;
let newShippingInformation: DaffCartShippingRate;

beforeEach(done => {
newShippingInformation = {
...cartShippingMethodFactory.create(),
address_id: null,
};
newShippingInformation = cartShippingMethodFactory.create();

httpClient.put<any>(`/api/cart-shipping-information/${cartId}/`, newShippingInformation).subscribe(res => {
result = res;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TestBed } from '@angular/core/testing';

import {
DaffCart,
DaffCartShippingInformation,
DaffCartShippingRate,
} from '@daffodil/cart';
import { DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK } from '@daffodil/cart/driver/in-memory';
import {
Expand All @@ -19,7 +19,7 @@ describe('DaffInMemoryBackendCartShippingInformationService', () => {
let cartShippingInformationFactory: DaffCartShippingRateFactory;

let mockCart: DaffCart;
let mockCartShippingInformation: DaffCartShippingInformation;
let mockCartShippingInformation: DaffCartShippingRate;
let cartId;
let reqInfoStub;
let baseUrl;
Expand All @@ -46,10 +46,7 @@ describe('DaffInMemoryBackendCartShippingInformationService', () => {
cartShippingInformationFactory = TestBed.inject(DaffCartShippingRateFactory);

mockCart = cartFactory.create();
mockCartShippingInformation = {
...cartShippingInformationFactory.create(),
address_id: null,
};
mockCartShippingInformation = cartShippingInformationFactory.create();
extraAttributes = {
extraField: 'extraField',
};
Expand Down Expand Up @@ -93,13 +90,10 @@ describe('DaffInMemoryBackendCartShippingInformationService', () => {

describe('processing an update shipping information request', () => {
let result;
let newShippingInformation: DaffCartShippingInformation;
let newShippingInformation: DaffCartShippingRate;

beforeEach(() => {
newShippingInformation = {
...cartShippingInformationFactory.create(),
address_id: null,
};
newShippingInformation = cartShippingInformationFactory.create();
reqInfoStub.url = cartUrl;
reqInfoStub.req.body = newShippingInformation;
result = service.put(reqInfoStub);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {

import {
DaffCart,
DaffCartShippingInformation,
DaffCartShippingRate,
} from '@daffodil/cart';
import { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';
import { DaffInMemoryBackendProductService } from '@daffodil/product/driver/in-memory';
Expand Down Expand Up @@ -57,7 +57,7 @@ export class DaffInMemoryBackendCartShippingInformationService implements DaffIn
return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);
}

private getShippingInformation(reqInfo): DaffCartShippingInformation {
private getShippingInformation(reqInfo): DaffCartShippingRate {
return this.getCart(reqInfo).shipping_information;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { TestBed } from '@angular/core/testing';
import {
DaffCart,
DaffCartShippingRate,
DaffCartShippingInformation,
} from '@daffodil/cart';
import {
DaffCartFactory,
Expand All @@ -23,7 +22,7 @@ describe('Driver | In Memory | Cart | CartShippingInformationService', () => {
let cartShippingRateFactory: DaffCartShippingRateFactory;

let mockCart: DaffCart;
let mockCartShippingInfo: DaffCartShippingInformation;
let mockCartShippingInfo: DaffCartShippingRate;
let cartId;

beforeEach(() => {
Expand All @@ -43,10 +42,7 @@ describe('Driver | In Memory | Cart | CartShippingInformationService', () => {
cartShippingRateFactory = TestBed.inject(DaffCartShippingRateFactory);

mockCart = cartFactory.create();
mockCartShippingInfo = {
...cartShippingRateFactory.create(),
address_id: null,
};
mockCartShippingInfo = cartShippingRateFactory.create();
mockCart.shipping_information = mockCartShippingInfo;
cartId = mockCart.id;
});
Expand Down
2 changes: 0 additions & 2 deletions libs/cart/driver/magento/src/cart-driver.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import { DaffMagentoBillingAddressTransformer } from './transforms/outputs/billi
import { DaffMagentoCartAddressTransformer } from './transforms/outputs/cart-address.service';
import { DaffMagentoCartCouponResponseTransformer } from './transforms/outputs/cart-coupon-response.service';
import { DaffMagentoCartPaymentTransformer } from './transforms/outputs/cart-payment.service';
import { DaffMagentoCartShippingInformationTransformer } from './transforms/outputs/cart-shipping-information.service';
import { DaffMagentoCartShippingRateTransformer } from './transforms/outputs/cart-shipping-rate.service';
import { DaffMagentoCartTransformer } from './transforms/outputs/cart.service';
import { DaffMagentoShippingAddressTransformer } from './transforms/outputs/shipping-address.service';
Expand Down Expand Up @@ -104,7 +103,6 @@ export class DaffCartMagentoDriverModule {
DaffMagentoBillingAddressTransformer,
DaffMagentoCartAddressTransformer,
DaffMagentoCartPaymentTransformer,
DaffMagentoCartShippingInformationTransformer,
DaffMagentoCartShippingRateTransformer,
DaffMagentoCartTransformer,
DaffMagentoShippingAddressTransformer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { catchError } from 'rxjs';

import {
DaffCart,
DaffCartShippingInformation,
DaffCartShippingRate,
} from '@daffodil/cart';
import {
MagentoCartShippingMethod,
Expand Down Expand Up @@ -64,7 +64,7 @@ describe('@daffodil/cart/driver/magento | CartShippingInformationService', () =>
let mockMagentoCart: MagentoCart;
let mockMagentoShippingAddress: MagentoShippingAddress;
let mockMagentoShippingMethod: MagentoCartSelectedShippingMethod;
let mockDaffCartShippingInformation: DaffCartShippingInformation;
let mockDaffCartShippingInformation: DaffCartShippingRate;
let mockSetSelectedShippingMethodResponse: MagentoSetSelectedShippingMethodResponse;
let mockGetSelectedShippingMethodResponse: MagentoGetSelectedShippingMethodResponse;
let mockListCartShippingMethodsResponse: MagentoListShippingMethodsResponse;
Expand Down Expand Up @@ -117,10 +117,7 @@ describe('@daffodil/cart/driver/magento | CartShippingInformationService', () =>
__typename: 'SelectedShippingMethod',
...magentoShippingMethodFactory.create(),
};
mockDaffCartShippingInformation = {
...daffCartShippingRateFactory.create(),
address_id: null,
};
mockDaffCartShippingInformation = daffCartShippingRateFactory.create();
mockMagentoShippingAddress = magentoShippingAddressFactory.create();

cartId = mockDaffCart.id;
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit b4cc19b

Please sign in to comment.