Skip to content

Commit

Permalink
feat(api-client): add accountType and vatIds properties to `chang…
Browse files Browse the repository at this point in the history
…eProfile` operation (#1477)

* feat(api-client): add `accountType` and `vatIds` properties to `changeProfile` operation

This change introduces the accountType property to specify whether a customer
is a private individual or a business. Additionally, the vatIds property is
added to store VAT IDs for business accounts.

* chore: add overrides

---------

Co-authored-by: patzick <13100280+patzick@users.noreply.github.com>
  • Loading branch information
bounoable and patzick authored Dec 4, 2024
1 parent a87bbcf commit fbc0033
Show file tree
Hide file tree
Showing 13 changed files with 666 additions and 187 deletions.
76 changes: 59 additions & 17 deletions examples/adyen-dropin-component/api-types/storeApiTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,6 @@ export type Schemas = {
readonly updatedAt?: string;
};
Customer: {
accountType?: string;
active?: boolean;
activeBillingAddress: components["schemas"]["CustomerAddress"];
activeShippingAddress: components["schemas"]["CustomerAddress"];
Expand All @@ -1761,7 +1760,6 @@ export type Schemas = {
apiAlias: "customer";
birthday?: string;
campaignCode?: string;
company?: string;
/** Format: date-time */
readonly createdAt?: string;
createdById?: string;
Expand Down Expand Up @@ -1828,8 +1826,18 @@ export type Schemas = {
/** Format: date-time */
readonly updatedAt?: string;
updatedById?: string;
vatIds?: string[];
};
} & (
| {
/** @enum {string} */
accountType: "private";
}
| {
/** @enum {string} */
accountType: "business";
company: string;
vatIds: [string, ...string[]];
}
);
CustomerAddress: {
additionalAddressLine1?: string;
additionalAddressLine2?: string;
Expand Down Expand Up @@ -7637,8 +7645,6 @@ export type operations = {
birthdayMonth?: number;
/** Birthday year */
birthdayYear?: number;
/** Company of the customer. Only required when `accountType` is `business`. */
company?: string;
/** Customer first name. Value will be reused for shipping and billing address if not provided explicitly. */
firstName: string;
/** Customer last name. Value will be reused for shipping and billing address if not provided explicitly. */
Expand All @@ -7647,7 +7653,29 @@ export type operations = {
salutationId: string;
/** (Academic) title of the customer */
title?: string;
};
} & (
| {
/**
* Type of the customer account. Default value is 'private'.
* @default private
* @enum {string}
*/
accountType?: "private";
company?: null;
vatIds?: null;
}
| {
/**
* Type of the customer account. Can be `private` or `business`.
* @enum {string}
*/
accountType: "business";
/** Company of the customer. Only required when `accountType` is `business`. */
company: string;
/** VAT IDs of the customer's company. Only valid when `accountType` is `business`. */
vatIds: [string, ...string[]];
}
);
response: components["schemas"]["SuccessResponse"];
responseCode: 200;
};
Expand Down Expand Up @@ -7769,17 +7797,9 @@ export type operations = {
body: {
/** Flag indicating accepted data protection */
acceptedDataProtection: boolean;
/**
* Account type of the customer which can be either `private` or `business`.
* @default private
*/
accountType?: string;
/** Field can be used to store an affiliate tracking code */
affiliateCode?: string;
billingAddress: Omit<
components["schemas"]["CustomerAddress"],
"createdAt" | "id" | "customerId" | "firstName" | "lastName"
>; // TODO: [OpenAPI][register] - omit id, createdAt, customerId, firstName, lastName while creating address (or better to reverse and pick required fields)
billingAddress: components["schemas"]["CustomerAddress"];
/** Birthday day */
birthdayDay?: number;
/** Birthday month */
Expand Down Expand Up @@ -7808,7 +7828,29 @@ export type operations = {
storefrontUrl: string;
/** (Academic) title of the customer */
title?: string;
};
} & (
| {
/**
* Type of the customer account. Default value is 'private'.
* @default private
* @enum {string}
*/
accountType?: "private";
company?: null;
vatIds?: null;
}
| {
/**
* Type of the customer account. Can be `private` or `business`.
* @enum {string}
*/
accountType: "business";
/** Company of the customer. Only required when `accountType` is `business`. */
company: string;
/** VAT IDs of the customer's company. Only valid when `accountType` is `business`. */
vatIds: [string, ...string[]];
}
);
response: components["schemas"]["Customer"];
responseCode: 200;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ export function useAmazonPayCheckout(amazonSessionId?: string) {
accountType: "private",
salutationId: getNotSpecifiedSalutation(),
billingAddress: {
customerId: "",
firstName: sessionData.billingAddress.name?.split(" ")[0],
lastName:
sessionData.billingAddress.name?.split(" ")[
sessionData.billingAddress.name?.split(" ").length - 1
] || "",
id: "",
salutationId: getNotSpecifiedSalutation(),
countryId: mapCountryId(sessionData.billingAddress.countryCode),
street:
Expand Down
76 changes: 59 additions & 17 deletions examples/b2b-quote-management/api-types/storeApiTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,6 @@ export type Schemas = {
readonly updatedAt?: string;
};
Customer: {
accountType?: string;
active?: boolean;
activeBillingAddress: components["schemas"]["CustomerAddress"];
activeShippingAddress: components["schemas"]["CustomerAddress"];
Expand All @@ -1714,7 +1713,6 @@ export type Schemas = {
apiAlias: "customer";
birthday?: string;
campaignCode?: string;
company?: string;
/** Format: date-time */
readonly createdAt?: string;
createdById?: string;
Expand Down Expand Up @@ -1781,8 +1779,18 @@ export type Schemas = {
/** Format: date-time */
readonly updatedAt?: string;
updatedById?: string;
vatIds?: string[];
};
} & (
| {
/** @enum {string} */
accountType: "private";
}
| {
/** @enum {string} */
accountType: "business";
company: string;
vatIds: [string, ...string[]];
}
);
CustomerAddress: {
additionalAddressLine1?: string;
additionalAddressLine2?: string;
Expand Down Expand Up @@ -7547,8 +7555,6 @@ export type operations = {
birthdayMonth?: number;
/** Birthday year */
birthdayYear?: number;
/** Company of the customer. Only required when `accountType` is `business`. */
company?: string;
/** Customer first name. Value will be reused for shipping and billing address if not provided explicitly. */
firstName: string;
/** Customer last name. Value will be reused for shipping and billing address if not provided explicitly. */
Expand All @@ -7557,7 +7563,29 @@ export type operations = {
salutationId: string;
/** (Academic) title of the customer */
title?: string;
};
} & (
| {
/**
* Type of the customer account. Default value is 'private'.
* @default private
* @enum {string}
*/
accountType?: "private";
company?: null;
vatIds?: null;
}
| {
/**
* Type of the customer account. Can be `private` or `business`.
* @enum {string}
*/
accountType: "business";
/** Company of the customer. Only required when `accountType` is `business`. */
company: string;
/** VAT IDs of the customer's company. Only valid when `accountType` is `business`. */
vatIds: [string, ...string[]];
}
);
response: components["schemas"]["SuccessResponse"];
responseCode: 200;
};
Expand Down Expand Up @@ -7679,17 +7707,9 @@ export type operations = {
body: {
/** Flag indicating accepted data protection */
acceptedDataProtection: boolean;
/**
* Account type of the customer which can be either `private` or `business`.
* @default private
*/
accountType?: string;
/** Field can be used to store an affiliate tracking code */
affiliateCode?: string;
billingAddress: Omit<
components["schemas"]["CustomerAddress"],
"createdAt" | "id" | "customerId" | "firstName" | "lastName"
>; // TODO: [OpenAPI][register] - omit id, createdAt, customerId, firstName, lastName while creating address (or better to reverse and pick required fields)
billingAddress: components["schemas"]["CustomerAddress"];
/** Birthday day */
birthdayDay?: number;
/** Birthday month */
Expand Down Expand Up @@ -7718,7 +7738,29 @@ export type operations = {
storefrontUrl: string;
/** (Academic) title of the customer */
title?: string;
};
} & (
| {
/**
* Type of the customer account. Default value is 'private'.
* @default private
* @enum {string}
*/
accountType?: "private";
company?: null;
vatIds?: null;
}
| {
/**
* Type of the customer account. Can be `private` or `business`.
* @enum {string}
*/
accountType: "business";
/** Company of the customer. Only required when `accountType` is `business`. */
company: string;
/** VAT IDs of the customer's company. Only valid when `accountType` is `business`. */
vatIds: [string, ...string[]];
}
);
response: components["schemas"]["Customer"];
responseCode: 200;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1730,7 +1730,6 @@ export type Schemas = {
readonly updatedAt?: string;
};
Customer: {
accountType?: string;
active?: boolean;
activeBillingAddress: components["schemas"]["CustomerAddress"];
activeShippingAddress: components["schemas"]["CustomerAddress"];
Expand All @@ -1740,7 +1739,6 @@ export type Schemas = {
apiAlias: "customer";
birthday?: string;
campaignCode?: string;
company?: string;
/** Format: date-time */
readonly createdAt?: string;
createdById?: string;
Expand Down Expand Up @@ -1807,8 +1805,18 @@ export type Schemas = {
/** Format: date-time */
readonly updatedAt?: string;
updatedById?: string;
vatIds?: string[];
};
} & (
| {
/** @enum {string} */
accountType: "private";
}
| {
/** @enum {string} */
accountType: "business";
company: string;
vatIds: [string, ...string[]];
}
);
CustomerAddress: {
additionalAddressLine1?: string;
additionalAddressLine2?: string;
Expand Down Expand Up @@ -7569,8 +7577,6 @@ export type operations = {
birthdayMonth?: number;
/** Birthday year */
birthdayYear?: number;
/** Company of the customer. Only required when `accountType` is `business`. */
company?: string;
/** Customer first name. Value will be reused for shipping and billing address if not provided explicitly. */
firstName: string;
/** Customer last name. Value will be reused for shipping and billing address if not provided explicitly. */
Expand All @@ -7579,7 +7585,29 @@ export type operations = {
salutationId: string;
/** (Academic) title of the customer */
title?: string;
};
} & (
| {
/**
* Type of the customer account. Default value is 'private'.
* @default private
* @enum {string}
*/
accountType?: "private";
company?: null;
vatIds?: null;
}
| {
/**
* Type of the customer account. Can be `private` or `business`.
* @enum {string}
*/
accountType: "business";
/** Company of the customer. Only required when `accountType` is `business`. */
company: string;
/** VAT IDs of the customer's company. Only valid when `accountType` is `business`. */
vatIds: [string, ...string[]];
}
);
response: components["schemas"]["SuccessResponse"];
responseCode: 200;
};
Expand Down Expand Up @@ -7701,17 +7729,9 @@ export type operations = {
body: {
/** Flag indicating accepted data protection */
acceptedDataProtection: boolean;
/**
* Account type of the customer which can be either `private` or `business`.
* @default private
*/
accountType?: string;
/** Field can be used to store an affiliate tracking code */
affiliateCode?: string;
billingAddress: Omit<
components["schemas"]["CustomerAddress"],
"createdAt" | "id" | "customerId" | "firstName" | "lastName"
>; // TODO: [OpenAPI][register] - omit id, createdAt, customerId, firstName, lastName while creating address (or better to reverse and pick required fields)
billingAddress: components["schemas"]["CustomerAddress"];
/** Birthday day */
birthdayDay?: number;
/** Birthday month */
Expand Down Expand Up @@ -7740,7 +7760,29 @@ export type operations = {
storefrontUrl: string;
/** (Academic) title of the customer */
title?: string;
};
} & (
| {
/**
* Type of the customer account. Default value is 'private'.
* @default private
* @enum {string}
*/
accountType?: "private";
company?: null;
vatIds?: null;
}
| {
/**
* Type of the customer account. Can be `private` or `business`.
* @enum {string}
*/
accountType: "business";
/** Company of the customer. Only required when `accountType` is `business`. */
company: string;
/** VAT IDs of the customer's company. Only valid when `accountType` is `business`. */
vatIds: [string, ...string[]];
}
);
response: components["schemas"]["Customer"];
responseCode: 200;
};
Expand Down
Loading

0 comments on commit fbc0033

Please sign in to comment.