Skip to content

Conversation

Gagan-Ram
Copy link
Member

@Gagan-Ram Gagan-Ram commented Oct 10, 2025

This PR is a part of fossasia/eventyay-tickets#1030

Summary by Sourcery

Align PayPal plugin references with the Eventyay namespace by replacing pretix imports, log identifiers, and metadata to use eventyay equivalents

Enhancements:

  • Replace pretix.* imports with eventyay.* across payment, views, signals, models, and apps modules
  • Update logger names and log_action/action_type values to eventyay.plugins.eventyay_paypal
  • Adjust migrations to depend on base instead of pretixbase and update foreign key targets accordingly
  • Rename plugin metadata class from PretixPluginMeta to EventyayPluginMeta

Copy link

sourcery-ai bot commented Oct 10, 2025

Reviewer's Guide

Aligns all module imports, logging namespaces, plugin metadata, migration references, and log action types from pretix.* to eventyay.* to conform with the enext eventyay module structure.

Entity relationship diagram for updated ReferencedPayPalObject model

erDiagram
  ReferencedPayPalObject {
    string reference
    FK Order order
    FK OrderPayment payment
  }
  Order ||--o{ ReferencedPayPalObject : "has"
  OrderPayment ||--o{ ReferencedPayPalObject : "has"
Loading

Class diagram for updated PaypalPluginApp and plugin meta

classDiagram
  class PaypalPluginApp {
    name : str = "eventyay_paypal"
    verbose_name : str = _("PayPal")
  }
  class EventyayPluginMeta {
    name : str = _("PayPal")
    author : str = "eventyay"
    version : str = __version__
  }
  PaypalPluginApp <|-- EventyayPluginMeta
Loading

File-Level Changes

Change Details Files
Module import paths updated from pretix.* to eventyay.*
  • Replaced imports for decimal, models, payment, mail services, settings, URLs, and reverse utilities
eventyay_paypal/payment.py
eventyay_paypal/views.py
Logging namespace updated
  • Changed logger.getLogger calls from "pretix.plugins.eventyay_paypal" to "eventyay.plugins.eventyay_paypal"
eventyay_paypal/payment.py
eventyay_paypal/views.py
eventyay_paypal/paypal_rest.py
Log action types and signal filters renamed
  • Updated order.log_action keys from "pretix.event.order.refund.failed" to "eventyay.event.order.refund.failed"
  • Updated webhook log_action and shred_payment_info filters to use new prefix
  • Adjusted signal handlers to match renamed action types
eventyay_paypal/payment.py
eventyay_paypal/views.py
eventyay_paypal/signals.py
Plugin configuration class and imports aligned
  • Renamed PretixPluginMeta to EventyayPluginMeta
  • Updated plugin imports from pretix.base.plugins to eventyay.base.plugins
eventyay_paypal/apps.py
Model and migration foreign keys realigned
  • Changed migration dependencies and FK targets from pretixbase.* to base.*
  • Updated ReferencedPayPalObject model FKs to base.Order and base.OrderPayment
eventyay_paypal/migrations/0002_initial.py
eventyay_paypal/models.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes - here's some feedback:

  • Ensure that the migration dependency change from 'pretixbase' to 'base' does not disrupt the existing migration graph or require a data migration for existing databases.
  • Double-check that updating the logger names to 'eventyay.plugins.eventyay_paypal' matches your logging configuration so no log entries are dropped.
  • Verify that renaming the inner plugin class from PretixPluginMeta to EventyayPluginMeta is still recognized by your plugin loader and won’t break plugin discovery.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Ensure that the migration dependency change from 'pretixbase' to 'base' does not disrupt the existing migration graph or require a data migration for existing databases.
- Double-check that updating the logger names to 'eventyay.plugins.eventyay_paypal' matches your logging configuration so no log entries are dropped.
- Verify that renaming the inner plugin class from PretixPluginMeta to EventyayPluginMeta is still recognized by your plugin loader and won’t break plugin discovery.

## Individual Comments

### Comment 1
<location> `eventyay_paypal/apps.py:8-9` </location>
<code_context>
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _

from . import __version__

try:
    from eventyay.base.plugins import PluginConfig
except ImportError:
    raise RuntimeError("Python package 'paypal' is not installed.")

</code_context>

<issue_to_address>
**suggestion (code-quality):** Explicitly raise from a previous error ([`raise-from-previous-error`](https://docs.sourcery.ai/Reference/Default-Rules/suggestions/raise-from-previous-error/))

```suggestion
except ImportError as e:
    raise RuntimeError("Python package 'paypal' is not installed.") from e
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines 8 to 9
except ImportError:
raise RuntimeError("Python package 'paypal' is not installed.")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): Explicitly raise from a previous error (raise-from-previous-error)

Suggested change
except ImportError:
raise RuntimeError("Python package 'paypal' is not installed.")
except ImportError as e:
raise RuntimeError("Python package 'paypal' is not installed.") from e

Copy link
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this PR against the enext branch.

@Gagan-Ram
Copy link
Member Author

Gagan-Ram commented Oct 11, 2025

Please make this PR against the enext branch.

The PR is made against enext branch only.
Sorry, I'll change the title.

@Gagan-Ram Gagan-Ram changed the title chore: align module imports with enext chore: align plugin against enext branch Oct 11, 2025
@mariobehling
Copy link
Member

I think you misunderstand. https://github.com/fossasia/eventyay-tickets-paypal/tree/enext here in this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants