Skip to content

Commit bc27e9f

Browse files
[capital] Automated update from Adyen/adyen-openapi@2462fa5
1 parent e0c07e0 commit bc27e9f

21 files changed

Lines changed: 545 additions & 53 deletions
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/*
2+
* The version of the OpenAPI document: v1
3+
*
4+
*
5+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
6+
* https://openapi-generator.tech
7+
* Do not edit this class manually.
8+
*/
9+
10+
11+
import getJsonResponse from "../../helpers/getJsonResponse";
12+
import Service from "../../service";
13+
import Client from "../../client";
14+
import { IRequest } from "../../typings/requestOptions";
15+
import Resource from "../resource";
16+
17+
import { ObjectSerializer } from "../../typings/capital/objectSerializer";
18+
import { CalculateGrantOfferRequest } from "../../typings/capital/models";
19+
import { CalculatedGrantOffer } from "../../typings/capital/models";
20+
import { CreateGrantOfferRequest } from "../../typings/capital/models";
21+
import { FinancingType } from "../../typings/capital/models";
22+
import { GetDynamicOffersResponse } from "../../typings/capital/models";
23+
import { GrantOffer } from "../../typings/capital/models";
24+
25+
/**
26+
* API handler for DynamicOffersApi
27+
*/
28+
export class DynamicOffersApi extends Service {
29+
30+
private readonly API_BASEPATH: string = "https://balanceplatform-api-test.adyen.com/capital/v1";
31+
private baseUrl: string;
32+
33+
public constructor(client: Client){
34+
super(client);
35+
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
36+
}
37+
38+
/**
39+
* @summary Calculate a preliminary offer for a selected financing amount
40+
* @param id {@link string } The unique identifier of the dynamic offer from which the user selected the financing amount.
41+
* @param calculateGrantOfferRequest {@link CalculateGrantOfferRequest }
42+
* @param requestOptions {@link IRequest.Options }
43+
* @return {@link CalculatedGrantOffer }
44+
*/
45+
public async calculatePreliminaryOfferFromDynamicOffer(id: string, calculateGrantOfferRequest: CalculateGrantOfferRequest, requestOptions?: IRequest.Options): Promise<CalculatedGrantOffer> {
46+
const endpoint = `${this.baseUrl}/dynamicOffers/{id}/calculate`
47+
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
48+
const resource = new Resource(this, endpoint);
49+
50+
const request: CalculateGrantOfferRequest = ObjectSerializer.serialize(calculateGrantOfferRequest, "CalculateGrantOfferRequest");
51+
const response = await getJsonResponse<CalculateGrantOfferRequest, CalculatedGrantOffer>(
52+
resource,
53+
request,
54+
{ ...requestOptions, method: "POST" }
55+
);
56+
57+
return ObjectSerializer.deserialize(response, "CalculatedGrantOffer");
58+
}
59+
60+
/**
61+
* @summary Create a static offer for a selected financing amount
62+
* @param id {@link string } The unique identifier of the dynamic offer from which the user selected the financing amount.
63+
* @param createGrantOfferRequest {@link CreateGrantOfferRequest }
64+
* @param requestOptions {@link IRequest.Options }
65+
* @return {@link GrantOffer }
66+
*/
67+
public async createStaticOfferFromDynamicOffer(id: string, createGrantOfferRequest: CreateGrantOfferRequest, requestOptions?: IRequest.Options): Promise<GrantOffer> {
68+
const endpoint = `${this.baseUrl}/dynamicOffers/{id}/grantOffer`
69+
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
70+
const resource = new Resource(this, endpoint);
71+
72+
const request: CreateGrantOfferRequest = ObjectSerializer.serialize(createGrantOfferRequest, "CreateGrantOfferRequest");
73+
const response = await getJsonResponse<CreateGrantOfferRequest, GrantOffer>(
74+
resource,
75+
request,
76+
{ ...requestOptions, method: "POST" }
77+
);
78+
79+
return ObjectSerializer.deserialize(response, "GrantOffer");
80+
}
81+
82+
/**
83+
* @summary Get all available dynamic offers
84+
* @param requestOptions {@link IRequest.Options }
85+
* @param accountHolderId {@link string } (Required) The unique identifier of the account holder that the dynamic offer is for.
86+
* @param financingType {@link FinancingType } The type of financing that the offer is for. If the value is not specified, returns all available types. Possible values: **businessFinancing**
87+
* @return {@link GetDynamicOffersResponse }
88+
*/
89+
public async getAllDynamicOffers(accountHolderId: string, financingType?: FinancingType, requestOptions?: IRequest.Options): Promise<GetDynamicOffersResponse> {
90+
const endpoint = `${this.baseUrl}/dynamicOffers`;
91+
const resource = new Resource(this, endpoint);
92+
93+
const hasDefinedQueryParams = accountHolderId ?? financingType;
94+
if(hasDefinedQueryParams) {
95+
if(!requestOptions) requestOptions = {};
96+
if(!requestOptions.params) requestOptions.params = {};
97+
if(accountHolderId) requestOptions.params["accountHolderId"] = accountHolderId;
98+
if(financingType) requestOptions.params["financingType"] = financingType;
99+
}
100+
const response = await getJsonResponse<string, GetDynamicOffersResponse>(
101+
resource,
102+
"",
103+
{ ...requestOptions, method: "GET" }
104+
);
105+
106+
return ObjectSerializer.deserialize(response, "GetDynamicOffersResponse");
107+
}
108+
109+
}

