omise / omise-node

Omise Node.js Library
https://docs.opn.ooo
102 stars 53 forks source link

Add missing recipients.create type #218

Open chuwong35122 opened 4 months ago

chuwong35122 commented 4 months ago

Expected behavior

According to this documentation, bank_account.number existed and is a required value for recipients creation. This is the expected code (with no errors).

const recp = await omise.recipients.create({
    name: "Somchai Prasert",
    email: "somchai.prasert@example.com",
    type: "individual",
    bank_account: {
      brand: "bbl",
      number: "1234567890",
      name: "SOMCHAI PRASERT",
    },
  });

  console.log(recp);

Actual behavior

Upon completing the omise.recipients.create 's parameter, the following type error occurs...

Object literal may only specify known properties, and 'number' does not exist in type 'IBankAccount'.ts(2353) index.d.ts(621, 7): The expected type comes from property 'bank_account' which is declared here on type 'IRequest'

The IBankAccount object type is missing its number property.

Update: It seems like the Omise.Recipients object type is missing several attributes written in the documentation.

interface IRequest {
      name: string;
      email?: string;
      description?: string;
      type: string;
      tax_id?: string;
      bank_account: IBankAccount;
      metadata?: { [key: string]: any };
    }

  interface IBankAccount {
    object: string;
    brand: string;
    last_digits: string;
    name: string;
    created: string;
  }

Steps to reproduce the issue

Using "omise": "^0.12.1" installed using bun

Logs

This is only a type error, filling complate type ensures good developer experiences.

Screenshots

No response

Name and version information

bun --version: 1.1.3 node --version: v20.10.0

Using Macbook Air M1 ❯ sw_vers ProductName: macOS ProductVersion: 14.0 BuildVersion: 23A344

❯ uname Darwin

aashishgurung commented 3 months ago

@chuwong35122 Thank you for reaching out. We are aware of this issue and working on it. We will provide an update when we resolve this. Thank you.