Skip to content

Commit

Permalink
Finished up base API stuff, fixed a few misc things
Browse files Browse the repository at this point in the history
Mostly getting to a point where we can trigger a refund and make sure the events are firing
  • Loading branch information
jkachel committed Feb 7, 2025
1 parent 8f7371f commit dc00100
Show file tree
Hide file tree
Showing 8 changed files with 1,569 additions and 1,324 deletions.
148 changes: 137 additions & 11 deletions frontends/api/src/generated/v0/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,25 @@ export interface CreateBasketWithProductsSkuRequest {
*/
quantity: number
}
/**
* Serializer for the create from order API.
* @export
* @interface CreateFromOrderApiRequest
*/
export interface CreateFromOrderApiRequest {
/**
*
* @type {number}
* @memberof CreateFromOrderApiRequest
*/
order: number
/**
*
* @type {Array<number>}
* @memberof CreateFromOrderApiRequest
*/
lines: Array<number>
}
/**
* Really basic serializer for the payload that we need to send to CyberSource.
* @export
Expand Down Expand Up @@ -2024,7 +2043,7 @@ export const NullEnum = {
export type NullEnum = (typeof NullEnum)[keyof typeof NullEnum]

/**
*
* Serializes an order.
* @export
* @interface Order
*/
Expand Down Expand Up @@ -2072,11 +2091,11 @@ export interface Order {
*/
redeemed_discounts: Array<RedeemedDiscount>
/**
*
* @type {string}
* Return refunds for the order. Returns an empty set for now, don\'t have that set up yet really. In MITx Online this returned _transactions_ that were refunds, so we want to return the requests that we\'re now collecting.
* @type {Array<any>}
* @memberof Order
*/
refunds: string
refunds: Array<any>
/**
*
* @type {string}
Expand All @@ -2091,10 +2110,10 @@ export interface Order {
transactions: Array<Transaction>
/**
*
* @type {string}
* @type {TransactionDataPurchaser}
* @memberof Order
*/
street_address: string
street_address: TransactionDataPurchaser
}

/**
Expand Down Expand Up @@ -2154,7 +2173,7 @@ export interface OrderHistory {
}

/**
*
* Serializes an order.
* @export
* @interface OrderRequest
*/
Expand Down Expand Up @@ -3189,6 +3208,67 @@ export interface Transaction {
reason: string
}

