Mangopay / mangopay2-nodejs-sdk

Node.js SDK for MANGOPAY
https://www.npmjs.com/package/mangopay2-nodejs-sdk
MIT License
51 stars 38 forks source link

Cannot create bank account #356

Closed cedvdb closed 1 year ago

cedvdb commented 1 year ago

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);
cedvdb commented 1 year ago

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