Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 21 2018 19:27
    swelham closed #22
  • Feb 21 2018 19:27

    swelham on master

    Add CodeTriage badge to swelham… Merge pull request #22 from cod… (compare)

  • Feb 21 2018 19:12
    codetriage-readme-bot opened #22
  • Oct 19 2017 20:21

    swelham on overhaul

    (compare)

  • Apr 20 2017 14:07

    swelham on overhaul

    back to the basics removed missed app in mix file added genstage pipeline and 2 more (compare)

  • Feb 14 2017 09:54
    swelham commented #5
  • Feb 14 2017 09:17
    aseigo commented #5
  • Feb 13 2017 14:55

    swelham on master

    added adding missing asserts (compare)

  • Feb 13 2017 14:25

    swelham on master

    normalise paypal bad request re… (compare)

  • Feb 13 2017 12:21

    swelham on master

    small syntax improvement (compare)

  • Feb 12 2017 13:27
    swelham labeled #21
  • Feb 12 2017 13:27
    swelham opened #21
  • Feb 12 2017 13:24

    swelham on master

    bump version to 0.4.0 (compare)

  • Feb 12 2017 13:19

    swelham on master

    fixes #4 - added common error f… (compare)

  • Feb 12 2017 13:19
    swelham closed #4
  • Feb 12 2017 12:25

    swelham on master

    fixed merge issues (compare)

  • Feb 09 2017 10:12

    swelham on design_refactor

    (compare)

  • Feb 09 2017 10:05

    swelham on master

    started genstage experimenting added passing dummy authorize P… converted dummy gateway and 12 more (compare)

  • Feb 09 2017 10:05
    swelham closed #17
  • Feb 09 2017 10:05
    swelham closed #2
Stuart Welham
@swelham

I have just pushed a commit that will split out the errors for an http 400 and return them from the cashier module. If you are on the 0.2.0 release you will need to switch your dep to use the master branch from the git repo and this will initially break any code that expects cashier to return {:ok, result}. You will need to update the broken code to expect a 3 element tuple {:ok, id, result}, result in this case is also a tuple that contains the gateway that handled the request and the raw response (e.g. {:paypal, raw_data}). For some further examples I would suggest taking a look at the either of these test files cashier_test or paypal_test.

Otherwise feel free to give me a shout if you have any issues.

Zubair Nabi
@zubairshokh
Thank you @swelham, i got it. please let me know, if there is any major change in implementing the lib.
Thank you for your work
Zubair Nabi
@zubairshokh
i encountered this error
(FunctionClauseError) no function clause matching in Cashier.Gateways.PayPal.handle_response/2
when i use {:error, :invalid, reason}
Stuart Welham
@swelham
Sorry my bad, I missed a change in the base gateway module. I have just pushed a fix which should solve this issue for you.
Zubair Nabi
@zubairshokh
yea, was checking the code in Base module
thank you
will update it
Stuart Welham
@swelham
No problem, I appear to have a gap in my tests!!
Zubair Nabi
@zubairshokh
sorry, but i am getting the same issue again
(FunctionClauseError) no function clause matching in Cashier.Gateways.PayPal.handle_response/2
(cashier) lib/gateways/paypal.ex:2: Cashier.Gateways.PayPal.handle_response({:error, :invalid, %{"debug_id" => "7b97f0f1af5e0",
"details" => [
even after the update
Stuart Welham
@swelham

Can provide the code you are using for me to reproduce with?

I am currently testing this with the code in this gist using deps [{:cashier, git: "http://github.com/swelham/cashier.git"}] which is returning

%{"debug_id" => "fbb3c70ac78e4",
  "details" => [%{"field" => "payer.funding_instruments[0].credit_card.cvv2",
     "issue" => "Value must be numeric."}],
  "information_link" => "https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERR
OR",
  "message" => "Invalid request. See details.", "name" => "VALIDATION_ERROR"}
Zubair Nabi
@zubairshokh
here is the piece of code that handles it
{:error,:invalid, reason} -> set_error(conn,reason)
case Cashier.purchase(-5.99, card, [billing_address: address]) do
{:ok,id, {:paypal,result}} -> Service.PurchaseService.set_response_to_payment(conn,result)
|> MODULE.create(conn)
{:error,:invalid, reason} -> set_error(conn,reason)
end
Stuart Welham
@swelham
Hmm strange, that looks fine to me. All I can think is the cashier dep hasn't got the latest from master. I am about to publish a 0.3.0 version to hex with this included, give me 5 minutes and then I would suggest using that.
Zubair Nabi
@zubairshokh
sure
thanks
Stuart Welham
@swelham
This is now done @zubairshokh. Hopefully this will solve your issue!
Zubair Nabi
@zubairshokh
yea @swelham , worked now
Thanks
Stuart Welham
@swelham
No problem, I'm happy to have helped.
Computer Nerd
@TheVoriko_twitter
@swelham , I need some assistance regarding the usage of your cashier library
Stuart Welham
@swelham
Hi @TheVoriko_twitter, sorry for the late reply. Gitter never gave me a notification!
I have replied to your dm as well so let me know if I can still help.