@bebapps/rapyd-sdk
Version:
An un-official [Rapyd](https://rapyd.net) SDK for Node.js.
41 lines (37 loc) • 1.93 kB
text/typescript
import { RapydClient } from '../../../core/RapydClient';
import { PayoutMethodType } from '../types/PayoutMethodType';
import { ListPayoutMethodTypesRequest } from '../requests/ListPayoutMethodTypesRequest';
import { GetPayoutRequiredFieldsRequest } from '../requests/GetPayoutRequiredFieldsRequest';
export async function listPayoutMethodTypes<R = PayoutMethodType>(client: RapydClient, request: ListPayoutMethodTypesRequest): Promise<R> {
const queryParams = client.queryParams({
beneficiary_country: request.beneficiary_country,
beneficiary_entity_type: request.beneficiary_entity_type,
category: request.category,
ending_before: request.ending_before,
is_cancelable: request.is_cancelable,
is_expirable: request.is_expirable,
is_location_specific: request.is_location_specific,
is_online: request.is_online,
limit: request.limit,
payout_currency: request.payout_currency,
sender_entity_type: request.sender_entity_type,
starting_after: request.starting_after,
});
const response = await client.get('/v1/payouts/supported_types' + queryParams);
return await response.data<R, Error>();
}
export async function getPayoutRequiredFields<R = PayoutMethodType>(client: RapydClient, request: GetPayoutRequiredFieldsRequest): Promise<R> {
const queryParams = client.queryParams({
beneficiary_country: request.beneficiary_country,
beneficiary_entity_type: request.beneficiary_entity_type,
identifier_type: request.identifier_type,
identifier_value: request.identifier_value,
payout_amount: request.payout_amount,
payout_currency: request.payout_currency,
sender_country: request.sender_country,
sender_currency: request.sender_currency,
sender_entity_type: request.sender_entity_type,
});
const response = await client.get('/v1/payouts/{}/details' + queryParams, request.payout_method_type);
return await response.data<R, Error>();
}