Skip to content

Commit 612c90b

Browse files
[capital] Automated update from Adyen/adyen-openapi@d422828
1 parent 4235009 commit 612c90b

64 files changed

Lines changed: 3566 additions & 1151 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Adyen/Capital/Client/ClientUtils.cs

Lines changed: 84 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
/*
22
* Capital API
33
*
4-
* The Capital API provides endpoints for embedding Adyen Capital into your [marketplace](https://docs.adyen.com/platforms/capital) or [platform](https://docs.adyen.com/platforms/capital). With Capital, you can offer business financing to your users as grants. When a user receives a grant, they must repay the grant amount in a specified term, in addition to paying a fee for using this service. With these endpoints, you can: - **Get available grant offers**: You can get the grant offers that are available for your users. Adyen configures the financing amount, the fee, and the repayment conditions for each offer. These configurations are based on proactive risk analyses that Adyen performs on your users. - **Make requests for grants**: When a user selects a grant offer, you can make a request for the grant on their behalf. - **Get information about your grant account**: Your grant account tracks the information of all grants in your marketplace or platform. ## Authentication Each request made to the Capital API must be signed with an API key. Generate an API key in your Customer Area. To connect to the API, add an `X-API-Key` header with the API key as the value, for example: ``` curl -H \"Content-Type: application/json\" \\ -H \"X-API-Key: YOUR_API_KEY\" \\ ... ``` ## Roles and permissions To use the Capital API, your API credential must have the following roles: - **Balance_Platform_Capital_Configuration_Role** - **Balance_Platform_Capital_Grant_Initiation_Role** Reach out to your Adyen contact to set up these roles. ## Going live When going live, generate an API key in your [live Customer Area](https://ca-live.adyen.com/ca). You can then use the API key to send requests to `https://balanceplatform-api-live.adyen.com/capital/v{version}`.
4+
* The Capital API provides endpoints for embedding [Adyen Capital](https://docs.adyen.com/capital) into your marketplace or platform. With Capital, you can offer business financing to your users as grants. When a user receives a grant, they must repay the grant amount in a specified term, in addition to paying a fee for using this service. With these endpoints, you can: - **Get available financing offers**: You can get a list of offers with fixed amounts or a range of available financing for your users. Adyen configures the financing amount, the fee, and the repayment conditions for each offer. These configurations are based on proactive risk analyses that Adyen performs on your users. - **Make requests for grants**: When a user selects a financing offer, you can make a request for the grant on their behalf. - **Get information about your grant account**: Your grant account tracks the information of all grants in your marketplace or platform. ## Authentication Each request made to the Capital API must be signed with an API key. Generate an API key in your Customer Area. To connect to the API, add an `X-API-Key` header with the API key as the value, for example: ``` curl -H \"Content-Type: application/json\" \\ -H \"X-API-Key: YOUR_API_KEY\" \\ ... ``` ## Roles and permissions To use the Capital API, your API credential must have the following roles: - **Balance_Platform_Capital_Configuration_Role** - **Balance_Platform_Capital_Grant_Initiation_Role** Reach out to your Adyen contact to set up these roles. ## Going live When going live, generate an API key in your [live Customer Area](https://ca-live.adyen.com/ca). You can then use the API key to send requests to `https://balanceplatform-api-live.adyen.com/capital/v{version}`.
55
*
66
* The version of the OpenAPI document: 1
7-
* Generated by: https://github.com/openapitools/openapi-generator.git
8-
*/
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
912

1013
#nullable enable
1114

