fossasia / eventyay-tickets

Apache License 2.0
1.51k stars 41 forks source link

Update Paypal to a more recent version #187

Closed lcduong closed 1 month ago

lcduong commented 3 months ago

Fixes #151 Update Paypal to a more recent version

Short description of what this resolves:

Update Paypal to a more recent version

Changes proposed in this pull request:

  • Update Paypal to a more recent version

Checklist

  • [x] I have read the Contribution & Best practices Guide.
  • [x] My branch is up-to-date with the Upstream development branch.
  • [ ] The acceptance, integration, unit tests and linter pass locally with my changes
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added necessary documentation (if appropriate)

Summary by Sourcery

This pull request updates the PayPal integration to a more recent version, incorporating the latest PayPal SDKs and APIs. It introduces support for PayPal Alternative Payment Methods (APM), enhances the configuration interface, and improves error handling and logging. The user interface for PayPal payment options has also been enhanced to dynamically render available payment methods.

mariobehling commented 3 months ago

Thank you. Please check the docker build is failing.

mariobehling commented 3 months ago

I cannot get it to run using docker autodeployment. Getting the following errors:

1 error and 7 warnings

lcduong commented 3 months ago

Hi @mariobehling, this is similar case with Stripe we discussed, if admin did not config Paypal key in global setting, User must config by theirself in paypemt setting, if admin did setup key in global setting, User just will see action to connect with paypal and integrate with Paypal business account set up in global. For more clarify, please see below testing

Testing Admin did not config global key

  1. Admin did not setup public key, private key and merchant id in global setting image
  2. In payment setting of each event, User must connect with Paypal account which will be used only for that event. image
  3. place order and paid image

Admin has configured global key for paypal

  1. First we need a business paypal account (for testing, I'm using sandbox account) image note private key, public key and account id (merchant id) image

  2. set noted key in admin global setting

  3. There is option connect with Paypal in payment setting for event which not configured yet image

  4. Now just follow step by step and connect with business paypal account image

image

image

Enable payment method and start selling your tickets

image

Please ping me if any confuse.

mariobehling commented 3 months ago

Getting Internal Server Error when accessing the Payment options page of an event.

Screenshot from 2024-06-22 07-42-19

mariobehling commented 3 months ago

This server error happens after I fill in the Paypal details into the global admin settings page.

Screenshot from 2024-06-22 07-59-13

lcduong commented 3 months ago

Getting Internal Server Error when accessing the Payment options page of an event.

Hi @mariobehling , could you share with me the logs?

odkhang commented 3 months ago

Hi @mariobehling, issue is fixed, please test it again.

mariobehling commented 3 months ago

@lcduong I am getting

An error occurred during connecting with PayPal, please try again.

Screenshot from 2024-07-01 11-04-43

mariobehling commented 3 months ago

Could it be that you also need paypal-checkout-serversdk 1.0.* in order to get this working?

mariobehling commented 2 months ago

Please resolve conflicts.

mariobehling commented 2 months ago

@sourcery-ai review

sourcery-ai[bot] commented 2 months ago

Reviewer's Guide by Sourcery

This pull request updates the PayPal integration to a more recent version, replacing the deprecated paypalrestsdk with the new paypalcheckoutsdk. The changes include significant refactoring of the payment processing logic, updates to the settings and configuration, and enhancements to the user interface for PayPal payments.

File-Level Changes

Files Changes
src/pretix/plugins/paypal/payment.py
src/pretix/plugins/paypal/views.py
src/pretix/plugins/paypal/signals.py
src/pretix/plugins/paypal/urls.py
src/pretix/plugins/paypal/apps.py
Refactored the PayPal integration to use the new paypalcheckoutsdk, updated settings and configuration, and added new views and signal handlers.
src/pretix/base/services/cart.py
src/pretix/presale/views/__init__.py
Updated cart and presale views to support the new PayPal payment methods.
src/pretix/plugins/paypal/templates/plugins/paypal/redirect.html
src/pretix/plugins/paypal/templates/plugins/paypal/paypal_pay.html
src/pretix/plugins/paypal/templates/plugins/paypal/control.html
src/pretix/plugins/paypal/templates/plugins/paypal/checkout_payment_confirm.html
src/pretix/plugins/paypal/templates/plugins/paypal/checkout_payment_form.html
Added and updated templates to support the new PayPal payment methods and user interface.
src/pretix/plugins/paypal/static/plugins/paypal/paypal.js Added a new JavaScript file for handling PayPal payments using the new SDK.
src/pretix/plugins/paypal/paypal_http_client.py
src/pretix/plugins/paypal/paypal_environment.py
Added new modules for handling HTTP requests and configuring the PayPal environment using the new SDK.

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.