-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OK-748 invalidate payments on demand
- Loading branch information
Showing
13 changed files
with
127 additions
and
8 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
resources/db/migration/V20241209__add_invalidated_at_to_invoices.sql
This file contains 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,29 @@ | ||
ALTER TABLE invoices ADD COLUMN invalidated_at TIMESTAMP; | ||
|
||
CREATE OR REPLACE VIEW all_invoices | ||
AS | ||
SELECT | ||
i.id, | ||
i.order_id, | ||
i.first_name, | ||
i.last_name, | ||
i.email, | ||
i.amount, | ||
i.origin, | ||
i.reference, | ||
i.due_date, | ||
i.created_at, | ||
s.secret, | ||
CASE | ||
WHEN p.paid_at IS NOT NULL THEN 'paid' | ||
WHEN i.invalidated_at IS NOT NULL THEN 'invalidated' | ||
WHEN i.due_date < CURRENT_DATE THEN 'overdue' | ||
ELSE 'active' | ||
END AS status, | ||
p.paid_at, | ||
i.metadata, | ||
i.vat, | ||
i.invalidated_at | ||
FROM invoices i | ||
LEFT OUTER JOIN latest_secrets s on (i.id = s.id) | ||
LEFT OUTER JOIN latest_payments p on (i.id = p.id); |
This file contains 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -73,7 +73,8 @@ | |
(s/enum | ||
:active | ||
:paid | ||
:overdue)) | ||
:overdue | ||
:invalidated)) | ||
|
||
(s/defschema LaskuRefList | ||
{:keys [s/Str]}) | ||
|
This file contains 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 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 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 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 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