From f19d0cc85ca67151cb642a2bd2cc4715e672aeb9 Mon Sep 17 00:00:00 2001 From: Francisco Date: Tue, 20 Aug 2024 01:27:49 +0200 Subject: [PATCH 1/4] Added previous_dispute_status attribute in order model Signed-off-by: Francisco --- models/order.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/models/order.ts b/models/order.ts index c811e4a0..8441aa9d 100644 --- a/models/order.ts +++ b/models/order.ts @@ -23,6 +23,7 @@ export interface IOrder extends Document { seller_cooperativecancel: boolean; canceled_by: string action_by: string + previous_dispute_status: string; status: string; type: string; fiat_amount: number; @@ -92,6 +93,13 @@ const orderSchema = new Schema({ seller_cooperativecancel: { type: Boolean, default: false }, canceled_by: { type: String }, action_by: { type: String }, + previous_dispute_status: { + type: String, + enum: [ + 'ACTIVE', // order taken + 'FIAT_SENT', // buyer indicates the fiat payment is already done + ], + }, status: { type: String, enum: [ From 183f368fc70fe3eb82cd476b3deaeb855406269c Mon Sep 17 00:00:00 2001 From: Francisco Date: Tue, 20 Aug 2024 02:24:26 +0200 Subject: [PATCH 2/4] Update previous dispute status when dispute created Signed-off-by: Francisco --- bot/modules/dispute/commands.js | 1 + 1 file changed, 1 insertion(+) diff --git a/bot/modules/dispute/commands.js b/bot/modules/dispute/commands.js index 3b056f0e..1d323b2d 100644 --- a/bot/modules/dispute/commands.js +++ b/bot/modules/dispute/commands.js @@ -35,6 +35,7 @@ const dispute = async ctx => { if (user._id == order.buyer_id) initiator = 'buyer'; order[`${initiator}_dispute`] = true; + order.previous_dispute_status = order.status order.status = 'DISPUTE'; const sellerToken = Math.floor(Math.random() * 899 + 100); const buyerToken = Math.floor(Math.random() * 899 + 100); From 2e0f4b7d44018305489fe2cf5e8fe23bc82a56c5 Mon Sep 17 00:00:00 2001 From: Francisco Date: Tue, 20 Aug 2024 02:25:24 +0200 Subject: [PATCH 3/4] Added previous dispute status message in 'en' and 'es' languages Signed-off-by: Francisco --- locales/en.yaml | 2 ++ locales/es.yaml | 4 +++- util/index.js | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/locales/en.yaml b/locales/en.yaml index ccc14802..e59f0797 100644 --- a/locales/en.yaml +++ b/locales/en.yaml @@ -158,6 +158,8 @@ buy_sats: Buy satoshis order_detail: | ID: `${order._id}` + Status previous to dispute: ${previousDisputeStatus} + Status: ${status} Creator: @${creator || ''} diff --git a/locales/es.yaml b/locales/es.yaml index 1e9ffa8d..a55eabdf 100644 --- a/locales/es.yaml +++ b/locales/es.yaml @@ -155,7 +155,9 @@ sell_sats: Vender satoshis buy_sats: Comprar satoshis order_detail: | Id: `${order._id}` - + + Status previo a disputa: ${previousDisputeStatus} + Status: ${status} Creador: @${creator || ''} diff --git a/util/index.js b/util/index.js index b332a9d1..628b2117 100644 --- a/util/index.js +++ b/util/index.js @@ -361,6 +361,7 @@ exports.getDetailedOrder = (i18n, order, buyer, seller) => { let takenAt = order.taken_at ? order.taken_at.toISOString() : ''; createdAt = sanitizeMD(createdAt); takenAt = sanitizeMD(takenAt); + const previousDisputeStatus = sanitizeMD(order.previous_dispute_status); const status = sanitizeMD(order.status); const fee = order.fee ? parseInt(order.fee) : ''; const creator = @@ -376,6 +377,7 @@ exports.getDetailedOrder = (i18n, order, buyer, seller) => { sellerUsername, createdAt, takenAt, + previousDisputeStatus, status, fee, paymentMethod, From 79c0862bc811e9e851128bcc60b6ea7f6a506426 Mon Sep 17 00:00:00 2001 From: Francisco Date: Tue, 20 Aug 2024 12:29:46 +0200 Subject: [PATCH 4/4] Added previous dispute status message in other languages (in english) Signed-off-by: Francisco --- locales/de.yaml | 2 ++ locales/fa.yaml | 2 ++ locales/fr.yaml | 2 ++ locales/it.yaml | 2 ++ locales/ko.yaml | 2 ++ locales/pt.yaml | 2 ++ locales/ru.yaml | 2 ++ locales/uk.yaml | 2 ++ 8 files changed, 16 insertions(+) diff --git a/locales/de.yaml b/locales/de.yaml index 7c625fa0..b5bb106f 100644 --- a/locales/de.yaml +++ b/locales/de.yaml @@ -156,6 +156,8 @@ buy_sats: Kaufe Sats order_detail: | Id: `${order._id}` + Status previous to dispute: ${previousDisputeStatus} + Status: ${status} Ersteller: @${creator || ''} diff --git a/locales/fa.yaml b/locales/fa.yaml index e1711d09..0a54b86a 100644 --- a/locales/fa.yaml +++ b/locales/fa.yaml @@ -158,6 +158,8 @@ buy_sats: خرید ساتوشی order_detail: | ID: `${order._id}` + Status previous to dispute: ${previousDisputeStatus} + Status: ${status} Creator: @${creator || ''} diff --git a/locales/fr.yaml b/locales/fr.yaml index 6c1037e7..e4d71263 100644 --- a/locales/fr.yaml +++ b/locales/fr.yaml @@ -158,6 +158,8 @@ buy_sats: Achète des satoshis order_detail: | ID : `${order._id}` + Situation antérieure au litige: ${previousDisputeStatus} + Statut : ${status} Créateur : @${creator || ''} diff --git a/locales/it.yaml b/locales/it.yaml index 3154a320..ae6591b8 100644 --- a/locales/it.yaml +++ b/locales/it.yaml @@ -156,6 +156,8 @@ buy_sats: Compra satoshis order_detail: | Id: `${order._id}` + Stato precedente alla controversia: ${previousDisputeStatus} + Stato: ${status} Creato da: @${creator || ''} diff --git a/locales/ko.yaml b/locales/ko.yaml index dd3a2259..94d9185a 100644 --- a/locales/ko.yaml +++ b/locales/ko.yaml @@ -157,6 +157,8 @@ buy_sats: 비트코인 구매 order_detail: | ID: `${order._id}` + Status previous to dispute: ${previousDisputeStatus} + 상태: ${status} 생성자: @${creator || ''} diff --git a/locales/pt.yaml b/locales/pt.yaml index 491cc87c..cd88635c 100644 --- a/locales/pt.yaml +++ b/locales/pt.yaml @@ -155,6 +155,8 @@ buy_sats: Compre Satoshis order_detail: | Id: `${order._id}` + Situação anterior ao litígio: ${previousDisputeStatus} + Status: ${status} Criadora: @${creator || ''} diff --git a/locales/ru.yaml b/locales/ru.yaml index 320cd1fc..0db75af4 100644 --- a/locales/ru.yaml +++ b/locales/ru.yaml @@ -154,6 +154,8 @@ sell_sats: Продать сатоши buy_sats: Купить сатоши order_detail: | Id: `${order._id}` + + Status previous to dispute: ${previousDisputeStatus} Статус: ${status} diff --git a/locales/uk.yaml b/locales/uk.yaml index 24090417..c6dace62 100644 --- a/locales/uk.yaml +++ b/locales/uk.yaml @@ -154,6 +154,8 @@ sell_sats: Продати сатоші buy_sats: Купити сатоші order_detail: | Id: `${order._id}` + + Status previous to dispute: ${previousDisputeStatus} Статус: ${status}