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

Report and point and webhook not upadted with the documentation and typescript validation #391

Open Akta3d opened 8 months ago

Akta3d commented 8 months ago

To create a wallet report on a javascript project I use these columns list :

        'Id',
        'Tag',
        'CreationDate',
        'Owners',
        'Description',
        'BalanceAmount',
        'BalanceCurrency',
        'FundsType',

on typescript project these columns are not valid from the typescript checking. But If I request these columns (as the typescript types and documentation):

    const reportOptions: MangoPay.report.CreateReport = {
      ReportType: 'WALLETS',
      CallbackURL: `...`,
      DownloadFormat: 'CSV',
      Sort: 'CreationDate:DESC',
      Preview: false,
      Filters: {
        AfterDate: moment().subtract(24, 'months').unix(),
        MinDebitedFundsAmount: 100,
        MinDebitedFundsCurrency: 'EUR',
      } as MangoPay.report.Filters,
      Columns: [
        'Id',
        'Tag',
        'CreationDate',
        'AuthorId',
        'DebitedFundsAmount',
        'CreditedFundsAmount',
        'FeesCurrency',
        'Type',
      ] ,
    };

I have an error

"errors": {
        "Columns": "Invalid column(s): AuthorId, DebitedFundsAmount, CreditedFundsAmount, FeesCurrency, Type"
}

To solve the issue I use previous columns list with any in my code

      Columns: [
        'Id',
        'Tag',
        'CreationDate',
        'Owners',
        'Description',
        'BalanceAmount',
        'BalanceCurrency',
        'FundsType',
      ] as any,

Then when I received the hook, I retreive the RessourceId with : const { Date: date, EventType: eventType, RessourceId: ressourceId } = req.query;

the the query object has no RessourceId but a ResourceId I need to write

  const date = req.query.Date;
  const eventType = req.query.EventType;
  const ressourceId = (req.query as any).ResourceId; // fuc**g MangoPay the query response is ResourceId and not RessourceId on this webhook ????

What I do wrong, or it's buggy.

Tested with mangopay2-nodejs-sdk version 1.31.1 and 1.42.1