@@ -101,6 +104,8 @@ public static bool TryDeserialize<T>(ref Utf8JsonReader reader, JsonSerializerOp
101104
/// <returns>Formatted string.</returns>
102105
public static string? ParameterToString(object? obj, string? format = ISO8601_DATETIME_FORMAT)
103106
{
107+
if (obj is System.Collections.Specialized.NameValueCollection nameValueCollection)
108+
return BuildQueryString(nameValueCollection);
104109
if (obj is DateTime dateTime)
105110
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
106111
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
@@ -117,10 +122,16 @@ public static bool TryDeserialize<T>(ref Utf8JsonReader reader, JsonSerializerOp
117122
return dateOnly.ToString(format);
118123
if (obj is bool boolean)
119124
return boolean ? "true" : "false";
120-
if (obj is Models.AdditionalBankIdentificationTypes additionalBankIdentificationTypes)
121-
return AdditionalBankIdentificationTypesValueConverter.ToJsonValue(additionalBankIdentificationTypes);
125+
if (obj is Models.AdditionalBankIdentification.TypeEnum additionalBankIdentificationTypeEnum)
126+
return Models.AdditionalBankIdentification.TypeEnum.ToJsonValue(additionalBankIdentificationTypeEnum);
122127
if (obj is Models.CALocalBankAccountType cALocalBankAccountType)
123128
return CALocalBankAccountTypeValueConverter.ToJsonValue(cALocalBankAccountType);
129+
if (obj is Models.CalculatedGrantOffer.ContractTypeEnum calculatedGrantOfferContractTypeEnum)
130+
return Models.CalculatedGrantOffer.ContractTypeEnum.ToJsonValue(calculatedGrantOfferContractTypeEnum);
131+
if (obj is Models.DynamicOffer.ContractTypeEnum dynamicOfferContractTypeEnum)
132+
return Models.DynamicOffer.ContractTypeEnum.ToJsonValue(dynamicOfferContractTypeEnum);
133+
if (obj is Models.FinancingType financingType)
134+
return FinancingTypeValueConverter.ToJsonValue(financingType);
124135
if (obj is Models.FundsCollectionType fundsCollectionType)
125136
return FundsCollectionTypeValueConverter.ToJsonValue(fundsCollectionType);
126137
if (obj is Models.GrantOffer.ContractTypeEnum grantOfferContractTypeEnum)
@@ -140,6 +151,74 @@ public static bool TryDeserialize<T>(ref Utf8JsonReader reader, JsonSerializerOp
140151
return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture);
141152
}
142153

154+
/// <summary>
155+
/// Builds a query string from a <see cref="System.Collections.Specialized.NameValueCollection"/>
156+
/// using minimal percent-encoding that only escapes characters which would break query string
157+
/// structure, while leaving all other characters (including <c>+</c>, <c>/</c>, <c>!</c>) unencoded.
158+
/// <para>
159+
/// This follows RFC 3986 and does not encode sub-delimiters or unreserved characters in
160+
/// query values.
161+
/// </para>
162+
/// </summary>
163+
/// <remarks>
164+
/// The <c>%</c> character is <b>not</b> encoded by this method. If a value contains a
165+
/// literal <c>%</c> that is not part of a percent-encoded sequence (e.g. <c>50%off</c>),
166+
/// the caller must encode it as <c>%25</c> before passing it to this method. This design
167+
/// intentionally preserves already-encoded sequences such as opaque tokens or redirect URLs.
168+
/// </remarks>
169+
/// <param name="parameters">The query string parameters.</param>
170+
/// <returns>A query string (without leading '?').</returns>
171+
internal static string BuildQueryString(System.Collections.Specialized.NameValueCollection parameters)
172+
{
173+
var parts = new List<string>();
174+
foreach (string key in parameters.AllKeys)
175+
{
176+
var value = parameters[key] ?? string.Empty;
177+
// keys are always encoded (must be ASCII identifiers)
178+
var encodedKey = Uri.EscapeDataString(key);
179+
// only encode characters that would break query string structure,
180+
// while preserving sub-delimiters (+, /, !) and non-ASCII via Uri.EscapeDataString
181+
var sb = new System.Text.StringBuilder(value.Length);
182+
for (int i = 0; i < value.Length; i++)
183+
{
184+
char c = value[i];
185+
switch (c)
186+
{
187+
case '&': sb.Append("%26"); break;
188+
case '=': sb.Append("%3D"); break;
189+
case '#': sb.Append("%23"); break;
190+
case ' ': sb.Append("%20"); break;
191+
default:
192+
if (c < 32 || c >= 127)
193+
{
194+
if (char.IsHighSurrogate(c) && i + 1 < value.Length && char.IsLowSurrogate(value[i + 1]))
195+
{
196+
sb.Append(Uri.EscapeDataString(value.Substring(i++, 2)));
197+
}
198+
else if (!char.IsSurrogate(c))
199+
{
200+
sb.Append(Uri.EscapeDataString(c.ToString()));
201+
}
202+
else
203+
{
204+
// Append the Unicode replacement character for unpaired surrogates
205+
// to avoid ArgumentException in some frameworks (e.g. .NET Framework)
206+
sb.Append("%EF%BF%BD");
207+
}
208+
}
209+
else
210+
{
211+
sb.Append(c);
212+
}
213+
break;
214+
}
215+
}
216+
var encodedValue = sb.ToString();
217+
parts.Add(encodedKey + "=" + encodedValue);
218+
}
219+
return string.Join("&", parts);
220+
}
221+
143222
/// <summary>
144223
/// URL encode a string
145224
/// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50

Adyen/Capital/Client/HostConfiguration.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
/*
22
* Capital API
33
*
4-
* The Capital API provides endpoints for embedding Adyen Capital into your [marketplace](https://docs.adyen.com/platforms/capital) or [platform](https://docs.adyen.com/platforms/capital). With Capital, you can offer business financing to your users as grants. When a user receives a grant, they must repay the grant amount in a specified term, in addition to paying a fee for using this service. With these endpoints, you can: - **Get available grant offers**: You can get the grant offers that are available for your users. Adyen configures the financing amount, the fee, and the repayment conditions for each offer. These configurations are based on proactive risk analyses that Adyen performs on your users. - **Make requests for grants**: When a user selects a grant offer, you can make a request for the grant on their behalf. - **Get information about your grant account**: Your grant account tracks the information of all grants in your marketplace or platform. ## Authentication Each request made to the Capital API must be signed with an API key. Generate an API key in your Customer Area. To connect to the API, add an `X-API-Key` header with the API key as the value, for example: ``` curl -H \"Content-Type: application/json\" \\ -H \"X-API-Key: YOUR_API_KEY\" \\ ... ``` ## Roles and permissions To use the Capital API, your API credential must have the following roles: - **Balance_Platform_Capital_Configuration_Role** - **Balance_Platform_Capital_Grant_Initiation_Role** Reach out to your Adyen contact to set up these roles. ## Going live When going live, generate an API key in your [live Customer Area](https://ca-live.adyen.com/ca). You can then use the API key to send requests to `https://balanceplatform-api-live.adyen.com/capital/v{version}`.
4+
* The Capital API provides endpoints for embedding [Adyen Capital](https://docs.adyen.com/capital) into your marketplace or platform. With Capital, you can offer business financing to your users as grants. When a user receives a grant, they must repay the grant amount in a specified term, in addition to paying a fee for using this service. With these endpoints, you can: - **Get available financing offers**: You can get a list of offers with fixed amounts or a range of available financing for your users. Adyen configures the financing amount, the fee, and the repayment conditions for each offer. These configurations are based on proactive risk analyses that Adyen performs on your users. - **Make requests for grants**: When a user selects a financing offer, you can make a request for the grant on their behalf. - **Get information about your grant account**: Your grant account tracks the information of all grants in your marketplace or platform. ## Authentication Each request made to the Capital API must be signed with an API key. Generate an API key in your Customer Area. To connect to the API, add an `X-API-Key` header with the API key as the value, for example: ``` curl -H \"Content-Type: application/json\" \\ -H \"X-API-Key: YOUR_API_KEY\" \\ ... ``` ## Roles and permissions To use the Capital API, your API credential must have the following roles: - **Balance_Platform_Capital_Configuration_Role** - **Balance_Platform_Capital_Grant_Initiation_Role** Reach out to your Adyen contact to set up these roles. ## Going live When going live, generate an API key in your [live Customer Area](https://ca-live.adyen.com/ca). You can then use the API key to send requests to `https://balanceplatform-api-live.adyen.com/capital/v{version}`.
55
*
66
* The version of the OpenAPI document: 1
7-
* Generated by: https://github.com/openapitools/openapi-generator.git
8-
*/
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
912

1013
#nullable enable
1114

@@ -14,7 +17,6 @@
1417
using System.Linq;
1518
using System.Text.Json;
1619
using System.Text.Json.Serialization;
17-
using System.Net.Http;
1820
using Microsoft.Extensions.DependencyInjection;
1921
using Adyen.Capital.Services;
2022
using Adyen.Capital.Client;
@@ -59,8 +61,6 @@ public HostConfiguration(IServiceCollection services)
5961
_jsonOptions.Converters.Add(new AULocalAccountIdentificationJsonConverter());
6062
_jsonOptions.Converters.Add(new ActionJsonConverter());
6163
_jsonOptions.Converters.Add(new AdditionalBankIdentificationJsonConverter());
62-
_jsonOptions.Converters.Add(new AdditionalBankIdentificationTypesJsonConverter());
63-
_jsonOptions.Converters.Add(new AdditionalBankIdentificationTypesNullableJsonConverter());
6464
_jsonOptions.Converters.Add(new AmountJsonConverter());
6565
_jsonOptions.Converters.Add(new BRLocalAccountIdentificationJsonConverter());
6666
_jsonOptions.Converters.Add(new BalanceJsonConverter());
@@ -69,17 +69,25 @@ public HostConfiguration(IServiceCollection services)
6969
_jsonOptions.Converters.Add(new CALocalBankAccountTypeJsonConverter());
7070
_jsonOptions.Converters.Add(new CALocalBankAccountTypeNullableJsonConverter());
7171
_jsonOptions.Converters.Add(new CZLocalAccountIdentificationJsonConverter());
72+
_jsonOptions.Converters.Add(new CalculateGrantOfferRequestJsonConverter());
73+
_jsonOptions.Converters.Add(new CalculatedGrantOfferJsonConverter());
74+
_jsonOptions.Converters.Add(new CreateGrantOfferRequestJsonConverter());
7275
_jsonOptions.Converters.Add(new DKLocalAccountIdentificationJsonConverter());
7376
_jsonOptions.Converters.Add(new DefaultErrorResponseEntityJsonConverter());
7477
_jsonOptions.Converters.Add(new DisbursementJsonConverter());
7578
_jsonOptions.Converters.Add(new DisbursementInfoUpdateJsonConverter());
7679
_jsonOptions.Converters.Add(new DisbursementRepaymentJsonConverter());
7780
_jsonOptions.Converters.Add(new DisbursementRepaymentInfoUpdateJsonConverter());
7881
_jsonOptions.Converters.Add(new DisbursementsJsonConverter());
82+
_jsonOptions.Converters.Add(new DynamicOfferJsonConverter());
83+
_jsonOptions.Converters.Add(new DynamicOfferRepaymentJsonConverter());
7984
_jsonOptions.Converters.Add(new FeeJsonConverter());
85+
_jsonOptions.Converters.Add(new FinancingTypeJsonConverter());
86+
_jsonOptions.Converters.Add(new FinancingTypeNullableJsonConverter());
8087
_jsonOptions.Converters.Add(new FundsCollectionJsonConverter());
8188
_jsonOptions.Converters.Add(new FundsCollectionTypeJsonConverter());
8289
_jsonOptions.Converters.Add(new FundsCollectionTypeNullableJsonConverter());
90+
_jsonOptions.Converters.Add(new GetDynamicOffersResponseJsonConverter());
8391
_jsonOptions.Converters.Add(new GrantJsonConverter());
8492
_jsonOptions.Converters.Add(new GrantAccountJsonConverter());
8593
_jsonOptions.Converters.Add(new GrantCounterpartyJsonConverter());

0 commit comments

Comments
 (0)