-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Add support for payout reconciliation reports, remittance_reference and location value for price.tax_mode #128
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
paddle_billing/Entities/Reports/PayoutReconciliationReportType.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta | ||
|
|
||
| from paddle_billing.Entities.Reports.ReportType import ReportType | ||
|
|
||
|
|
||
| class PayoutReconciliationReportType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): | ||
| PayoutReconciliation: "PayoutReconciliationReportType" = ReportType.PayoutReconciliation.value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
paddle_billing/Resources/Reports/Operations/CreatePayoutReconciliationReport.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| from dataclasses import dataclass, field | ||
|
|
||
| from paddle_billing.Entities.Reports import PayoutReconciliationReportType | ||
|
|
||
| from paddle_billing.Resources.Reports.Operations.Filters import ( | ||
| RemittanceReferenceFilter, | ||
| TransactionUpdatedAtFilter, | ||
| ) | ||
|
|
||
| from paddle_billing.Resources.Reports.Operations.CreateReport import ( | ||
| CreateReport, | ||
| ) | ||
|
|
||
|
|
||
| @dataclass | ||
| class CreatePayoutReconciliationReport(CreateReport): | ||
| type: PayoutReconciliationReportType | ||
| filters: list[RemittanceReferenceFilter | TransactionUpdatedAtFilter] = field(default_factory=list) | ||
|
|
||
| @staticmethod | ||
| def get_allowed_filters() -> tuple[RemittanceReferenceFilter | TransactionUpdatedAtFilter]: | ||
| return ( | ||
| RemittanceReferenceFilter, | ||
| TransactionUpdatedAtFilter, | ||
| ) |
18 changes: 18 additions & 0 deletions
18
paddle_billing/Resources/Reports/Operations/Filters/RemittanceReferenceFilter.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| from __future__ import annotations | ||
| from dataclasses import dataclass | ||
|
|
||
| from paddle_billing.Resources.Reports.Operations.Filters.Filter import Filter | ||
|
|
||
| from paddle_billing.Entities.Reports import ReportFilterName | ||
|
|
||
|
|
||
| @dataclass | ||
| class RemittanceReferenceFilter(Filter): | ||
| remittance_references: list[str] | ||
|
|
||
| @staticmethod | ||
| def get_name() -> ReportFilterName: | ||
| return ReportFilterName.RemittanceReference | ||
|
|
||
| def get_value(self) -> list[str]: | ||
| return self.remittance_references |
34 changes: 34 additions & 0 deletions
34
paddle_billing/Resources/Reports/Operations/Filters/TransactionUpdatedAtFilter.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| from __future__ import annotations | ||
| from dataclasses import dataclass | ||
|
|
||
| from paddle_billing.Entities.DateTime import DateTime | ||
|
|
||
| from paddle_billing.Entities.Reports import ReportFilterOperator | ||
|
|
||
| from paddle_billing.Resources.Reports.Operations.Filters.Filter import Filter | ||
|
|
||
| from paddle_billing.Entities.Reports import ReportFilterName | ||
|
|
||
|
|
||
| @dataclass | ||
| class TransactionUpdatedAtFilter(Filter): | ||
| operator: ReportFilterOperator | ||
| value: DateTime | ||
|
|
||
| @staticmethod | ||
| def get_name() -> ReportFilterName: | ||
| return ReportFilterName.TransactionUpdatedAt | ||
|
|
||
| def get_operator(self) -> ReportFilterOperator | None: | ||
| return self.operator | ||
|
|
||
| def get_value(self) -> str: | ||
| return self.value.format() | ||
|
|
||
| @staticmethod | ||
| def gte(value: DateTime) -> TransactionUpdatedAtFilter: | ||
| return TransactionUpdatedAtFilter(value=value, operator=ReportFilterOperator.Gte) | ||
|
|
||
| @staticmethod | ||
| def lt(value: DateTime) -> TransactionUpdatedAtFilter: | ||
| return TransactionUpdatedAtFilter(value=value, operator=ReportFilterOperator.Lt) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| from paddle_billing.Resources.Reports.Operations.CreateAdjustmentsReport import CreateAdjustmentsReport | ||
| from paddle_billing.Resources.Reports.Operations.CreateBalanceReport import CreateBalanceReport | ||
| from paddle_billing.Resources.Reports.Operations.CreateDiscountsReport import CreateDiscountsReport | ||
| from paddle_billing.Resources.Reports.Operations.CreatePayoutReconciliationReport import ( | ||
| CreatePayoutReconciliationReport, | ||
| ) | ||
| from paddle_billing.Resources.Reports.Operations.CreateProductsAndPricesReport import CreateProductsAndPricesReport | ||
| from paddle_billing.Resources.Reports.Operations.CreateReport import CreateReport | ||
| from paddle_billing.Resources.Reports.Operations.CreateTransactionsReport import CreateTransactionsReport | ||
| from paddle_billing.Resources.Reports.Operations.ListReports import ListReports | ||
3 changes: 3 additions & 0 deletions
3
tests/Functional/Resources/Reports/_fixtures/request/create_payout_reconciliation_basic.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "type": "payout_reconciliation" | ||
| } |
22 changes: 22 additions & 0 deletions
22
tests/Functional/Resources/Reports/_fixtures/request/create_payout_reconciliation_full.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| { | ||
| "type": "payout_reconciliation", | ||
| "filters": [ | ||
| { | ||
| "name": "remittance_reference", | ||
| "operator": null, | ||
| "value": [ | ||
| "some-reference" | ||
| ] | ||
| }, | ||
| { | ||
| "name": "transaction_updated_at", | ||
| "operator": "gte", | ||
| "value": "2023-12-30T00:00:00.000000Z" | ||
| }, | ||
| { | ||
| "name": "transaction_updated_at", | ||
| "operator": "lt", | ||
| "value": "2024-12-30T12:30:01.123456Z" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Fixes
ReportsClient.create()operation type