xendit / xendit-node

Xendit REST API Client for Node.js - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets, QR Codes, Direct Debit

Home Page:https://developers.xendit.co/api-reference/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type not specific enough for getPaymentsByPaymentMethodId

devcsrj opened this issue · comments

/**
* Returns payments with matching PaymentMethodID.
* Returns payments with matching PaymentMethodID.
*/
async getPaymentsByPaymentMethodId(requestParameters: GetPaymentsByPaymentMethodIdRequest): Promise<object> {
const response = await this.getPaymentsByPaymentMethodIdRaw(requestParameters);
return await response.value();
}

Notice that the return type is object. Was expecting a proper type. Here's a sample payload I got:

{
  data: [
    {
      amount: 20.58,
      business_id: '65758dd48ce3112f63c41f2c',
      channel_code: 'QRPH',
      country: 'PH',
      created: '2024-06-05T10:24:47.265313Z',
      currency: 'PHP',
      id: 'pymt-12c3b34a-1343-4958-a2c0-011b4c61dc8f',
      instrument_id: 'qrpy_b04be677-82f9-40a1-9967-bfa8d7e72779',
      payment_detail: [Object],
      payment_method: [Object],
      payment_request_id: 'pr-dbede44c-25c3-4bd8-8188-2c8d2026928a',
      reference_id: '7c624c78-523f-4a40-9aed-40ef842d4e7b',
      status: 'SUCCEEDED',
      type: 'QR_CODE',
      updated: '2024-06-05T10:24:47.265313Z'
    }
  ],
  has_more: false,
  links: [
    {
      href: '/v2/payment_methods/pm-9a4fa574-a6f3-419d-ba16-348077337456/payments?limit=10&payment_request_id=pr-dbede44c-25c3-4bd8-8188-2c8d2026928a',
      method: 'GET',
      rel: 'first'
    }
  ]
}