naustudio / vn-payments

Various VN Payment Gateways implemented for NodeJS
http://code.naustud.io/vn-payments
Apache License 2.0
134 stars 41 forks source link

Problem with URL in node version 10 #17

Closed hoantran-it closed 5 years ago

hoantran-it commented 5 years ago

I'm facing up this problem in node version 10 and it can be solved like this https://stackoverflow.com/a/52794744

Do we have any update on it. Thank you!

TypeError: _url.URL is not a constructor at OnePay.js:132 at new Promise (<anonymous>) at OnePayInternational.buildCheckoutUrl (OnePay.js:77) at ConfirmPaymentPage._this._redirectToPayemntGateway (ConfirmPaymentPage.js:33) at HTMLUnknownElement.callCallback (react-dom.development.js:147) at Object.invokeGuardedCallbackDev (react-dom.development.js:196) at invokeGuardedCallback (react-dom.development.js:250) at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:265) at executeDispatch (react-dom.development.js:571) at executeDispatchesInOrder (react-dom.development.js:596) at executeDispatchesAndRelease (react-dom.development.js:695) at executeDispatchesAndReleaseTopLevel (react-dom.development.js:704) at forEachAccumulated (react-dom.development.js:676) at runEventsInBatch (react-dom.development.js:844) at runExtractedEventsInBatch (react-dom.development.js:852) at handleTopLevel (react-dom.development.js:5030) at batchedUpdates$1 (react-dom.development.js:21425) at batchedUpdates (react-dom.development.js:2247) at dispatchEvent (react-dom.development.js:5110) at react-dom.development.js:21482 at Object.unstable_runWithPriority (scheduler.development.js:255) at interactiveUpdates$1 (react-dom.development.js:21481) at interactiveUpdates (react-dom.development.js:2268) at dispatchInteractiveEvent (react-dom.development.js:5086)

trongthanh commented 5 years ago

If you can send us a pull request with passed unit tests, we're happy to merge it and publish a new version. Thank you.

hoantran-it commented 5 years ago

@trongthanh This one https://github.com/naustudio/node-vn-payments/pull/18 Please help to check. Thank you!

tttt-conan commented 5 years ago

hi @hoantran-it , which exact version of node 10 you were using? I tested with latest version v10.16.0, but it looked like there is still the URL class in the "url" package.

hoantran-it commented 5 years ago

@tttt-conan It is v10.15.3

tttt-conan commented 5 years ago

I think I know what's wrong here. In the error log, I saw you were calling it from React, which is the front-end side. This package is supposed to be used on the back-end side. You have to write some routes on your back-end to handle the requests. You can check our example here:

https://github.com/naustudio/node-vn-payments/tree/master/example

hoantran-it commented 5 years ago

Oh I suppose this lib for react front-end side, sorry, let me check. Thank you! @tttt-conan