Skip to content

Commit

Permalink
Merge pull request #136 from SocialGouv/fix/payment-completed-email
Browse files Browse the repository at this point in the history
fix: check oldStatus of order to send sync email
  • Loading branch information
ClementNumericite authored Nov 15, 2024
2 parents c6e279d + 79336b6 commit f088cad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions webapp/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

## [0.64.1](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.64.0...v0.64.1) (2024-11-15)


### Bug Fixes

- margin between blocs home ([92214ff](https://github.com/SocialGouv/carte-jeune-engage/commit/92214ff61bc23c50549ace6ac968403193a65fbd))
Expand Down
3 changes: 2 additions & 1 deletion webapp/src/server/api/routers/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ export const orderRouter = createTRPCRouter({
newStatus !== order.status ||
resultOrderStatusObject.etats_statut !== order.obiz_status
) {
const oldStatus = order.status;
order = await ctx.payload.update({
id: order_id,
collection: "orders",
Expand All @@ -325,7 +326,7 @@ export const orderRouter = createTRPCRouter({
},
});

if (newStatus !== order.status && newStatus === "payment_completed") {
if (newStatus !== oldStatus && newStatus === "payment_completed") {
const currentUser = await ctx.payload.findByID({
collection: "users",
id: order.user as number,
Expand Down

0 comments on commit f088cad

Please sign in to comment.