#dev | Logs for 2017-05-17

« return
[02:50:07] -!- upstart [upstart!~init@39-155-605-112.dhcp.wlwl.wa.charter.com] has joined #dev
[07:29:25] upstart is now known as xlefay2
[07:35:10] xlefay2 is now known as upstart
[18:20:37] <TheMightyBuzzard> smoke break
[18:20:37] <TheMightyBuzzard> nicotine++
[18:20:37] <Bender> karma - nicotine: 4
[18:30:54] <TheMightyBuzzard> yeah, it's a stripe bitcoin bug. we're going to have to not allow partial dollar payments for anything until they fix it.
[18:31:02] <Xyem> Whoops.
[18:31:27] <TheMightyBuzzard> break something?
[18:31:36] <Xyem> Devel::Dwarn isn't installed :)
[18:31:53] <TheMightyBuzzard> not surprising
[18:32:00] <Xyem> Should have checked that first..
[18:33:42] <TheMightyBuzzard> ugh, i don't wanna set up cpan right now. don't really need to anyway since it's their bug but i'll go ahead n do it.
[18:34:27] <TheMightyBuzzard> blerg, what am i thinking. you can't cpan something in to system perl and have it work for slash's perl
[18:35:25] <TheMightyBuzzard> the slash user has its own perl/apache separate from system packages
[18:36:13] <TheMightyBuzzard> okay, is installed
[18:36:28] <TheMightyBuzzard> if you want a particular package installed for the slash user, just cpan it in.
[18:37:59] <TheMightyBuzzard> hrm... we could just put a note out beside the stripe button saying "<b>Whole dollars only for BitCoin</b>."
[18:38:36] <TheMightyBuzzard> no, needs to be earlier while they're putting in the number
[18:40:32] <Xyem> Do you lose anything by being charged less?
[18:40:54] <TheMightyBuzzard> us? not really. pocket change.
[18:41:12] <Xyem> Sorry, I meant as a subscriber.
[18:41:19] <TheMightyBuzzard> nah
[18:41:41] <TheMightyBuzzard> $20 or $20K gets you the same duration, whichever you picked.
[18:42:46] <TheMightyBuzzard> simplest fix for today is just to let the user know that partial dollars won't work for bitcoin though.
[18:42:58] <Xyem> Why not just round it down and have a message on the "Thanks for supporting us" noting that it was rounded down?
[18:43:50] <TheMightyBuzzard> eh, we could. i dislike altering what a person agreed to on their money though. even in their favor.
[18:44:04] <Xyem> Understandable.
[18:44:38] <TheMightyBuzzard> besides, stripe might fix it later this month and then we can just take the message out.
[18:44:39] <Xyem> Perhaps do both? A warning up front and auto-round down if they ignore it :)
[18:45:27] <TheMightyBuzzard> "All payments will be rounded down to the nearest dollar"?
[18:45:59] <Xyem> "All bitcoin payments will [..] due to current processing issues with Stripe"
[18:46:33] <TheMightyBuzzard> ah, we can't tell if they want to pay with bitcoin before they leave our site though. that little bit of js is stripe's code not ours.
[18:47:26] <TheMightyBuzzard> we could round all Stripe payments and not paypal but we'd have to do at least that much.
[18:47:38] <Xyem> Sorry, I meant that above where you enter the values, you have a warning that if you do Stripe-Bitcoin, it will get rounded down due to a bug on their end.
[18:48:06] <TheMightyBuzzard> doesn't get rounded down. it doesn't go through at all.
[18:48:16] <Xyem> So even though you are altering it, you did warn them and explain why.
[18:48:28] <TheMightyBuzzard> they send back an error, the json of which is in the log.
[18:48:43] <Xyem> You don't know it is bitcoin before it gets sent?
[18:48:50] <TheMightyBuzzard> if we alter it to work we have to alter it for stripe CC payments as well.
[18:48:59] <TheMightyBuzzard> only one button after all
[18:49:54] <TheMightyBuzzard> the page where you see the three payment options, everything from there out is handled either by paypal or stripe. we never touch money.
[18:50:05] <Xyem> Ah, I see.
[18:50:21] <TheMightyBuzzard> makes it much easier on us legally.
[18:50:25] <Xyem> Sure, a warning when entering the values that all Stripe payments will be rounded down should be appropriate.
[18:50:58] <Xyem> And if you can, mention that it was (and what it was changed from/to) on the "Thank you" page?
[18:50:59] <TheMightyBuzzard> okey doke. that might be a pain in the ass for you to find.
[18:52:00] <TheMightyBuzzard> eh, you're looking for a whole lot of extra coding if you wanna do that. hard to save state variables in web programming.
[18:52:01] <Xyem> ./plugins/Subscribe/templates/edit;subscribe;default ?
[18:52:08] <TheMightyBuzzard> good on ya
[18:52:27] <TheMightyBuzzard> grep or did you figure out what slashDisplay does?
[18:52:30] <Xyem> grep :)
[18:52:34] <TheMightyBuzzard> nod nod
[18:52:58] <TheMightyBuzzard> slashDisplay calls one of the templates which are a mix of html and pseudo-perl. i hate em.
[18:53:24] <TheMightyBuzzard> can either return a value or print directly to the page, depending.
[18:54:12] <Xyem> Hm, I'm currently developing using Mojolicious, so state variables are fairly easy to do.
[18:55:00] <TheMightyBuzzard> i'd say just add the warning after "Price must be equal or greater than the default minimum values." but still in the ()s
[18:55:52] <TheMightyBuzzard> yeah, can't really do that with apache when you have 100k users any one of which might be the next request.
[18:56:40] <TheMightyBuzzard> i mean theoretically you could but it'd take up a lot of ram.
[18:57:39] <TheMightyBuzzard> stuffing it in something like redis might work but it's generally better to pretend stateful is not an option.
[18:58:18] <Xyem> It gets stored in a cookie, so it is user specific.
[18:58:35] <Xyem> And stored client-side.
[18:58:57] <TheMightyBuzzard> ACs can buy subs and reject cookies at the same time.
[18:59:07] <TheMightyBuzzard> for others i mean
[18:59:56] <TheMightyBuzzard> we can't count on anyone running everything we send them. hell, gewg_ doesn't even load our css files.
[19:00:47] * Xyem shrugs
[19:00:59] <Xyem> It is only informational, if they were already warned about it.
[19:01:08] <Xyem> I'm not fussed either way :)
[19:01:45] <TheMightyBuzzard> aight, message in the template and rounding down in the "stripe" sub in Subscribe.pm should cover us. i'm gonna go have another smoke n leave it to you.
[19:12:58] <Xyem> Hm, are you sure it is a Stripe bug? I've rounded it down, but it still shows the fractional amount and gives the same error.
[19:13:17] <Xyem> There seems to be two seperate "amount" values.
[19:13:22] <Xyem> separate*
[19:13:47] <TheMightyBuzzard> hrm... shouldn't be.
[19:14:54] <Xyem> I round it down immediately inside stripe(), but all the values on the site show the original.
[19:15:00] <TheMightyBuzzard> $form->{amount} is what comes in to us as post data from the previous page and we alter it to set up the button.
[19:15:06] <Xyem> And the error shows that Stripe gets both.
[19:15:23] <Xyem> "The amount specified (3100) does not match the amount on the source (3125)"
[19:16:04] <TheMightyBuzzard> hrm...
[19:16:31] <TheMightyBuzzard> mind if i take a gander at what you rounded?
[19:17:12] <Xyem> Go ahead, need to put daughter to bed anyway. Back shortly.
[19:20:05] <TheMightyBuzzard> may need to be a new var. not sure $form is writeable.
[19:24:17] <TheMightyBuzzard> ya, thas prolly it.
[19:25:48] <TheMightyBuzzard> hrm...
[19:27:11] <TheMightyBuzzard> no i don't think it is.
[19:30:15] <TheMightyBuzzard> either way it's better not to alter $form data.
[19:32:01] <TheMightyBuzzard> there it is. in stripebut;subscribe;default
[19:33:32] <TheMightyBuzzard> called from confirm;subscribe;default
[19:35:29] <TheMightyBuzzard> gotta run. if you can manage to square this away to either allow partial dollars or at least quit erroring and warn folks, you'll have code going into the current site update.
[19:51:42] <Xyem> Back and back to working on that :)
[20:11:24] <Xyem> Found and fixed it.
[20:14:38] -!- charon_ [charon_!~0c0959f3@Soylent/Staff/Editor/charon] has joined #dev
[20:15:23] <Xyem> As far as I can tell, it's been broken for 2 years..?
[20:16:10] <Xyem> The sprintf was dropping the fraction, then it was being multiplied. It only needs to be multiplied and then int()'d.
[20:16:54] <Xyem> So it would go: 31.24 -(sprintf)> 31 -(*100)> 3100 -(int)> 3100
[20:22:04] <Xyem> I'm guessing it was a typo. The "%.2d" may have been intended to be "%.2f".
[20:23:34] <Xyem> Which, while still unnecessary, gives the correct answer.
[22:56:38] <TheMightyBuzzard> Xyem, excellent. was prolly my bad then.
[22:58:40] <TheMightyBuzzard> slap it in a pull request and hopefully we'll (by we i of course mean paulej72) get it rolled out this weekend
[23:12:57] <Xyem> PR done.
[23:13:07] <Xyem> https://github.com
[23:13:08] <upstart> ^ 03Fix bug preventing fractional-dollar bitcoin payments by Xyem · Pull Request #391 · SoylentNews/rehash · GitHub
[23:19:10] <TheMightyBuzzard> Xyem, cool, that the current code on dev?
[23:19:49] <Xyem> It will be in a moment, I removed the warning but didn't redeploy.
[23:20:10] <TheMightyBuzzard> oh, hang on, that'll cause issues if they put in $12.345
[23:20:55] <TheMightyBuzzard> it'll end up with us sending a floating point number to stripe instead of an int
[23:21:06] <Xyem> I just put in 31.2345 and it works.
[23:22:23] <Xyem> 31.2490 also works.
[23:23:09] <Xyem> It still only sends an integer.
[23:23:10] <TheMightyBuzzard> that's just odd.
[23:23:25] <Xyem> amount => int($amount * 100)
[23:23:33] <TheMightyBuzzard> ahhh, roger
[23:23:46] <TheMightyBuzzard> missed the int()
[23:24:20] <TheMightyBuzzard> glad you're doing this instead of me. would have taken me all day and several naps with this head cold.
[23:25:17] <TheMightyBuzzard> and, merged
[23:25:29] <Xyem> Woohoo!
[23:25:52] <Xyem> Thanks :)
[23:25:57] <TheMightyBuzzard> Bytram, fractional dollar issue fixed courtesy of Xyem. feel free to break it.
[23:27:41] <TheMightyBuzzard> i don't think we had anything else that senior QA there wanted done before we rolled live so i'll let the eds abuse ya until after.