-
Notifications
You must be signed in to change notification settings - Fork 88
[balanceplatform] Code generation: update services and models #1637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AdyenAutomationBot
wants to merge
1
commit into
main
Choose a base branch
from
sdk-automation/balanceplatform
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ import { AccountHolderInfo } from "../../typings/balancePlatform/models"; | |
| import { AccountHolderUpdateRequest } from "../../typings/balancePlatform/models"; | ||
| import { GetTaxFormResponse } from "../../typings/balancePlatform/models"; | ||
| import { PaginatedBalanceAccountsResponse } from "../../typings/balancePlatform/models"; | ||
| import { TaxFormSummaryResponse } from "../../typings/balancePlatform/models"; | ||
| import { TransactionRulesResponse } from "../../typings/balancePlatform/models"; | ||
|
|
||
| /** | ||
|
|
@@ -128,9 +129,9 @@ export class AccountHoldersApi extends Service { | |
| * @summary Get a tax form | ||
| * @param id {@link string } The unique identifier of the account holder. | ||
| * @param requestOptions {@link IRequest.Options } | ||
| * @param formType {@link 'US1099k' | 'US1099nec' } (Required) The type of tax form you want to retrieve. Accepted values are **US1099k** and **US1099nec** | ||
| * @param year {@link number } (Required) The tax year in YYYY format for the tax form you want to retrieve | ||
| * @param legalEntityId {@link string } The legal entity reference whose tax form you want to retrieve | ||
| * @param formType {@link 'US1099k' | 'US1099nec' } (Required) The type of tax form you want to retrieve. Accepted values are **US1099k** and **US1099nec**. | ||
| * @param year {@link number } (Required) The tax year in **YYYY** format for the tax form you want to retrieve. | ||
| * @param legalEntityId {@link string } The legal entity reference whose tax form you want to retrieve. | ||
| * @return {@link GetTaxFormResponse } | ||
| */ | ||
| public async getTaxForm(id: string, formType: "US1099k" | "US1099nec", year: number, legalEntityId?: string, requestOptions?: IRequest.Options): Promise<GetTaxFormResponse> { | ||
|
|
@@ -155,6 +156,33 @@ export class AccountHoldersApi extends Service { | |
| return ObjectSerializer.deserialize(response, "GetTaxFormResponse"); | ||
| } | ||
|
|
||
| /** | ||
| * @summary Get summary of tax forms for an account holder | ||
| * @param id {@link string } The unique identifier of the account holder. | ||
| * @param requestOptions {@link IRequest.Options } | ||
| * @param formType {@link string } (Required) The type of tax form you want a summary for. Accepted values are **US1099k** and **US1099nec**. | ||
| * @return {@link TaxFormSummaryResponse } | ||
| */ | ||
| public async getTaxFormSummary(id: string, formType: string, requestOptions?: IRequest.Options): Promise<TaxFormSummaryResponse> { | ||
| const endpoint = `${this.baseUrl}/accountHolders/{id}/taxFormSummary` | ||
| .replace("{" + "id" + "}", encodeURIComponent(String(id))); | ||
| const resource = new Resource(this, endpoint); | ||
|
|
||
| const hasDefinedQueryParams = formType; | ||
| if(hasDefinedQueryParams) { | ||
| if(!requestOptions) requestOptions = {}; | ||
| if(!requestOptions.params) requestOptions.params = {}; | ||
| if(formType) requestOptions.params["formType"] = formType; | ||
| } | ||
|
Comment on lines
+171
to
+176
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This block for handling query parameters is verbose and contains redundant checks. Since requestOptions = {
...requestOptions,
params: {
...requestOptions?.params,
formType,
},
}; |
||
| const response = await getJsonResponse<string, TaxFormSummaryResponse>( | ||
| resource, | ||
| "", | ||
| { ...requestOptions, method: "GET" } | ||
| ); | ||
|
|
||
| return ObjectSerializer.deserialize(response, "TaxFormSummaryResponse"); | ||
| } | ||
|
|
||
| /** | ||
| * @summary Update an account holder | ||
| * @param id {@link string } The unique identifier of the account holder. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| /* | ||
| * The version of the OpenAPI document: v2 | ||
| * | ||
| * | ||
| * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
| * https://openapi-generator.tech | ||
| * Do not edit this class manually. | ||
| */ | ||
|
|
||
|
|
||
| import getJsonResponse from "../../helpers/getJsonResponse"; | ||
| import Service from "../../service"; | ||
| import Client from "../../client"; | ||
| import { IRequest } from "../../typings/requestOptions"; | ||
| import Resource from "../resource"; | ||
|
|
||
| import { ObjectSerializer } from "../../typings/balancePlatform/objectSerializer"; | ||
| import { ListMandatesResponse } from "../../typings/balancePlatform/models"; | ||
| import { Mandate } from "../../typings/balancePlatform/models"; | ||
| import { PatchableMandate } from "../../typings/balancePlatform/models"; | ||
|
|
||
| /** | ||
| * API handler for DirectDebitMandatesApi | ||
| */ | ||
| export class DirectDebitMandatesApi extends Service { | ||
|
|
||
| private readonly API_BASEPATH: string = "https://balanceplatform-api-test.adyen.com/bcl/v2"; | ||
| private baseUrl: string; | ||
|
|
||
| public constructor(client: Client){ | ||
| super(client); | ||
| this.baseUrl = this.createBaseUrl(this.API_BASEPATH); | ||
| } | ||
|
|
||
| /** | ||
| * @summary Cancel a mandate | ||
| * @param mandateId {@link string } The unique identifier of the mandate. | ||
| * @param requestOptions {@link IRequest.Options } | ||
| * @return {@link void } | ||
| */ | ||
| public async cancelMandate(mandateId: string, requestOptions?: IRequest.Options): Promise<void> { | ||
| const endpoint = `${this.baseUrl}/mandates/{mandateId}/cancel` | ||
| .replace("{" + "mandateId" + "}", encodeURIComponent(String(mandateId))); | ||
| const resource = new Resource(this, endpoint); | ||
|
|
||
| await getJsonResponse<string, void>( | ||
| resource, | ||
| "", | ||
| { ...requestOptions, method: "POST" } | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * @summary Get a list of mandates | ||
| * @param requestOptions {@link IRequest.Options } | ||
| * @param balanceAccountId {@link string } The unique identifier of the balance account linked to the payment instrument. | ||
| * @param paymentInstrumentId {@link string } The unique identifier of the payment instrument linked to the mandate. | ||
| * @param cursor {@link string } The pagination cursor returned in a previous GET `/mandates` request. | ||
| * @return {@link ListMandatesResponse } | ||
| */ | ||
| public async getListOfMandates(balanceAccountId?: string, paymentInstrumentId?: string, cursor?: string, requestOptions?: IRequest.Options): Promise<ListMandatesResponse> { | ||
| const endpoint = `${this.baseUrl}/mandates`; | ||
| const resource = new Resource(this, endpoint); | ||
|
|
||
| const hasDefinedQueryParams = balanceAccountId ?? paymentInstrumentId ?? cursor; | ||
| if(hasDefinedQueryParams) { | ||
| if(!requestOptions) requestOptions = {}; | ||
| if(!requestOptions.params) requestOptions.params = {}; | ||
| if(balanceAccountId) requestOptions.params["balanceAccountId"] = balanceAccountId; | ||
| if(paymentInstrumentId) requestOptions.params["paymentInstrumentId"] = paymentInstrumentId; | ||
| if(cursor) requestOptions.params["cursor"] = cursor; | ||
| } | ||
| const response = await getJsonResponse<string, ListMandatesResponse>( | ||
| resource, | ||
| "", | ||
| { ...requestOptions, method: "GET" } | ||
| ); | ||
|
|
||
| return ObjectSerializer.deserialize(response, "ListMandatesResponse"); | ||
| } | ||
|
|
||
| /** | ||
| * @summary Get a specific mandate | ||
| * @param mandateId {@link string } The unique identifier of the mandate. | ||
| * @param requestOptions {@link IRequest.Options } | ||
| * @return {@link Mandate } | ||
| */ | ||
| public async getMandateById(mandateId: string, requestOptions?: IRequest.Options): Promise<Mandate> { | ||
| const endpoint = `${this.baseUrl}/mandates/{mandateId}` | ||
| .replace("{" + "mandateId" + "}", encodeURIComponent(String(mandateId))); | ||
| const resource = new Resource(this, endpoint); | ||
|
|
||
| const response = await getJsonResponse<string, Mandate>( | ||
| resource, | ||
| "", | ||
| { ...requestOptions, method: "GET" } | ||
| ); | ||
|
|
||
| return ObjectSerializer.deserialize(response, "Mandate"); | ||
| } | ||
|
|
||
| /** | ||
| * @summary Amend a mandate | ||
| * @param mandateId {@link string } The unique identifier of the mandate. | ||
| * @param patchableMandate {@link PatchableMandate } | ||
| * @param requestOptions {@link IRequest.Options } | ||
| * @return {@link void } | ||
| */ | ||
| public async updateMandate(mandateId: string, patchableMandate: PatchableMandate, requestOptions?: IRequest.Options): Promise<void> { | ||
| const endpoint = `${this.baseUrl}/mandates/{mandateId}` | ||
| .replace("{" + "mandateId" + "}", encodeURIComponent(String(mandateId))); | ||
| const resource = new Resource(this, endpoint); | ||
|
|
||
| const request: PatchableMandate = ObjectSerializer.serialize(patchableMandate, "PatchableMandate"); | ||
| await getJsonResponse<PatchableMandate, void>( | ||
| resource, | ||
| request, | ||
| { ...requestOptions, method: "PATCH" } | ||
| ); | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * The version of the OpenAPI document: v2 | ||
| * | ||
| * | ||
| * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
| * https://openapi-generator.tech | ||
| * Do not edit this class manually. | ||
| */ | ||
|
|
||
| import { Link } from "./link"; | ||
| import { Mandate } from "./mandate"; | ||
|
|
||
|
|
||
| export class ListMandatesResponse { | ||
| "link": Link; | ||
| /** | ||
| * Contains a list of the mandates. | ||
| */ | ||
| "mandates": Array<Mandate>; | ||
|
|
||
| static readonly discriminator: string | undefined = undefined; | ||
|
|
||
| static readonly mapping: {[index: string]: string} | undefined = undefined; | ||
|
|
||
| static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ | ||
| { | ||
| "name": "link", | ||
| "baseName": "link", | ||
| "type": "Link", | ||
| "format": "" | ||
| }, | ||
| { | ||
| "name": "mandates", | ||
| "baseName": "mandates", | ||
| "type": "Array<Mandate>", | ||
| "format": "" | ||
| } ]; | ||
|
|
||
| static getAttributeTypeMap() { | ||
| return ListMandatesResponse.attributeTypeMap; | ||
| } | ||
|
|
||
| public constructor() { | ||
| } | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| /* | ||
| * The version of the OpenAPI document: v2 | ||
| * | ||
| * | ||
| * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
| * https://openapi-generator.tech | ||
| * Do not edit this class manually. | ||
| */ | ||
|
|
||
| import { MandateBankAccount } from "./mandateBankAccount"; | ||
| import { MandateStatus } from "./mandateStatus"; | ||
| import { MandateType } from "./mandateType"; | ||
|
|
||
|
|
||
| export class Mandate { | ||
| /** | ||
| * The unique identifier of the balance account linked to the payment instrument. | ||
| */ | ||
| "balanceAccountId"?: string; | ||
| "counterparty"?: MandateBankAccount | null; | ||
| /** | ||
| * The date when the mandate was created. | ||
| */ | ||
| "createdAt"?: Date; | ||
| /** | ||
| * The unique identifier of the mandate. | ||
| */ | ||
| "id"?: string; | ||
| /** | ||
| * The unique identifier of the payment instrument linked to the mandate. | ||
| */ | ||
| "paymentInstrumentId"?: string; | ||
| "status"?: MandateStatus; | ||
| "type"?: MandateType; | ||
| /** | ||
| * The date when the mandate was updated. | ||
| */ | ||
| "updatedAt"?: Date; | ||
|
|
||
| static readonly discriminator: string | undefined = undefined; | ||
|
|
||
| static readonly mapping: {[index: string]: string} | undefined = undefined; | ||
|
|
||
| static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ | ||
| { | ||
| "name": "balanceAccountId", | ||
| "baseName": "balanceAccountId", | ||
| "type": "string", | ||
| "format": "" | ||
| }, | ||
| { | ||
| "name": "counterparty", | ||
| "baseName": "counterparty", | ||
| "type": "MandateBankAccount | null", | ||
| "format": "" | ||
| }, | ||
| { | ||
| "name": "createdAt", | ||
| "baseName": "createdAt", | ||
| "type": "Date", | ||
| "format": "date-time" | ||
| }, | ||
| { | ||
| "name": "id", | ||
| "baseName": "id", | ||
| "type": "string", | ||
| "format": "" | ||
| }, | ||
| { | ||
| "name": "paymentInstrumentId", | ||
| "baseName": "paymentInstrumentId", | ||
| "type": "string", | ||
| "format": "" | ||
| }, | ||
| { | ||
| "name": "status", | ||
| "baseName": "status", | ||
| "type": "MandateStatus", | ||
| "format": "" | ||
| }, | ||
| { | ||
| "name": "type", | ||
| "baseName": "type", | ||
| "type": "MandateType", | ||
| "format": "" | ||
| }, | ||
| { | ||
| "name": "updatedAt", | ||
| "baseName": "updatedAt", | ||
| "type": "Date", | ||
| "format": "date-time" | ||
| } ]; | ||
|
|
||
| static getAttributeTypeMap() { | ||
| return Mandate.attributeTypeMap; | ||
| } | ||
|
|
||
| public constructor() { | ||
| } | ||
| } | ||
|
|
||
| export namespace Mandate { | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better type safety and to align with the JSDoc, which states accepted values are
US1099kandUS1099nec, theformTypeparameter should be typed as a string literal union instead of a genericstring. This is consistent with other methods in this API, likegetTaxForm.