xendit / xendit-php

Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services, xenPlatforms
https://developers.xendit.co/api-reference/
MIT License
153 stars 76 forks source link

Wrong invoice retreive paramater type #123

Closed habibimustafa closed 3 years ago

habibimustafa commented 3 years ago

Hello.

I think the id type on Retreive file should be string, because the xendit id pattern is like 579c8d61f23fa4ca35e52da4 (I got sample id from this link)

We got error on psalm check like this:

ERROR: InvalidScalarArgument - XenditInvoiceService.php:88:42 - Argument 1 of Xendit\Invoice::retrieve expects int|null, string provided (see https://psalm.dev/012)
        return \Xendit\Invoice::retrieve($xenditId);

and, this is the code that has to be changed:

trait Retrieve
{
    /**
     * Send GET request to retrieve data
     *
     * @param int|null $id ID    // << i think this is should be string|null
     *
     * @return array
     */
    public static function retrieve($id)
stanleynguyen commented 3 years ago

Fixed in latest 2.9.1 https://packagist.org/packages/xendit/xendit-php

habibimustafa commented 3 years ago

Thank you @stanleynguyen