Closed aldy505 closed 2 years ago
Hi @aldy505 this seems neat, we appreciate all the effort on this contribution 😃 Solid idea & reason.
Let us check and assess first, once we are available. But anyway as long as it only give "additional-options" for TS user (instead of "forcing" anything), does not break, and does not introduce possible maintenance burden, I think this will be fine.
Looks like we gonna need a while to properly think about this, since it would means the API's JSON payload's attribute types is statically-defined (for example here). The JSON payload changes a lot, i.e: in case new payment method is added or API is enhanced. Which means the type definition will need to be adjusted immediately for each time API payload changes.
This feels like a "tight-coupling" between the API and this NodeJS client, one change in API require immediate changes in this NodeJS client. This might add maintenance burden. This point slightly mentioned in the other gh-issue as well.
Since this gonna take a while to consider, feel free if you plan to fork this and modify it to release as its own Typescript-friendly-NPM package. We can acknowledge that within our docs as Community Contribution package.
It's nearly been a year. I'm closing this PR.
Changed / Added
tsconfig.json
and installed some dependencies onpackage.json
Why did I created this
I got some potential clients that need a website with an e-commerce feature. Some of the website builders out there don't really support Midtrans (unless it's WordPress/Squarespace), so when a developer needs to make a backend server with Typescript, they won't be stressed for the missing definition file error.
I read past issues on this repository, I think it's better to just create a bundled definition file rather than rewriting the project in Typescript.
This is pretty much ready to use definition file. To test the file, use typescript files that are included in the
example
folder (but not the Express App).If there are any questions, feedback, or anything, please let me know. Kalau mau pake bahasa Indonesia juga boleh😁