-
Notifications
You must be signed in to change notification settings - Fork 47
Adding-Modification-Functionality-For-Checkout-Api #144
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
Conversation
Merge from develop
New release 1.3.0
New release 1.4.0
Release 2.0.0
Release 2.1.0
Merge to master
Release 3.0.0
Release 3.1.0
Release 5.0.0
Release 5.1.0
* [PW-4392] Update README based on the new template (Adyen#140) * Update README based on the new template * Update the endpoints versions * Add the api versions in the description * Add the example with xapi key * Apply suggestions from code review Co-authored-by: Ángel Campos <angel.campos@adyen.com> * Update README.md Co-authored-by: Alessio Zampatti <alessio.zampatti@adyen.com> Co-authored-by: Ángel Campos <angel.campos@adyen.com> Co-authored-by: Alessio Zampatti <alessio.zampatti@adyen.com> * Adding cancels action * [PW-4392] Update README based on the new template (Adyen#140) * Update README based on the new template * Update the endpoints versions * Add the api versions in the description * Add the example with xapi key * Apply suggestions from code review Co-authored-by: Ángel Campos <angel.campos@adyen.com> * Update README.md Co-authored-by: Alessio Zampatti <alessio.zampatti@adyen.com> Co-authored-by: Ángel Campos <angel.campos@adyen.com> Co-authored-by: Alessio Zampatti <alessio.zampatti@adyen.com> * Adding cancels action * Adding modifications to checkout api Co-authored-by: Alexandros Moraitis <alexandros.moraitis@adyen.com> Co-authored-by: Ángel Campos <angel.campos@adyen.com> Co-authored-by: Alessio Zampatti <alessio.zampatti@adyen.com> Co-authored-by: Eric Laff <eric.laff@tier.app>
Co-authored-by: Eric Laff <eric.laff@tier.app>
Co-authored-by: Eric Laff <eric.laff@tier.app>
@acampos1916 Hey! This is a reopened PR per your instructions. I made the requested changes. Thanks again! |
Hello @eraserhead0705, Thank you in advance, |
"paymentscancel-" | ||
"withoutreference-succes.json") | ||
|
||
result = self.adyen.checkout.payments_cancels_without_reference(request=requests, path_param=psp_reference) |
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.
result = self.adyen.checkout.payments_cancels_without_reference(request=requests, path_param=psp_reference) | |
result = self.adyen.checkout.payments_refunds(request=requests, path_param=psp_reference) |
if action == "paymentsResult": | ||
action = "payments/result" | ||
if action == "paymentsCancelsWithoutReference": | ||
action = "payments/cancels" |
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.
are you referring to this endpoint? https://docs.adyen.com/api-explorer/#/CheckoutService/v67/post/cancels
it should be just /cancels
? without the payments
prefix. Maybe we can call the action just cancels
if this is the case.
"paymentsresult-error-invalid-" | ||
"data-payload-422.json") | ||
|
||
result = self.adyen.checkout.payments_cancels_without_reference(request=requests, path_param=reference_id) |
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.
result = self.adyen.checkout.payments_cancels_without_reference(request=requests, path_param=reference_id) | |
result = self.adyen.checkout.payments_refunds(request=requests, path_param=reference_id) |
self.assertEqual("Invalid payload provided", result.message['message']) | ||
self.assertEqual("validation", result.message['errorType']) | ||
|
||
def test_payments_refunds_raises_vaulue_error(self): |
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.
def test_payments_refunds_raises_vaulue_error(self): | |
def test_payments_refunds_raises_value_error(self): |
"paymentscancel-" | ||
"withoutreference-succes.json") | ||
with self.assertRaises(ValueError) as exc: | ||
self.adyen.checkout.payments_cancels_with_reference(request=requests, path_param="") |
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.
self.adyen.checkout.payments_cancels_with_reference(request=requests, path_param="") | |
self.adyen.checkout.payments_refunds(request=requests, path_param="") |
raise ValueError( | ||
'must contain a pspReference in the path_param, path_param cannot be empty' | ||
) | ||
action = "paymentsCapture" |
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.
can you please add this action in the client.py
code? I think it's not there yet
action = "paymentsResult" | ||
return self.client.call_checkout_api(request, action, **kwargs) | ||
|
||
def payment_captures(self, path_param, request=None, idempotency_key=None, **kwargs): |
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.
def payment_captures(self, path_param, request=None, idempotency_key=None, **kwargs): | |
def payments_captures(self, path_param, request=None, idempotency_key=None, **kwargs): |
Yes sureI can clean it up. |
Thanks @eraserhead0705 let us know it goes, we can check the PR again as soon as these comments are addressed. |
'must contain a pspReference in the path_param, path_param cannot be empty' | ||
) | ||
action = "paymentsReversals" | ||
return self.client.call_checkout_api(request, action, path_param, idempotency_key, **kwargs) |
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.
This does not work: call_checkout_api
expects idempotency_key
and path_param
in a different order.
Same comment probably also applies to all other uses of call_checkout_api
in this PR.
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.
I see :) Thanks for the comment!
hi all, my team would like to use this as well - what is blocking this PR? maybe we could help contribute |
Hello @yesthesoup, your help would be greatly appreciated. I see that @eraserhead0705 hasn’t been able to work on the suggestions from above, are you able to commit to this branch? |
Hey @acampos1916 I have the fixes on my local branch. I will try and get them pushed this week.
|
Thanks @eraserhead0705, if it’s easier to open a new one feel free to do so. |
Gonna open a new one then, in the end I think its cleaner. I will reverence it here when I do 👍 |
@acampos1916 I opened a New PR, #158 for these changes. |
@acampos1916 Can I close this PR? |
Thanks @eraserhead0705, I can close it |
What problem you’re solving:
The Adyen Python Library lacks support for the full Checkout API actions.
Capture
Refund
Reversals
Cancel/Technical Cancel
Our Team at Tier needs this functionality implemented in the Python library in order to fully integrate with our backend system.
Your approach to fixing the problem:
Implemented the above functionality by building on the current service/client in the code base. I added a new parameter to send a path parameter to the Adyen Api.
Any tests you wrote:
Each new action has two tests written, one success and one that mocks an error.
Additionally a test that checks for race condition.