Skip to content

Commit

Permalink
Show the previous Status to DISPUTE in dispute message for solvers (#571
Browse files Browse the repository at this point in the history
)

* Added previous_dispute_status attribute in order model

Signed-off-by: Francisco <[email protected]>

* Update previous dispute status when dispute created

Signed-off-by: Francisco <[email protected]>

* Added previous dispute status message in 'en' and 'es' languages

Signed-off-by: Francisco <[email protected]>

* Added previous dispute status message in other languages (in english)

Signed-off-by: Francisco <[email protected]>

---------

Signed-off-by: Francisco <[email protected]>
  • Loading branch information
jgosmus authored Aug 25, 2024
1 parent a0e1aa3 commit c3b3241
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions bot/modules/dispute/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions locales/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ buy_sats: Kaufe Sats
order_detail: |
Id: `${order._id}`
Status previous to dispute: ${previousDisputeStatus}
Status: ${status}
Ersteller: @${creator || ''}
Expand Down
2 changes: 2 additions & 0 deletions locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ buy_sats: Buy satoshis
order_detail: |
ID: `${order._id}`
Status previous to dispute: ${previousDisputeStatus}
Status: ${status}
Creator: @${creator || ''}
Expand Down
4 changes: 3 additions & 1 deletion locales/es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 || ''}
Expand Down
2 changes: 2 additions & 0 deletions locales/fa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ buy_sats: خرید ساتوشی
order_detail: |
ID: `${order._id}`
Status previous to dispute: ${previousDisputeStatus}
Status: ${status}
Creator: @${creator || ''}
Expand Down
2 changes: 2 additions & 0 deletions locales/fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 || ''}
Expand Down
2 changes: 2 additions & 0 deletions locales/it.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ buy_sats: Compra satoshis
order_detail: |
Id: `${order._id}`
Stato precedente alla controversia: ${previousDisputeStatus}
Stato: ${status}
Creato da: @${creator || ''}
Expand Down
2 changes: 2 additions & 0 deletions locales/ko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ buy_sats: 비트코인 구매
order_detail: |
ID: `${order._id}`
Status previous to dispute: ${previousDisputeStatus}
상태: ${status}
생성자: @${creator || ''}
Expand Down
2 changes: 2 additions & 0 deletions locales/pt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ buy_sats: Compre Satoshis
order_detail: |
Id: `${order._id}`
Situação anterior ao litígio: ${previousDisputeStatus}
Status: ${status}
Criadora: @${creator || ''}
Expand Down
2 changes: 2 additions & 0 deletions locales/ru.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ sell_sats: Продать сатоши
buy_sats: Купить сатоши
order_detail: |
Id: `${order._id}`
Status previous to dispute: ${previousDisputeStatus}
Статус: ${status}
Expand Down
2 changes: 2 additions & 0 deletions locales/uk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ sell_sats: Продати сатоші
buy_sats: Купити сатоші
order_detail: |
Id: `${order._id}`
Status previous to dispute: ${previousDisputeStatus}
Статус: ${status}
Expand Down
8 changes: 8 additions & 0 deletions models/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -92,6 +93,13 @@ const orderSchema = new Schema<IOrder>({
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: [
Expand Down
2 changes: 2 additions & 0 deletions util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -376,6 +377,7 @@ exports.getDetailedOrder = (i18n, order, buyer, seller) => {
sellerUsername,
createdAt,
takenAt,
previousDisputeStatus,
status,
fee,
paymentMethod,
Expand Down

0 comments on commit c3b3241

Please sign in to comment.