mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2025-07-22 14:30:51 -04:00
convert form id to payment method string with validation
This commit is contained in:
parent
9fd95e81f6
commit
0266147d74
3 changed files with 84 additions and 54 deletions
|
@ -860,11 +860,12 @@ export default class HavenoClient {
|
|||
/**
|
||||
* Get a form for the given payment method to complete and create a new payment account.
|
||||
*
|
||||
* @param {string} paymentMethodId - the id of the payment method
|
||||
* @param {string | PaymentAccountForm.FormId} paymentMethodId - the id of the payment method
|
||||
* @return {PaymentAccountForm} the payment account form
|
||||
*/
|
||||
async getPaymentAccountForm(paymentMethodId: string): Promise<PaymentAccountForm> {
|
||||
async getPaymentAccountForm(paymentMethodId: string | PaymentAccountForm.FormId): Promise<PaymentAccountForm> {
|
||||
try {
|
||||
paymentMethodId = HavenoUtils.getPaymentMethodId(paymentMethodId); // validate and normalize
|
||||
return (await this._paymentAccountsClient.getPaymentAccountForm(new GetPaymentAccountFormRequest().setPaymentMethodId(paymentMethodId), {password: this._password})).getPaymentAccountForm()!;
|
||||
} catch (e: any) {
|
||||
throw new HavenoError(e.message, e.code);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue