Skip to content

Commit

Permalink
⚰️(frontend) remove Address from joanieLegacy
Browse files Browse the repository at this point in the history
  • Loading branch information
rlecellier committed Mar 7, 2024
1 parent 463f6cc commit 3401235
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 59 deletions.
19 changes: 0 additions & 19 deletions src/frontend/js/api/joanie/joanieLegacyClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,25 +283,6 @@ const API = (): Joanie.API => {
method: 'DELETE',
}).then(checkStatus),
},
addresses: {
get: (id?: string) => {
return fetchWithJWT(buildApiUrl(ROUTES.user.addresses.get, { id })).then(checkStatus);
},
create: async (payload) =>
fetchWithJWT(ROUTES.user.addresses.create, {
method: 'POST',
body: JSON.stringify(payload),
}).then(checkStatus),
update: async ({ id, ...address }) =>
fetchWithJWT(ROUTES.user.addresses.update.replace(':id', id), {
method: 'PUT',
body: JSON.stringify(address),
}).then(checkStatus),
delete: async (id) =>
fetchWithJWT(ROUTES.user.addresses.delete.replace(':id', id), {
method: 'DELETE',
}).then(checkStatus),
},
orders: {
abort: async ({ id, payment_id }) => {
return fetchWithJWT(ROUTES.user.orders.abort.replace(':id', id), {
Expand Down
26 changes: 1 addition & 25 deletions src/frontend/js/types/Joanie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,19 +372,6 @@ export interface CreditCard {
title?: string;
}

// Address
export interface Address {
address: string;
city: string;
country: string;
first_name: string;
last_name: string;
id: string;
is_main: boolean;
postcode: string;
title: string;
}

// Wishlist
export interface CourseWish extends Resource {
status: boolean;
Expand Down Expand Up @@ -415,10 +402,6 @@ export interface OrderPaymentInfo {
}

// - API
export interface AddressCreationPayload extends Omit<Address, 'id' | 'is_main'> {
is_main?: boolean;
}

interface AbstractOrderProductCreationPayload {
product_id: Product['id'];
order_group_id?: OrderGroup['id'];
Expand All @@ -441,7 +424,7 @@ interface OrderAbortPayload {

interface OrderSubmitPayload {
id: Order['id'];
billing_address: Omit<Address, 'id' | 'is_main'>;
billing_address: Omit<AddressGen, 'id' | 'is_main'>;
credit_card_id?: CreditCard['id'];
}

Expand Down Expand Up @@ -525,13 +508,6 @@ interface APIUser {
me: {
get(): Promise<JoanieUserProfile>;
};
addresses: {
create(payload: AddressCreationPayload): Promise<Address>;
delete(id: Address['id']): Promise<void>;
get(id: Address['id']): Promise<Address>;
get(): Promise<Address[]>;
update(payload: Address): Promise<Address>;
};
creditCards: {
create(payload: Omit<CreditCard, 'id'>): Promise<CreditCard>;
delete(id: CreditCard['id']): Promise<void>;
Expand Down
15 changes: 0 additions & 15 deletions src/frontend/js/utils/test/factories/joanieLegacy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { faker } from '@faker-js/faker';
import { CourseStateTextEnum, Priority } from 'types';
import {
Address,
Certificate,
CertificateDefinition,
CourseListItem,
Expand Down Expand Up @@ -464,20 +463,6 @@ export const CertificateOrderWithOneClickPaymentFactory = factory(
},
);

export const AddressFactory = factory((): Address => {
return {
address: faker.location.streetAddress(),
city: faker.location.city(),
country: faker.location.countryCode(),
first_name: faker.person.firstName(),
last_name: faker.person.lastName(),
id: faker.string.uuid(),
is_main: false,
postcode: faker.location.zipCode(),
title: FactoryHelper.sequence((counter) => `Address ${counter}`),
};
});

export const CreditCardFactory = factory((): CreditCard => {
return {
brand: CreditCardBrand.VISA,
Expand Down

0 comments on commit 3401235

Please sign in to comment.