src/services/capital/grantOffersApi.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ export class GrantOffersApi extends Service {
3232
}
3333

3434
/**
35-
* @summary Get all available grant offers
35+
* @summary Get all available static offers
3636
* @param requestOptions {@link IRequest.Options }
37-
* @param accountHolderId {@link string } The unique identifier of the account holder for which you want to get the available grant offers.
37+
* @param accountHolderId {@link string } (Required) The unique identifier of the account holder for which you want to get the available static offers.
3838
* @return {@link GrantOffers }
3939
*/
40-
public async getAllGrantOffers(accountHolderId?: string, requestOptions?: IRequest.Options): Promise<GrantOffers> {
40+
public async getAllGrantOffers(accountHolderId: string, requestOptions?: IRequest.Options): Promise<GrantOffers> {
4141
const endpoint = `${this.baseUrl}/grantOffers`;
4242
const resource = new Resource(this, endpoint);
4343

@@ -57,8 +57,8 @@ export class GrantOffersApi extends Service {
5757
}
5858

5959
/**
60-
* @summary Get the details of a grant offer
61-
* @param id {@link string } The unique identifier of the grant offer.
60+
* @summary Get the details of a static offer
61+
* @param id {@link string } The unique identifier of the static offer.
6262
* @param requestOptions {@link IRequest.Options }
6363
* @return {@link GrantOffer }
6464
*/

src/services/capital/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Do not edit this class manually.
88
*/
99

10+
import { DynamicOffersApi } from "./dynamicOffersApi";
1011
import { GrantAccountsApi } from "./grantAccountsApi";
1112
import { GrantOffersApi } from "./grantOffersApi";
1213
import { GrantsApi } from "./grantsApi";
@@ -20,6 +21,10 @@ export default class CapitalAPI extends Service {
2021
super(client);
2122
}
2223

24+
public get DynamicOffersApi() {
25+
return new DynamicOffersApi(this.client);
26+
}
27+
2328
public get GrantAccountsApi() {
2429
return new GrantAccountsApi(this.client);
2530
}

src/typings/capital/additionalBankIdentification.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77
* Do not edit this class manually.
88
*/
99

10-
import { AdditionalBankIdentificationTypes } from "./additionalBankIdentificationTypes";
11-
1210

1311
export class AdditionalBankIdentification {
1412
/**
1513
* The value of the additional bank identification.
1614
*/
1715
"code"?: string;
18-
"type"?: AdditionalBankIdentificationTypes;
16+
/**
17+
* The type of additional bank identification, depending on the country. Possible values: * **auBsbCode**: The 6-digit [Australian Bank State Branch (BSB) code](https://en.wikipedia.org/wiki/Bank_state_branch), without separators or spaces. * **caRoutingNumber**: The 9-digit [Canadian routing number](https://en.wikipedia.org/wiki/Routing_number_(Canada)), in EFT format, without separators or spaces. * **gbSortCode**: The 6-digit [UK sort code](https://en.wikipedia.org/wiki/Sort_code), without separators or spaces * **usRoutingNumber**: The 9-digit [routing number](https://en.wikipedia.org/wiki/ABA_routing_transit_number), without separators or spaces.
18+
*/
19+
"type"?: AdditionalBankIdentification.TypeEnum;
1920

2021
static readonly discriminator: string | undefined = undefined;
2122

@@ -31,7 +32,7 @@ export class AdditionalBankIdentification {
3132
{
3233
"name": "type",
3334
"baseName": "type",
34-
"type": "AdditionalBankIdentificationTypes",
35+
"type": "AdditionalBankIdentification.TypeEnum",
3536
"format": ""
3637
} ];
3738

@@ -44,4 +45,10 @@ export class AdditionalBankIdentification {
4445
}
4546

4647
export namespace AdditionalBankIdentification {
48+
export enum TypeEnum {
49+
AuBsbCode = 'auBsbCode',
50+
CaRoutingNumber = 'caRoutingNumber',
51+
GbSortCode = 'gbSortCode',
52+
UsRoutingNumber = 'usRoutingNumber'
53+
}
4754
}

src/typings/capital/additionalBankIdentificationTypes.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* The version of the OpenAPI document: v1
3+
*
4+
*
5+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
6+
* https://openapi-generator.tech
7+
* Do not edit this class manually.
8+
*/
9+
10+
import { Amount } from "./amount";
11+
12+
13+
export class CalculateGrantOfferRequest {
14+
"amount": Amount;
15+
16+
static readonly discriminator: string | undefined = undefined;
17+
18+
static readonly mapping: {[index: string]: string} | undefined = undefined;
19+
20+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
21+
{
22+
"name": "amount",
23+
"baseName": "amount",
24+
"type": "Amount",
25+
"format": ""
26+
} ];
27+
28+
static getAttributeTypeMap() {
29+
return CalculateGrantOfferRequest.attributeTypeMap;
30+
}
31+
32+
public constructor() {
33+
}
34+
}
35+
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
* The version of the OpenAPI document: v1
3+
*
4+
*
5+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
6+
* https://openapi-generator.tech
7+
* Do not edit this class manually.
8+
*/
9+
10+
import { Amount } from "./amount";
11+
import { GrantOfferFee } from "./grantOfferFee";
12+
import { Repayment } from "./repayment";
13+
14+
15+
export class CalculatedGrantOffer {
16+
/**
17+
* The unique identifier of the account holder that the dynamic offer is for.
18+
*/
19+
"accountHolderId": string;
20+
"amount": Amount;
21+
/**
22+
* The contract type of the offer. Possible values: * **loan** * **cashAdvance**
23+
*/
24+
"contractType": CalculatedGrantOffer.ContractTypeEnum;
25+
/**
26+
* The expiration date and time of the offer validity period.
27+
*/
28+
"expiresAt": Date;
29+
"fee": GrantOfferFee;
30+
"repayment": Repayment;
31+
/**
32+
* The starting date and time of the offer validity period.
33+
*/
34+
"startsAt": Date;
35+
36+
static readonly discriminator: string | undefined = undefined;
37+
38+
static readonly mapping: {[index: string]: string} | undefined = undefined;
39+
40+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
41+
{
42+
"name": "accountHolderId",
43+
"baseName": "accountHolderId",
44+
"type": "string",
45+
"format": ""
46+
},
47+
{
48+
"name": "amount",
49+
"baseName": "amount",
50+
"type": "Amount",
51+
"format": ""
52+
},
53+
{
54+
"name": "contractType",
55+
"baseName": "contractType",
56+
"type": "CalculatedGrantOffer.ContractTypeEnum",
57+
"format": ""
58+
},
59+
{
60+
"name": "expiresAt",
61+
"baseName": "expiresAt",
62+
"type": "Date",
63+
"format": "date-time"
64+
},
65+
{
66+
"name": "fee",
67+
"baseName": "fee",
68+
"type": "GrantOfferFee",
69+
"format": ""
70+
},
71+
{
72+
"name": "repayment",
73+
"baseName": "repayment",
74+
"type": "Repayment",
75+
"format": ""
76+
},
77+
{
78+
"name": "startsAt",
79+
"baseName": "startsAt",
80+
"type": "Date",
81+
"format": "date-time"
82+
} ];
83+
84+
static getAttributeTypeMap() {
85+
return CalculatedGrantOffer.attributeTypeMap;
86+
}
87+
88+
public constructor() {
89+
}
90+
}
91+
92+
export namespace CalculatedGrantOffer {
93+
export enum ContractTypeEnum {
94+
CashAdvance = 'cashAdvance',
95+
Loan = 'loan'
96+
}
97+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* The version of the OpenAPI document: v1
3+
*
4+
*
5+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
6+
* https://openapi-generator.tech
7+
* Do not edit this class manually.
8+
*/
9+
10+
import { Amount } from "./amount";
11+
12+
13+
export class CreateGrantOfferRequest {
14+
"amount": Amount;
15+
16+
static readonly discriminator: string | undefined = undefined;
17+
18+
static readonly mapping: {[index: string]: string} | undefined = undefined;
19+
20+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
21+
{
22+
"name": "amount",
23+
"baseName": "amount",
24+
"type": "Amount",
25+
"format": ""
26+
} ];
27+
28+
static getAttributeTypeMap() {
29+
return CreateGrantOfferRequest.attributeTypeMap;
30+
}
31+
32+
public constructor() {
33+
}
34+
}
35+

src/typings/capital/disbursementRepayment.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export class DisbursementRepayment {
1313
* The percentage of your user\'s incoming net volume that is deducted for repaying the grant. The percentage expressed in [basis points](https://www.investopedia.com/terms/b/basispoint.asp).
1414
*/
1515
"basisPoints": number;
16+
/**
17+
* @deprecated
18+
*/
1619
"updateDescription": string;
1720

1821
static readonly discriminator: string | undefined = undefined;

0 commit comments

Comments
 (0)