Skip to content

Commit

Permalink
add payments.sendRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyn committed May 18, 2023
1 parent 332d432 commit 6682dcd
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 8 deletions.
111 changes: 109 additions & 2 deletions src/api.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// tslint:disable
/**
* MONEI API v1
* <p>The MONEI API is organized around <a href=\"https://en.wikipedia.org/wiki/Representational_State_Transfer\">REST</a>. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.</p> <h4 id=\"base-url\">Base URL:</h4> <p><a href=\"https://api.monei.com/v1\">https://api.monei.com/v1</a></p> <h4 id=\"client-libraries\">Client libraries:</h4> <ul> <li><a href=\"https://github.com/MONEI/monei-php-sdk\">PHP SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-python-sdk\">Python SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-node-sdk\">Node.js SDK</a></li> <li><a href=\"https://postman.monei.com/\">Postman Collection</a></li> </ul> <h4 id=\"important\">Important:</h4> <p><strong>If you are not using our official SDKs, you need to provide a valid <code>User-Agent</code> header in each request, otherwise your requests will be rejected.</strong></p>
* <p>The MONEI API is organized around <a href=\"https://en.wikipedia.org/wiki/Representational_State_Transfer\">REST</a>. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.</p> <h4 id=\"base-url\">Base URL:</h4> <p><a href=\"https://api.monei.com/v1\">https://api.monei.com/v1</a></p> <h4 id=\"client-libraries\">Client libraries:</h4> <ul> <li><a href=\"https://github.com/MONEI/monei-php-sdk\">PHP SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-python-sdk\">Python SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-node-sdk\">Node.js SDK</a></li> <li><a href=\"https://postman.monei.com/\">Postman</a></li> </ul> <h4 id=\"important\">Important:</h4> <p><strong>If you are not using our official SDKs, you need to provide a valid <code>User-Agent</code> header in each request, otherwise your requests will be rejected.</strong></p>
*
* The version of the OpenAPI document: 1.3.3
* The version of the OpenAPI document: 1.4.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down Expand Up @@ -1637,6 +1637,25 @@ export interface SendPaymentReceiptRequest {
*/
language?: PaymentMessageLanguage;
}
/**
*
* @export
* @interface SendPaymentRequest
*/
export interface SendPaymentRequest {
/**
* Phone number in E.164 format. The customer will receive payment link on this phone number.
* @type {string}
* @memberof SendPaymentRequest
*/
phoneNumber?: string;
/**
*
* @type {PaymentMessageLanguage}
* @memberof SendPaymentRequest
*/
language?: PaymentMessageLanguage;
}
/**
*
* @export
Expand Down Expand Up @@ -2617,6 +2636,55 @@ export const PaymentsApiAxiosParamCreator = function (configuration?: Configurat
const needsSerialization = (typeof sendPaymentReceiptRequest !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(sendPaymentReceiptRequest !== undefined ? sendPaymentReceiptRequest : {}) : (sendPaymentReceiptRequest || "");

return {
url: globalImportUrl.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Sends a payment request directly to the customer\'s phone. If Bizum payment method is available and the phone number is registered in Bizum, the customer will get a push notification to confirm the payment directly in the banking app, otherwise, he will receive a link to pay via WhatsApp.
* @summary Send Payment Request
* @param {string} id The payment ID
* @param {SendPaymentRequest} [sendPaymentRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
sendRequest: async (id: string, sendPaymentRequest?: SendPaymentRequest, options: any = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
if (id === null || id === undefined) {
throw new RequiredError('id','Required parameter id was null or undefined when calling sendRequest.');
}
const localVarPath = `/payments/{id}/rtp`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;

// authentication APIKey required
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? await configuration.apiKey("Authorization")
: await configuration.apiKey;
localVarHeaderParameter["Authorization"] = localVarApiKeyValue;
}



localVarHeaderParameter['Content-Type'] = 'application/json';

localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
const needsSerialization = (typeof sendPaymentRequest !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(sendPaymentRequest !== undefined ? sendPaymentRequest : {}) : (sendPaymentRequest || "");

return {
url: globalImportUrl.format(localVarUrlObj),
options: localVarRequestOptions,
Expand Down Expand Up @@ -2764,6 +2832,21 @@ export const PaymentsApiFp = function(configuration?: Configuration) {
return axios.request(axiosRequestArgs);
};
},
/**
* Sends a payment request directly to the customer\'s phone. If Bizum payment method is available and the phone number is registered in Bizum, the customer will get a push notification to confirm the payment directly in the banking app, otherwise, he will receive a link to pay via WhatsApp.
* @summary Send Payment Request
* @param {string} id The payment ID
* @param {SendPaymentRequest} [sendPaymentRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async sendRequest(id: string, sendPaymentRequest?: SendPaymentRequest, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Payment>> {
const localVarAxiosArgs = await PaymentsApiAxiosParamCreator(configuration).sendRequest(id, sendPaymentRequest, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
}
};

Expand Down Expand Up @@ -2870,6 +2953,17 @@ export const PaymentsApiFactory = function (configuration?: Configuration, baseP
sendReceipt(id: string, sendPaymentReceiptRequest?: SendPaymentReceiptRequest, options?: any): AxiosPromise<Payment> {
return PaymentsApiFp(configuration).sendReceipt(id, sendPaymentReceiptRequest, options).then((request) => request(axios, basePath));
},
/**
* Sends a payment request directly to the customer\'s phone. If Bizum payment method is available and the phone number is registered in Bizum, the customer will get a push notification to confirm the payment directly in the banking app, otherwise, he will receive a link to pay via WhatsApp.
* @summary Send Payment Request
* @param {string} id The payment ID
* @param {SendPaymentRequest} [sendPaymentRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
sendRequest(id: string, sendPaymentRequest?: SendPaymentRequest, options?: any): AxiosPromise<Payment> {
return PaymentsApiFp(configuration).sendRequest(id, sendPaymentRequest, options).then((request) => request(axios, basePath));
},
};
};

Expand Down Expand Up @@ -2995,6 +3089,19 @@ export class PaymentsApi extends BaseAPI {
return PaymentsApiFp(this.configuration).sendReceipt(id, sendPaymentReceiptRequest, options).then((request) => request(this.axios, this.basePath));
}

/**
* Sends a payment request directly to the customer\'s phone. If Bizum payment method is available and the phone number is registered in Bizum, the customer will get a push notification to confirm the payment directly in the banking app, otherwise, he will receive a link to pay via WhatsApp.
* @summary Send Payment Request
* @param {string} id The payment ID
* @param {SendPaymentRequest} [sendPaymentRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PaymentsApi
*/
public sendRequest(id: string, sendPaymentRequest?: SendPaymentRequest, options?: any) {
return PaymentsApiFp(this.configuration).sendRequest(id, sendPaymentRequest, options).then((request) => request(this.axios, this.basePath));
}

}