/**
* Serializes a transaction\'s purchaser data.
* @export
* @interface TransactionDataPurchaser
*/
export interface TransactionDataPurchaser {
/**
*
* @type {string}
* @memberof TransactionDataPurchaser
*/
first_name: string
/**
*
* @type {string}
* @memberof TransactionDataPurchaser
*/
last_name: string
/**
*
* @type {string}
* @memberof TransactionDataPurchaser
*/
country: string
/**
*
* @type {string}
* @memberof TransactionDataPurchaser
*/
email: string
/**
*
* @type {Array<string>}
* @memberof TransactionDataPurchaser
*/
street_address: Array<string>
/**
*
* @type {string}
* @memberof TransactionDataPurchaser
*/
city: string
/**
*
* @type {string}
* @memberof TransactionDataPurchaser
*/
state_or_territory: string
/**
*
* @type {string}
* @memberof TransactionDataPurchaser
*/
postal_code: string
/**
*
* @type {string}
* @memberof TransactionDataPurchaser
*/
company: string
}
/**
*
* @export
Expand Down Expand Up @@ -7606,12 +7686,20 @@ export const RefundsApiAxiosParamCreator = function (
return {
/**
* Create a refund from an existing order, optionally specifying which lines to refund.
* @param {CreateFromOrderApiRequest} CreateFromOrderApiRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
refundsCreateFromOrderCreate: async (
CreateFromOrderApiRequest: CreateFromOrderApiRequest,
options: RawAxiosRequestConfig = {},
): Promise<RequestArgs> => {
// verify required parameter 'CreateFromOrderApiRequest' is not null or undefined
assertParamExists(
"refundsCreateFromOrderCreate",
"CreateFromOrderApiRequest",
CreateFromOrderApiRequest,
)
const localVarPath = `/api/v0/refunds/create_from_order`
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL)
Expand All @@ -7628,6 +7716,8 @@ export const RefundsApiAxiosParamCreator = function (
const localVarHeaderParameter = {} as any
const localVarQueryParameter = {} as any

localVarHeaderParameter["Content-Type"] = "application/json"

setSearchParams(localVarUrlObj, localVarQueryParameter)
let headersFromBaseOptions =
baseOptions && baseOptions.headers ? baseOptions.headers : {}
Expand All @@ -7636,6 +7726,11 @@ export const RefundsApiAxiosParamCreator = function (
...headersFromBaseOptions,
...options.headers,
}
localVarRequestOptions.data = serializeDataIfNeeded(
CreateFromOrderApiRequest,
localVarRequestOptions,
configuration,
)

return {
url: toPathString(localVarUrlObj),
Expand Down Expand Up @@ -8268,16 +8363,21 @@ export const RefundsApiFp = function (configuration?: Configuration) {
return {
/**
* Create a refund from an existing order, optionally specifying which lines to refund.
* @param {CreateFromOrderApiRequest} CreateFromOrderApiRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async refundsCreateFromOrderCreate(
CreateFromOrderApiRequest: CreateFromOrderApiRequest,
options?: RawAxiosRequestConfig,
): Promise<
(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Request>
> {
const localVarAxiosArgs =
await localVarAxiosParamCreator.refundsCreateFromOrderCreate(options)
await localVarAxiosParamCreator.refundsCreateFromOrderCreate(
CreateFromOrderApiRequest,
options,
)
const index = configuration?.serverIndex ?? 0
const operationBasePath =
operationServerMap["RefundsApi.refundsCreateFromOrderCreate"]?.[index]
Expand Down Expand Up @@ -8651,14 +8751,19 @@ export const RefundsApiFactory = function (
return {
/**
* Create a refund from an existing order, optionally specifying which lines to refund.
* @param {RefundsApiRefundsCreateFromOrderCreateRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
refundsCreateFromOrderCreate(
requestParameters: RefundsApiRefundsCreateFromOrderCreateRequest,
options?: RawAxiosRequestConfig,
): AxiosPromise<Request> {
return localVarFp
.refundsCreateFromOrderCreate(options)
.refundsCreateFromOrderCreate(
requestParameters.CreateFromOrderApiRequest,
options,
)
.then((request) => request(axios, basePath))
},
/**
Expand Down Expand Up @@ -8856,6 +8961,20 @@ export const RefundsApiFactory = function (
}
}

/**
* Request parameters for refundsCreateFromOrderCreate operation in RefundsApi.
* @export
* @interface RefundsApiRefundsCreateFromOrderCreateRequest
*/
export interface RefundsApiRefundsCreateFromOrderCreateRequest {
/**
*
* @type {CreateFromOrderApiRequest}
* @memberof RefundsApiRefundsCreateFromOrderCreate
*/
readonly CreateFromOrderApiRequest: CreateFromOrderApiRequest
}

/**
* Request parameters for refundsLinesCreate operation in RefundsApi.
* @export
Expand Down Expand Up @@ -9075,13 +9194,20 @@ export interface RefundsApiRefundsRequestsUpdateRequest {
export class RefundsApi extends BaseAPI {
/**
* Create a refund from an existing order, optionally specifying which lines to refund.
* @param {RefundsApiRefundsCreateFromOrderCreateRequest} requestParameters Request parameters.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof RefundsApi
*/
public refundsCreateFromOrderCreate(options?: RawAxiosRequestConfig) {
public refundsCreateFromOrderCreate(
requestParameters: RefundsApiRefundsCreateFromOrderCreateRequest,
options?: RawAxiosRequestConfig,
) {
return RefundsApiFp(this.configuration)
.refundsCreateFromOrderCreate(options)
.refundsCreateFromOrderCreate(
requestParameters.CreateFromOrderApiRequest,
options,
)
.then((request) => request(this.axios, this.basePath))
}

Expand Down
Loading

0 comments on commit dc00100

Please sign in to comment.