by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Gopal B Shimpi
@gopalshimpi
Can you share API docs for mercadopago
@mandarvaze
Mandar Vaze
@mandarvaze
@gopalshimpi For testing I can make HTTPoison.post() call, but that is not scalable.
commit call accepts method as an argument. Sometimes it is get sometimes post
Mandar Vaze
@mandarvaze
pry(1)> HTTPoison.post("https://api.mercadopago.com/v1/customers", "{\"email\":null}", [{"content-type", "application/json"}, {"accept", "application/json"}])
{:error, %HTTPoison.Error{id: nil, reason: :nxdomain}}
Gopal B Shimpi
@gopalshimpi
So there is no issue for HTTPosion
It is working properly. You got an error response.
Please make sure that you are using HTTPosion.request correctly.
Gopal B Shimpi
@gopalshimpi
@mandarvaze
Mandar Vaze
@mandarvaze
@ashish173 @gopalshimpi HTTPoison.request/5 is used here as well (In trexle gateway)
Its unit test uses bypass instead of Mock - would that make any difference ?
Ashish Singh
@ashish173
that’s a possibility
Mandar Vaze
@mandarvaze
Let me give it a try. I mean using bypass for a single test, and see if matters. Accordingly, we can decide the next course of action.
Gopal B Shimpi
@gopalshimpi
The body should be like this {: form, params } @mandarvaze
Mandar Vaze
@mandarvaze
@gopalshimpi Can we discuss this during our call today ?
Mandar Vaze
@mandarvaze

The body should be like this {: form, params } @mandarvaze

@gopalshimpi Since the error is related to module not found, how will the above change help ?

I changed as follows - Did not help.

-    res = HTTPoison.request(method, "#{@base_url}#{path}", body, headers, url_params)
+    res = HTTPoison.request(method, "#{@base_url}#{path}", {:form, url_params}, headers)

Now I get ** (UndefinedFunctionError) function HTTPoison.request/4 is undefined (module HTTPoison is not available)

Notice arity in the error changed to 4 (since I did not pass opts)

Mandar Vaze
@mandarvaze
I got one test case to work successfully (I think) 🎉 @gopalshimpi
Gopal B Shimpi
@gopalshimpi
GREAT
Mandar Vaze
@mandarvaze

@oyeb Since you have reviewed the mercadopago branch last time - query for you:
Did you check the URLs as per the mercadopago documentation ? (They may have changed since Oct 2018)

specifically for refund as per mercadopago documentation the URL should be : https://api.mercadopago.com/v1/advanced_payments/{id}/refunds

The existing code uses https://api.mercadopago.com/v1/payments/{id}/refunds.

(payments instead of advanced_payments)

Please comment.

@gopalshimpi @ashish173 - Please comment.

activemerchant code base also uses payments but I'm not sure if it is well tested and when was it tested (the file is last updated in Jan 2020 - so relatively latest)
Mandar Vaze
@mandarvaze
Latest set of errors I'm facing are : (only relevant part pasted below, stack trace not relevant IMO)
** (FunctionClauseError) no function clause matching in Gringotts.Gateways.Mercadopago.respond/2
....
....
     Attempted function clauses (showing 2 out of 2):

         defp respond({:ok, %HTTPoison.Response{body: body, status_code: status_code}}, opts)
         defp respond({:error, %HTTPoison.Error{} = error}, _)

     code: assert {:error, _response} = Merc.refund(@amount, @refund_id, @opts_refund)
     stacktrace:
       (gringotts) lib/gringotts/gateways/mercadopago.ex:362: Gringotts.Gateways.Mercadopago.respond/2
       test/gateways/mercadopago_test.exs:198: (test)
Mandar Vaze
@mandarvaze
All unit tests pass - But I'm not feeling good. Using mock we control both sides.
Started working on integration tests. I'm getting the following :
Invalid access parameters. Should specify a public_key or an access_token to POST a CardToken
I suppose I need to sign up for developer account with Mercadopago - but their signup form is not in english :(
Let me try google translate and see how far I can go.
Gopal B Shimpi
@gopalshimpi
Yes, you need to login
Mandar Vaze
@mandarvaze
I can't understand their login form. Google translate did not help. May be we can discuss during the call today ? I joined the call yesterday, but no one joined.
BTW, I could not find mercadopago on activemerchant's page either here or here
I know they have code for mercadopago here but I wonder if this is just work on progress.
@ashish173 I wonder if I should pickup another one - which has english language support :smile:
Gopal B Shimpi
@gopalshimpi
did you clone? Active-merchant ?
@mandarvaze
@ashish173 Can you add Mandar to our Gringotts slack channel?
So it will be better for communication
Mandar Vaze
@mandarvaze
@gopalshimpi I have provided the link to same file you pointed to :smile:
Please see the (3) links in my comment. 1 to AM wiki, other to their readme and third to same file.
Gopal B Shimpi
@gopalshimpi
Yeah I saw that : )
Ashish Singh
@ashish173

@ashish173 Can you add Mandar to our Gringotts slack channel?

done. this would be easier.

@mandarvaze FYI the code was still a WIP so we don’t know if it was working or if it was a typo. you should follow current documentation.
Ananya Bahadur
@oyeb

@mandarvaze

@oyeb Since you have reviewed the mercadopago branch last time - query for you:
Did you check the URLs as per the mercadopago documentation ? (They may have changed since Oct 2018)

I did, and they have certainly changed.

👆helped. Successfully Installed Erlang/OTP 20.2 and elixir 1.6.5, as discussed. monei tests passed. Now focusing on Mercadopago related test cases from my branch

It seems you are now using an older elixir. Some String.Chars protocol implementations have changed with time, some types that were automatically serialized to strings inside a string interpolation expression now have to be explicitly converted using inspect/1 or by provinding a defimpl for that type.

I've never been a fan of Mock :smile: and even discourage it https://github.com/aviabird/gringotts/blob/dev/CONTRIBUTING.md#writing-test-cases
Ananya Bahadur
@oyeb
I had implemented the Monei gateway adapter and I can confirm that they have changed their API and URL endpoints. The account credentials used in the integration test have been deactivated as well.
I highly recommend that you come back to the latest elixir version and do a mix deps.update.
Best of luck with mercado :+1:
Mandar Vaze
@mandarvaze
@oyeb The code does not work with latest elixir, but I did upgrade to 1.7, and pushed a PR related to travis for the same.
Ananya Bahadur
@oyeb
I know it does not work with the latest elixir, and I was able to fix the bugs (all of them were related to string interpolation). I could not submit a patch to our repo but I've shared links I used to solve the issues in my previous reply.