Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coupon Percentage defaulting to Zero. #88

Closed
Glen5641 opened this issue Jun 24, 2020 · 4 comments
Closed

Coupon Percentage defaulting to Zero. #88

Glen5641 opened this issue Jun 24, 2020 · 4 comments

Comments

@Glen5641
Copy link

I see the coupon percentage is always defaulting to zero coming from the library even with known percentages in Chargify. It may be as simple as the coupon percentage coming from Chargify's API is a floating point number in the form of a string and is being converted to an integer instead of being converted to a decimal and then cast to an integer.

If this is still maintained, could I have help fixing this issue?

@kfrancis
Copy link
Owner

Sure, let me take a look.

@kfrancis
Copy link
Owner

And of course, feel free to fix it and send a PR.

@Glen5641
Copy link
Author

I appreciate the message back Kori. This is an educated guess and I want to make sure this is right before I pull request. Chargify is quite new to me so I do not know the back story. I feel Chargify coupon percentage was originally an integer, but changed their API's coupon percentage to a decimal from integer in the recent past.

A simple _percentage = (int)obj.GetJSONContentAsDecimal(key);
On line 170 in Coupon.cs should patch the problem if programs are using this and have not noticed the bug yet.

To expand on the fix instead of patching it, I can go through and physically change the percentage to a decimal to reflect what Chargify is now.

@kfrancis
Copy link
Owner

Ah, yes - ok. I'm on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants