nate-strauser / wework

We Work Meteor, a job board and developer directory for Meteor specific work
https://www.weworkmeteor.com
MIT License
288 stars 145 forks source link

Job posts not featured after payment success? #108

Closed justinxreese closed 8 years ago

justinxreese commented 8 years ago

I'm wondering if I could get some insight into what could cause this to fail.

The stripe payments on my site at http://jobs.abstractions.io are going through, but I have to manually add a "Featured Through" date to each one to get them to be featured.

Not sure where to look. Any help greatly appreciated. It's okay for now, but I'm going to be using this for our upcoming conference and won't have time to manually feature posts during the event.

nate-strauser commented 8 years ago

That sounds pretty strange. Are you sure the charges are going through? Do you see them in the stripe control panel?

This is the code that does the charging - https://github.com/nate-strauser/wework/blob/master/both/lib/methods.js#L94

On Tue, Aug 9, 2016 at 1:59 PM, Justin Reese notifications@github.com wrote:

I'm wondering if I could get some insight into what could cause this to fail.

The stripe payments on my site at http://jobs.abstractions.io are going through, but I have to manually add a "Featured Through" date to each one to get them to be featured.

Not sure where to look. Any help greatly appreciated. It's okay for now, but I'm going to be using this for our upcoming conference and won't have time to manually feature posts during the event.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nate-strauser/wework/issues/108, or mute the thread https://github.com/notifications/unsubscribe-auth/AAXyDuz0bbndIavkMopoHh_RTbCHeJyHks5qeMAXgaJpZM4JgWgv .

justinxreese commented 8 years ago

Yes. Definitely have charges. Just refunded three of them because the user was confused and kept trying. I'll look at the referenced method here in a bit.

justinxreese commented 8 years ago

No errors in app logs

justinxreese commented 8 years ago

Actually there are errors in the app console, didn't show up in Galaxy

Blocked a frame with origin "https://checkout.stripe.com" from accessing a frame with origin "https://jobs.abstractions.io". Protocols, domains, and ports must match. is shown early in the process and when I attempt to make a payment it inserts an error

Insert Error: – n {stack: "n@https://jobs.abstractions.io/e8[REDACTED]2cf.js?meteor_js_resource=true:50:17769", error: "Payment Failed!", reason: undefined, …}

nate-strauser commented 8 years ago

i made a small change to output a better error condition - try that out and let me know what it says now

it seems like the stripe charge may be going through, but that the response is not as expected, thus the job is not marked as featured

justinxreese commented 8 years ago

Cool that's nice. I'll give it a shot. We looked at the stripe API and noticed it might respond with "pending" instead of "succeeded". Will let you know

nate-strauser commented 8 years ago

hmm - i guess that could be it - i've only ever gotten back 'succeeded' in my testing

the charge checking logic could be status !== 'failed', but that leaves me concerned about what happens if a 'pending' status later turns into 'failed'.

On Tue, Aug 9, 2016 at 3:29 PM, Justin Reese notifications@github.com wrote:

Cool that's nice. I'll give it a shot. We looked at the stripe API and noticed it might respond with "pending" instead of "succeeded". Will let you know

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nate-strauser/wework/issues/108#issuecomment-238664176, or mute the thread https://github.com/notifications/unsubscribe-auth/AAXyDgu2c0wkr7VSrVw5KpU1pAlTqhUyks5qeNUYgaJpZM4JgWgv .

swans-one commented 8 years ago

@nate-strauser I've been working on this, and we've actually been receiving a status of 'paid'. This is in disagreement with stripe's documentation of what this status field can contain (documentation here: https://stripe.com/docs/api#charge_object-status) but it is what we're seeing.

Changing line 101 here: https://github.com/nate-strauser/wework/blob/master/both/lib/methods.js#L101

to:

            if(result && (result.status === "succeeded" || result.status === "paid")){

Solves this issue.