Skip to content
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

Issue #470 Add validation on /settleorder #567

Merged
merged 2 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bot/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,12 @@ const initialize = (botToken: string, options: Partial<Telegraf.Options<MainCont
const order = await Order.findOne({ _id: orderId });
if (!order) return;

// Check if the order status is already PAID_HOLD_INVOICE
if (order.status === 'PAID_HOLD_INVOICE') {
await ctx.reply(ctx.i18n.t('order_already_settled'));
return;
}

// We look for a dispute for this order
const dispute = await Dispute.findOne({ order_id: order._id });

Expand Down
1 change: 1 addition & 0 deletions locales/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ invoice_require_hash: LN-Rechnung braucht einen Hash
order_id_invalid: Ungültige Auftrags-ID
order_invalid_type: Der ${type} Auftrag ist ungültig
order_already_taken: Dieser Auftrag wurde bereits von einem anderen Nutzer übernommen.
order_already_settled: Diese Bestellung wurde bereits abgewickelt und die Halte-Rechnung wurde bezahlt.
invalid_data: Du hast ungültige Daten gesendet, versuche es erneut.
begin_take_buy: |
🤖 Drücke auf Weiter, um das Angebot anzunehmen. Wenn du auf Abbrechen drückst, wird der Auftrag freigegeben und neu veröffentlicht. Du hast ${expirationTime} Minuten, bevor dieser Auftrag abläuft.
Expand Down
1 change: 1 addition & 0 deletions locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ invoice_require_hash: Invoice needs a hash
order_id_invalid: Invalid order ID
order_invalid_type: This ${type} order is invalid
order_already_taken: This order has already been taken by another user.
order_already_settled: This order has already been settled and the hold invoice has been paid.
invalid_data: You have sent invalid data, try again.
begin_take_buy: |
🤖 Press Continue to take the offer, if you press Cancel, you will be released from the order and it will be republished. You have ${expirationTime} minutes before this order expires. 👇
Expand Down
1 change: 1 addition & 0 deletions locales/es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ invoice_require_hash: La factura necesita un hash
order_id_invalid: Id de orden incorrecto
order_invalid_type: Esta orden es una ${type}
order_already_taken: Esta orden ya ha sido tomada por otro usuario
order_already_settled: Esta orden ya ha sido liquidada y la factura retenida ha sido pagada.
invalid_data: Has enviado datos incorrectos, inténtalo nuevamente.
begin_take_buy: |
🤖 Presiona Continuar para tomar la oferta, si presionas Cancelar te desvincularé de la orden y será publicada nuevamente, tienes ${expirationTime} minutos o la orden expirará 👇
Expand Down
1 change: 1 addition & 0 deletions locales/fa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ invoice_require_hash: فاکتور نیاز به هش دارد
order_id_invalid: شناسه سفارش نامعتبر است
order_invalid_type: این ${type} نوع سفارش نامعتبر است
order_already_taken: این سفارش قبلاً توسط کاربر دیگری گرفته شده است.
order_already_settled: این سفارش قبلا تسویه شده و فاکتور نگهداری پرداخت شده است.
invalid_data: داده های ارسال شده نامعتبر اند، دوباره امتحان کنید.
begin_take_buy: |
🤖 برای دریافت سفارش، ادامه را فشار دهید، اگر لغو را فشار دهید، از معامله خارج می شوید و سفارش مجدداً منتشر می شود. شما ${expirationTime} دقیقه قبل از انقضای این سفارش فرصت دارید. 👇
Expand Down
1 change: 1 addition & 0 deletions locales/fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ invoice_require_hash: La facture a besoin d'un hash
order_id_invalid: ID de facture invalide
order_invalid_type: Cette offre ${type} est invalide
order_already_taken: Cette offre a déjà été pris par un autre utilisateur.
order_already_settled: Cette commande a déjà été réglée et la facture de retenue a été payée.
invalid_data: Tu as envoyé des données invalides, merci de réessayer.
begin_take_buy: |
🤖 Appuie sur Continuer pour prendre l'offre, si tu clique sur Annuler, tu seras libéré.e de l'offre et elle sera publiée de nouveau. Tu as ${expirationTime} minutes avant que cette offre n'expire. 👇
Expand Down
1 change: 1 addition & 0 deletions locales/it.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ invoice_require_hash: La invoice necessita un hash
order_id_invalid: IOrder ID non valido
order_invalid_type: Questo ${type} ordine non è valido
order_already_taken: Quest'ordine è già stato preso da un altro utente.
order_already_settled: Questo ordine è già stato regolato e la fattura di trattenuta è stata pagata.
invalid_data: I dati inviati non sono validi, riprovare.
begin_take_buy: |
🤖 Premere Continua per accettare l'ordine, se premi Cancella verrai svincolato dall'ordine e sarà ripubblicato. Hai ${expirationTime} minuti prima che l'ordine scada. 👇
Expand Down
1 change: 1 addition & 0 deletions locales/ko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ invoice_require_hash: 인보이스에는 해쉬 값이 포함되어야 합니다
order_id_invalid: 주문 ID가 유효하지 않습니다.
order_invalid_type: 이런 ${type} 형태의 주문은 유효하지 않습니다.
order_already_taken: 이 주문은 이미 다른 사용자가 수락하였습니다.
order_already_settled: 이 주문은 이미 정산되었으며 보류 송장이 지불되었습니다.
invalid_data: 유효하지 않은 데이터를 보냈습니다. 다시 시도해보세요.
begin_take_buy: |
🤖 주문을 수락하려면 `계속` 버튼을 눌러 주세요. `취소` 버튼을 누르면, 당신은 해당 주문에서 나오게 되고, 주문은 마켓 채널에 재등록됩니다. 주문이 만료되기까지 ${expirationTime}분 남았습니다. 👇
Expand Down
1 change: 1 addition & 0 deletions locales/pt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ invoice_require_hash: Fatura precisa de um hash
order_id_invalid: ID do pedido inválido
order_invalid_type: Este ${type} pedido é inválido
order_already_taken: Este pedido já foi feito por outro usuário.
order_already_settled: Esta ordem já foi liquidada e a fatura retida foi paga.
invalid_data: Você enviou dados inválidos, tente novamente.
begin_take_buy: |
🤖 Pressione Continue aceitando a oferta, se você pressionar cancelar, será liberado do pedido e ela será republicada. Você tem ${expirationTime} minutos antes que esse pedido expire. 👇
Expand Down
1 change: 1 addition & 0 deletions locales/ru.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ invoice_require_hash: В счете не хватает контрольной
order_id_invalid: Номер заявки неверен
order_invalid_type: Это заявка типа ${type}
order_already_taken: Эту заявку уже исполнил другой пользователь
order_already_settled: Этот заказ уже урегулирован, и счет на удержание оплачен.
invalid_data: Вы отправили некорректные данные. Попробуйте заново.
begin_take_buy: |
🤖 Нажмите «Продолжить», чтобы принять предложение. Если вы нажмете «Отмена», заявка будет снова опубликована для всех. У вас есть ${expirationTime} минут для исполнения заявки. 👇
Expand Down
1 change: 1 addition & 0 deletions locales/uk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ invoice_require_hash: У рахунку не вистачає контрольн
order_id_invalid: Номер заявки невірний
order_invalid_type: Заявка ${type} невірна
order_already_taken: Цю заявку вже використав інший користувач
order_already_settled: Це замовлення вже врегульовано, і рахунок на утримання оплачено.
invalid_data: Ви надіслали неправильні дані. Спробуйте ще раз.
begin_take_buy: |
🤖 Натисніть "Продовжити", щоб прийняти пропозицію. Якщо Ви натиснете "Скасувати", заявка буде знову опублікована для всіх. Ви маєте ${expirationTime} хвилин для виконання заявки. 👇
Expand Down
Loading