Expand Down
4 changes: 2 additions & 2 deletions src/base.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// tslint:disable
/**
* MONEI API v1
* <p>The MONEI API is organized around <a href=\"https://en.wikipedia.org/wiki/Representational_State_Transfer\">REST</a>. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.</p> <h4 id=\"base-url\">Base URL:</h4> <p><a href=\"https://api.monei.com/v1\">https://api.monei.com/v1</a></p> <h4 id=\"client-libraries\">Client libraries:</h4> <ul> <li><a href=\"https://github.com/MONEI/monei-php-sdk\">PHP SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-python-sdk\">Python SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-node-sdk\">Node.js SDK</a></li> <li><a href=\"https://postman.monei.com/\">Postman Collection</a></li> </ul> <h4 id=\"important\">Important:</h4> <p><strong>If you are not using our official SDKs, you need to provide a valid <code>User-Agent</code> header in each request, otherwise your requests will be rejected.</strong></p>
* <p>The MONEI API is organized around <a href=\"https://en.wikipedia.org/wiki/Representational_State_Transfer\">REST</a>. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.</p> <h4 id=\"base-url\">Base URL:</h4> <p><a href=\"https://api.monei.com/v1\">https://api.monei.com/v1</a></p> <h4 id=\"client-libraries\">Client libraries:</h4> <ul> <li><a href=\"https://github.com/MONEI/monei-php-sdk\">PHP SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-python-sdk\">Python SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-node-sdk\">Node.js SDK</a></li> <li><a href=\"https://postman.monei.com/\">Postman</a></li> </ul> <h4 id=\"important\">Important:</h4> <p><strong>If you are not using our official SDKs, you need to provide a valid <code>User-Agent</code> header in each request, otherwise your requests will be rejected.</strong></p>
*
* The version of the OpenAPI document: 1.3.3
* The version of the OpenAPI document: 1.4.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
4 changes: 2 additions & 2 deletions src/configuration.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// tslint:disable
/**
* MONEI API v1
* <p>The MONEI API is organized around <a href=\"https://en.wikipedia.org/wiki/Representational_State_Transfer\">REST</a>. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.</p> <h4 id=\"base-url\">Base URL:</h4> <p><a href=\"https://api.monei.com/v1\">https://api.monei.com/v1</a></p> <h4 id=\"client-libraries\">Client libraries:</h4> <ul> <li><a href=\"https://github.com/MONEI/monei-php-sdk\">PHP SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-python-sdk\">Python SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-node-sdk\">Node.js SDK</a></li> <li><a href=\"https://postman.monei.com/\">Postman Collection</a></li> </ul> <h4 id=\"important\">Important:</h4> <p><strong>If you are not using our official SDKs, you need to provide a valid <code>User-Agent</code> header in each request, otherwise your requests will be rejected.</strong></p>
* <p>The MONEI API is organized around <a href=\"https://en.wikipedia.org/wiki/Representational_State_Transfer\">REST</a>. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.</p> <h4 id=\"base-url\">Base URL:</h4> <p><a href=\"https://api.monei.com/v1\">https://api.monei.com/v1</a></p> <h4 id=\"client-libraries\">Client libraries:</h4> <ul> <li><a href=\"https://github.com/MONEI/monei-php-sdk\">PHP SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-python-sdk\">Python SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-node-sdk\">Node.js SDK</a></li> <li><a href=\"https://postman.monei.com/\">Postman</a></li> </ul> <h4 id=\"important\">Important:</h4> <p><strong>If you are not using our official SDKs, you need to provide a valid <code>User-Agent</code> header in each request, otherwise your requests will be rejected.</strong></p>
*
* The version of the OpenAPI document: 1.3.3
* The version of the OpenAPI document: 1.4.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// tslint:disable
/**
* MONEI API v1
* <p>The MONEI API is organized around <a href=\"https://en.wikipedia.org/wiki/Representational_State_Transfer\">REST</a>. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.</p> <h4 id=\"base-url\">Base URL:</h4> <p><a href=\"https://api.monei.com/v1\">https://api.monei.com/v1</a></p> <h4 id=\"client-libraries\">Client libraries:</h4> <ul> <li><a href=\"https://github.com/MONEI/monei-php-sdk\">PHP SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-python-sdk\">Python SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-node-sdk\">Node.js SDK</a></li> <li><a href=\"https://postman.monei.com/\">Postman Collection</a></li> </ul> <h4 id=\"important\">Important:</h4> <p><strong>If you are not using our official SDKs, you need to provide a valid <code>User-Agent</code> header in each request, otherwise your requests will be rejected.</strong></p>
* <p>The MONEI API is organized around <a href=\"https://en.wikipedia.org/wiki/Representational_State_Transfer\">REST</a>. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.</p> <h4 id=\"base-url\">Base URL:</h4> <p><a href=\"https://api.monei.com/v1\">https://api.monei.com/v1</a></p> <h4 id=\"client-libraries\">Client libraries:</h4> <ul> <li><a href=\"https://github.com/MONEI/monei-php-sdk\">PHP SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-python-sdk\">Python SDK</a></li> <li><a href=\"https://github.com/MONEI/monei-node-sdk\">Node.js SDK</a></li> <li><a href=\"https://postman.monei.com/\">Postman</a></li> </ul> <h4 id=\"important\">Important:</h4> <p><strong>If you are not using our official SDKs, you need to provide a valid <code>User-Agent</code> header in each request, otherwise your requests will be rejected.</strong></p>
*
* The version of the OpenAPI document: 1.3.3
* The version of the OpenAPI document: 1.4.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down

0 comments on commit 6682dcd

Please sign in to comment.