-
Notifications
You must be signed in to change notification settings - Fork 53
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
[Mercadopago] Add support for mercadopago gateway. #185
base: dev
Are you sure you want to change the base?
Conversation
Manually picked up code from various branches/PRs related to mercadopago The branches/PRs are couple years old, and messy.
Once this PR is merged, I'll close other mercadopago related PRs, mentioning this PR. |
@mandarvaze Can you sync the branch with latest |
Done. |
Codecov Report
@@ Coverage Diff @@
## dev #185 +/- ##
==========================================
+ Coverage 77.39% 80.70% +3.30%
==========================================
Files 14 16 +2
Lines 376 456 +80
==========================================
+ Hits 291 368 +77
- Misses 85 88 +3
Continue to review full report at Codecov.
|
@mandarvaze Also check if the docs are generating properly. |
| `customer_id` | Unique customer id issued by the gateway. For new customer it must skipped. Type- string| | ||
| `order_type` | `"mercadopago"` or `"mercadolibre"` as per the order. Type- string | | ||
| `installments` | No of installments for payment. Type- integer | | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"For eg. https://www.mercadopago.com.ar/developers/en/reference/payments/_payments/post/"
check the documentation to get how mercadopago accepts the params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mandarvaze Add PCI and Non PCI section and implementation with info.
### I'm not PCI-DSS compliant
No worries, both `authorize/3` and `purchase/3` accept a
"payment-source-identifier" (a `string`) instead of a `CreditCard.t`
struct. You'll have to generate this identifier using [Stripe.js and
Elements][stripe-js] client-side.
### I'm PCI-DSS compliant
In that case, you need not use [Stripe.js or Elements][stripe-js] and can
directly accept the client's card info and pass the `CreditCard.t` struct to
this module's functions.
""" | ||
@spec void(String.t(), keyword) :: {:ok | :error, Response} | ||
def void(payment_id, opts) do | ||
# url = "#{@base_url}/v1/payments/#{payment_id}?access_token=#{opts[:config][:access_token]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mandarvaze remove this commented code.
defp respond({:ok, %HTTPoison.Response{body: body, status_code: status_code}}, opts) do | ||
body = body |> Poison.decode!() | ||
|
||
case body["cause"] do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mandarvaze success and failure should be mocked.
def bad_card_purchase_response do | ||
{:error, | ||
%HTTPoison.Error{ | ||
reason: "Bad Card for Purchase", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mandarvaze this should capture the real bad response from the gateway.
@mandarvaze update the README file with the addition of this new gateway. |
Done. |
Why?