Mangopay/mangopay2-nodejs-sdk

Cannot create bank account

Closed this issue · 1 comments

The ts api allows the following which result in a 500 internal server error.

    const details: bankAccount.IBANDetails = {
      Type: 'IBAN',
      OwnerName: data.ownerName,
      OwnerAddress: {
        AddressLine1: data.address.line1,
        AddressLine2: data.address.line2,
        City: data.address.city,
        Region: data.address.state,
        PostalCode: data.address.zip,
        Country: data.address.country as CountryISO,
      },
      IBAN: data.iban,
    };
    await this._api.Users.createBankAccount(data.userId, details);

The example in /test does not compile

    const details = new models.BankAccount({
      Type: 'IBAN',
      OwnerName: data.ownerName,
      OwnerAddress: {
        AddressLine1: data.address.line1,
        AddressLine2: data.address.line2,
        City: data.address.city,
        Region: data.address.state,
        PostalCode: data.address.zip,
        Country: data.address.country as CountryISO,
      },
      IBAN: data.iban,
    });
    await this._api.Users.createBankAccount(data.userId, details);

The IBAN I was using was incorrect, which returned a 500. Ultimately the error message should be more helpful.