just1and0 / React-Native-Paystack-WebView

πŸ’ΈπŸ’³The package allows you accept payment using paystack and guess what, it doesn't require linking! just install and begin to use πŸš€
https://paystack.com
MIT License
157 stars 102 forks source link

Amount can't have cents & kobo #63

Closed Zeusmist closed 3 years ago

Zeusmist commented 3 years ago

@just1and0 @mosoakinyemi Hi guys, I am trying to use an amount with a fraction. eg ($1.5). Anytime I pass 1.5 (or any decimal number) as the amount, Paystack does not load, but it works fine whenever I use a non-decimal value.

Please I really need a solution to this, as users are supposed to pay a decimal amount.

Thanks guys!

Zeusmist commented 3 years ago

in index.js, Line 70 amount: ${props.amount}00,

Paystack doesn't accept decimal values for amount, instead kobo & cents need to always be included. That's why there's 00 after the amount. This approach does not allow for flexible amounts. I would suggest

amount: ${props.amount}${props.decimalAmount ?? 00}

@just1and0 @mosoakinyemi

mosoakinyemi commented 3 years ago

Hey man, looking into this.

Zeusmist commented 3 years ago

Hey man, looking into this.

Thank you very much

Zeusmist commented 3 years ago

@mosoakinyemi I was able to fix this locally using the following updates to index.js

Line 70: amount: ${props.amount}${props.decimalAmount}, Line 183: decimalAmount: "00",

Line 183, is for setting defaultProps.

do you think it's an okay solution?

mosoakinyemi commented 3 years ago

Yeah, but I’m working on a revamp with some breaking changes that’ll come with a fix for this bug over the weekend.

So if this works for you…that’s fine πŸ™‚.

Cheers! On Fri, Jul 16, 2021 at 5:12 PM David Erinayo Obidu < @.***> wrote:

@mosoakinyemi https://github.com/mosoakinyemi I was able to fix this locally using the following updates to index.js

Line 70: amount: ${props.amount}${props.decimalAmount}, Line 183: decimalAmount: "00",

do you think it's an okay solution?

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/just1and0/React-Native-Paystack-WebView/issues/63#issuecomment-881561517, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ2WKTYHJT6JN5XYM5AJGGLTYBLAHANCNFSM5ALK6ZYQ .

mosoakinyemi commented 3 years ago

cc @rajibola

Zeusmist commented 3 years ago

@mosoakinyemi @rajibola, Hi guys, just popping a little reminder here. 😊😊

mosoakinyemi commented 3 years ago

Lol

mosoakinyemi commented 3 years ago

I'll be deploying an alpha version today (including a fix for this)...would you be willing to test that out? cc @Zeusmist

Zeusmist commented 3 years ago

I'll be deploying an alpha version today (including a fix for this)...would you be willing to test that out? cc @Zeusmist

Yupp

mosoakinyemi commented 3 years ago

Hey man, here's a link to the pre-release, feel free to go through the breaking changes.

I and @just1and0 will deploy to npm shortly.

But this issue has been 100% fixed...πŸ˜…

Screenshot 2021-07-21 at 8 36 47 PM
mosoakinyemi commented 3 years ago

cc @Zeusmist

Zeusmist commented 3 years ago

@mosoakinyemi Thanks a lot for fixing this πŸŽ‰πŸŽ‰, I'm about to test this out.

In my package.json dependency list, I added "react-native-paystack-webview": "https://github.com/just1and0/React-Native-Paystack-WebView.git#90ffc62a8a1e4d4c3d70c589381bdde7ca7365ce",

I assumed that would point to the pre-release version. But I'm getting errors when I run npm install. (I've pasted the error below.)

What's the best way to install this pre-release version?

Also, there's a strong possibility I would be releasing it to production later this week, are there any caveats?

npm ERR! prepareGitDep 1>
npm ERR! prepareGitDep > core-js-pure@3.15.2 postinstall C:\Users\david\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-e9d435cb\node_modules\core-js-pure
npm ERR! prepareGitDep > node -e "try{require('./postinstall')}catch(e){}"
npm ERR! prepareGitDep
npm ERR! prepareGitDep Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
npm ERR! prepareGitDep
npm ERR! prepareGitDep The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
npm ERR! prepareGitDep > https://opencollective.com/core-js
npm ERR! prepareGitDep > https://www.patreon.com/zloirock
npm ERR! prepareGitDep
npm ERR! prepareGitDep Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
npm ERR! prepareGitDep
npm ERR! prepareGitDep
npm ERR! prepareGitDep > react-native-paystack-webview@4.0.0-rc1 prepare C:\Users\david\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-e9d435cb
npm ERR! prepareGitDep > babel --out-dir dist js
npm ERR! prepareGitDep
npm ERR! prepareGitDep
npm ERR! prepareGitDep 2> npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead.
npm ERR! prepareGitDep npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! prepareGitDep npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm ERR! prepareGitDep npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm ERR! prepareGitDep npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm ERR! prepareGitDep 'babel' is not recognized as an internal or external command,
npm ERR! prepareGitDep operable program or batch file.
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! react-native-paystack-webview@4.0.0-rc1 prepare: `babel --out-dir dist js`
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR!
npm ERR! prepareGitDep npm ERR! Failed at the react-native-paystack-webview@4.0.0-rc1 prepare script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     C:\Users\david\AppData\Roaming\npm-cache\_logs\2021-07-26T10_01_51_607Z-debug.log
npm ERR! prepareGitDep
npm ERR! premature close

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\david\AppData\Roaming\npm-cache\_logs\2021-07-26T10_01_52_631Z-debug.log
just1and0 commented 3 years ago

Hey @Zeusmist the release is yet to be published, I hit some hiccup over the weekend with types but @mosoakinyemi and I are done with that. we'd have V4.0.0 release out before the end of today and published to npm.

Thanks for using the package 😊

Zeusmist commented 3 years ago

@just1and0 Thanks a bunch man πŸŽ‰πŸŽ‰πŸ˜Š.

just1and0 commented 3 years ago

@all-contributors please add @Zeusmist for bug

allcontributors[bot] commented 3 years ago

@just1and0

I've put up a pull request to add @Zeusmist! :tada:

just1and0 commented 3 years ago

@Zeusmist V4.0.2 is published and I can confirm this issue has been fixed.

Zeusmist commented 3 years ago

@just1and0 @mosoakinyemi Fantabulous!! Great job guys. Thank you!