Merge branch 'development' of ssh://git.eigen.co.id:2222/eigen/pos-be into feat/report

pull/52/head
Firman Ramdhani 2024-08-06 11:37:59 +07:00
commit 26db7d2745
29 changed files with 464 additions and 470 deletions

View File

@ -12,5 +12,6 @@ COPY env/$env_target /app/.env
COPY --from=builder /app/env/$env_target .env
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/assets ./assets
COPY --from=builder /app/package.json ./package.json
CMD ["node", "--max-old-space-size=8192","--max-http-header-size", "512000", "-r", "dotenv/config", "dist/main"]

View File

@ -1,412 +1,412 @@
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Email Confirmation</title>
<style>
/* -------------------------------------
GLOBAL RESETS
------------------------------------- */
img {
border: none;
-ms-interpolation-mode: bicubic;
max-width: 100%;
}
body {
background-color: #f6f6f6;
font-family: sans-serif;
-webkit-font-smoothing: antialiased;
font-size: 14px;
line-height: 1.4;
margin: 0;
padding: 0;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
table {
border-collapse: separate;
mso-table-lspace: 0pt;
width: 100%;
}
table td {
font-family: sans-serif;
font-size: 14px;
vertical-align: top;
}
/* -------------------------------------
BODY & CONTAINER
------------------------------------- */
.body {
background-color: #f6f6f6;
width: 100%;
}
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink
down on a phone or something */
.container {
display: block;
Margin: 0 auto !important;
/* makes it centered */
max-width: 580px;
padding: 10px;
width: 580px;
}
/* This should also be a block element, so that it will fill 100% of the .container */
.content {
box-sizing: border-box;
display: block;
Margin: 0 auto;
max-width: 580px;
padding: 10px;
}
/* -------------------------------------
HEADER, FOOTER, MAIN
------------------------------------- */
.main {
background: #ffffff;
border-radius: 3px;
width: 100%;
}
.wrapper {
box-sizing: border-box;
padding: 20px;
}
.content-block {
padding-bottom: 10px;
padding-top: 10px;
}
.footer {
clear: both;
Margin-top: 10px;
text-align: center;
width: 100%;
}
.footer td,
.footer p,
.footer span,
.footer a {
color: #999999;
font-size: 12px;
text-align: center;
}
/* -------------------------------------
TYPOGRAPHY
------------------------------------- */
h1,
h2,
h3,
h4 {
color: #000000;
font-family: sans-serif;
font-weight: 400;
line-height: 1.4;
margin: 0;
Margin-bottom: 30px;
}
h1 {
font-size: 35px;
font-weight: 300;
text-align: center;
text-transform: capitalize;
}
p,
ul,
ol {
font-family: sans-serif;
font-size: 14px;
font-weight: normal;
margin: 0;
Margin-bottom: 15px;
}
p li,
ul li,
ol li {
list-style-position: inside;
margin-left: 5px;
}
a {
color: #3498db;
text-decoration: underline;
}
/* -------------------------------------
BUTTONS
------------------------------------- */
.btn {
box-sizing: border-box;
width: 100%;
}
.btn>tbody>tr>td {
padding-bottom: 15px;
}
.btn table {
width: auto;
}
.btn table td {
background-color: #ffffff;
border-radius: 5px;
text-align: center;
}
.btn a {
background-color: #ffffff;
border: solid 1px #3498db;
border-radius: 5px;
box-sizing: border-box;
color: #3498db;
cursor: pointer;
display: inline-block;
font-size: 14px;
font-weight: bold;
margin: 0;
padding: 12px 25px;
text-decoration: none;
text-transform: capitalize;
}
.btn-primary table td {
background-color: #3498db;
}
.btn-primary a {
background-color: #3498db;
border-color: #3498db;
color: #ffffff;
}
/* -------------------------------------
OTHER STYLES THAT MIGHT BE USEFUL
------------------------------------- */
.last {
margin-bottom: 0;
}
.first {
margin-top: 0;
}
.align-center {
text-align: center;
}
.align-right {
text-align: right;
}
.align-left {
text-align: left;
}
.clear {
clear: both;
}
.mt0 {
margin-top: 0;
}
.mb0 {
margin-bottom: 0;
}
.preheader {
color: transparent;
display: none;
height: 0;
max-height: 0;
max-width: 0;
opacity: 0;
overflow: hidden;
visibility: hidden;
width: 0;
}
.powered-by a {
text-decoration: none;
}
hr {
border: 0;
border-bottom: 1px solid #f6f6f6;
Margin: 20px 0;
}
/* -------------------------------------
RESPONSIVE AND MOBILE FRIENDLY STYLES
------------------------------------- */
@media only screen and (max-width: 620px) {
table[class=body] h1 {
font-size: 28px !important;
margin-bottom: 10px !important;
}
table[class=body] p,
table[class=body] ul,
table[class=body] ol,
table[class=body] td,
table[class=body] span,
table[class=body] a {
font-size: 16px !important;
}
table[class=body] .wrapper,
table[class=body] .article {
padding: 10px !important;
}
table[class=body] .content {
padding: 0 !important;
}
table[class=body] .container {
padding: 0 !important;
width: 100% !important;
}
table[class=body] .main {
border-left-width: 0 !important;
border-radius: 0 !important;
border-right-width: 0 !important;
}
table[class=body] .btn table {
width: 100% !important;
}
table[class=body] .btn a {
width: 100% !important;
}
table[class=body] .img-responsive {
height: auto !important;
max-width: 100% !important;
width: auto !important;
}
}
/* -------------------------------------
PRESERVE THESE STYLES IN THE HEAD
------------------------------------- */
@media all {
.ExternalClass {
width: 100%;
}
.ExternalClass,
.ExternalClass p,
.ExternalClass span,
.ExternalClass font,
.ExternalClass td,
.ExternalClass div {
line-height: 100%;
}
.apple-link a {
color: inherit !important;
font-family: inherit !important;
font-size: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
text-decoration: none !important;
}
.btn-primary table td:hover {
background-color: #34495e !important;
}
.btn-primary a:hover {
background-color: #34495e !important;
border-color: #34495e !important;
}
}
ol {
padding: 0 0 0 1em;
}
ol li {
margin: 1em 0;
}
</style>
</head>
<body class="">
<table border="0" cellpadding="0" cellspacing="0" class="body">
<tr>
<td>&nbsp;</td>
<td class="container">
<div class="content">
<table class="main">
<!-- START MAIN CONTENT AREA -->
<tr>
<td class="wrapper">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<p class="mb0"><b>Dear,</b></p>
<p class="mb0">{{customer_name}}</p>
<p>{{customer_phone}}</p>
<p class="mb0">We are excited to inform you that your payment has been successfully received!</p>
<p class="mb0">Attached to this email, you will find your confirmatin receipt</p>
<p class="mb0">Please keep this safe as you will need to show it at the entrance upon your arrival</p>
<p>It's your golden ticket to all the fun and excitement awaiting you!</p>
<br>
<p class="mb0">Here's a quick recap:</p>
<p class="mb0">Booking Date: {{booking_date}}</p>
<p class="mb0">Invoice Code: {{invoice_code}}</p>
<p class="mb0">Payment Date: {{payment_date}}</p>
<p class="mb0">Payment Code: {{payment_code}}</p>
<p class="mb0">Payment Via: {{payment_via}}</p>
<p class="mb0">Account No: {{account_no}}</p>
<p>On Behalf Of: {{account_name}}</p>
<br>
<p class="mb0">If you have any questions or need assistance, feel free to reach out to our support team at</p>
<b>{{phone_cs}}</b>
<br>
<p class="mb0">Font forget to bring a smile and your confirmation receipt (attached) for a smooth entry</p>
<p>We can't wait to see you and ensure you have an amazing time with us!</p>
<br><br>
<b>Best Regrads,</b><br>
<b>WEplayground</b>
</td>
</tr>
</table>
</td>
</tr>
<!-- END MAIN CONTENT AREA -->
</table>
</div>
</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Email Confirmation</title>
<style>
/* -------------------------------------
GLOBAL RESETS
------------------------------------- */
img {
border: none;
-ms-interpolation-mode: bicubic;
max-width: 100%;
}
body {
background-color: #f6f6f6;
font-family: sans-serif;
-webkit-font-smoothing: antialiased;
font-size: 14px;
line-height: 1.4;
margin: 0;
padding: 0;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
table {
border-collapse: separate;
mso-table-lspace: 0pt;
width: 100%;
}
table td {
font-family: sans-serif;
font-size: 14px;
vertical-align: top;
}
/* -------------------------------------
BODY & CONTAINER
------------------------------------- */
.body {
background-color: #f6f6f6;
width: 100%;
}
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink
down on a phone or something */
.container {
display: block;
Margin: 0 auto !important;
/* makes it centered */
max-width: 580px;
padding: 10px;
width: 580px;
}
/* This should also be a block element, so that it will fill 100% of the .container */
.content {
box-sizing: border-box;
display: block;
Margin: 0 auto;
max-width: 580px;
padding: 10px;
}
/* -------------------------------------
HEADER, FOOTER, MAIN
------------------------------------- */
.main {
background: #ffffff;
border-radius: 3px;
width: 100%;
}
.wrapper {
box-sizing: border-box;
padding: 20px;
}
.content-block {
padding-bottom: 10px;
padding-top: 10px;
}
.footer {
clear: both;
Margin-top: 10px;
text-align: center;
width: 100%;
}
.footer td,
.footer p,
.footer span,
.footer a {
color: #999999;
font-size: 12px;
text-align: center;
}
/* -------------------------------------
TYPOGRAPHY
------------------------------------- */
h1,
h2,
h3,
h4 {
color: #000000;
font-family: sans-serif;
font-weight: 400;
line-height: 1.4;
margin: 0;
Margin-bottom: 30px;
}
h1 {
font-size: 35px;
font-weight: 300;
text-align: center;
text-transform: capitalize;
}
p,
ul,
ol {
font-family: sans-serif;
font-size: 14px;
font-weight: normal;
margin: 0;
Margin-bottom: 15px;
}
p li,
ul li,
ol li {
list-style-position: inside;
margin-left: 5px;
}
a {
color: #3498db;
text-decoration: underline;
}
/* -------------------------------------
BUTTONS
------------------------------------- */
.btn {
box-sizing: border-box;
width: 100%;
}
.btn>tbody>tr>td {
padding-bottom: 15px;
}
.btn table {
width: auto;
}
.btn table td {
background-color: #ffffff;
border-radius: 5px;
text-align: center;
}
.btn a {
background-color: #ffffff;
border: solid 1px #3498db;
border-radius: 5px;
box-sizing: border-box;
color: #3498db;
cursor: pointer;
display: inline-block;
font-size: 14px;
font-weight: bold;
margin: 0;
padding: 12px 25px;
text-decoration: none;
text-transform: capitalize;
}
.btn-primary table td {
background-color: #3498db;
}
.btn-primary a {
background-color: #3498db;
border-color: #3498db;
color: #ffffff;
}
/* -------------------------------------
OTHER STYLES THAT MIGHT BE USEFUL
------------------------------------- */
.last {
margin-bottom: 0;
}
.first {
margin-top: 0;
}
.align-center {
text-align: center;
}
.align-right {
text-align: right;
}
.align-left {
text-align: left;
}
.clear {
clear: both;
}
.mt0 {
margin-top: 0;
}
.mb0 {
margin-bottom: 0;
}
.preheader {
color: transparent;
display: none;
height: 0;
max-height: 0;
max-width: 0;
opacity: 0;
overflow: hidden;
visibility: hidden;
width: 0;
}
.powered-by a {
text-decoration: none;
}
hr {
border: 0;
border-bottom: 1px solid #f6f6f6;
Margin: 20px 0;
}
/* -------------------------------------
RESPONSIVE AND MOBILE FRIENDLY STYLES
------------------------------------- */
@media only screen and (max-width: 620px) {
table[class=body] h1 {
font-size: 28px !important;
margin-bottom: 10px !important;
}
table[class=body] p,
table[class=body] ul,
table[class=body] ol,
table[class=body] td,
table[class=body] span,
table[class=body] a {
font-size: 16px !important;
}
table[class=body] .wrapper,
table[class=body] .article {
padding: 10px !important;
}
table[class=body] .content {
padding: 0 !important;
}
table[class=body] .container {
padding: 0 !important;
width: 100% !important;
}
table[class=body] .main {
border-left-width: 0 !important;
border-radius: 0 !important;
border-right-width: 0 !important;
}
table[class=body] .btn table {
width: 100% !important;
}
table[class=body] .btn a {
width: 100% !important;
}
table[class=body] .img-responsive {
height: auto !important;
max-width: 100% !important;
width: auto !important;
}
}
/* -------------------------------------
PRESERVE THESE STYLES IN THE HEAD
------------------------------------- */
@media all {
.ExternalClass {
width: 100%;
}
.ExternalClass,
.ExternalClass p,
.ExternalClass span,
.ExternalClass font,
.ExternalClass td,
.ExternalClass div {
line-height: 100%;
}
.apple-link a {
color: inherit !important;
font-family: inherit !important;
font-size: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
text-decoration: none !important;
}
.btn-primary table td:hover {
background-color: #34495e !important;
}
.btn-primary a:hover {
background-color: #34495e !important;
border-color: #34495e !important;
}
}
ol {
padding: 0 0 0 1em;
}
ol li {
margin: 1em 0;
}
</style>
</head>
<body class="">
<table border="0" cellpadding="0" cellspacing="0" class="body">
<tr>
<td>&nbsp;</td>
<td class="container">
<div class="content">
<table class="main">
<!-- START MAIN CONTENT AREA -->
<tr>
<td class="wrapper">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<p class="mb0"><b>Dear,</b></p>
<p class="mb0">{{customer_name}}</p>
<p>{{customer_phone}}</p>
<p class="mb0">We are excited to inform you that your payment has been successfully received!</p>
<p class="mb0">Attached to this email, you will find your confirmatin receipt</p>
<p class="mb0">Please keep this safe as you will need to show it at the entrance upon your arrival</p>
<p>It's your golden ticket to all the fun and excitement awaiting you!</p>
<br>
<p class="mb0">Here's a quick recap:</p>
<p class="mb0">Booking Date: {{booking_date}}</p>
<p class="mb0">Invoice Code: {{invoice_code}}</p>
<p class="mb0">Payment Date: {{payment_date}}</p>
<p class="mb0">Payment Code: {{payment_code}}</p>
<p class="mb0">Payment Via: {{payment_via}}</p>
<p class="mb0">Account No: {{account_no}}</p>
<p>On Behalf Of: {{account_name}}</p>
<br>
<p class="mb0">If you have any questions or need assistance, feel free to reach out to our support team at</p>
<b>{{phone_cs}}</b>
<br>
<p class="mb0">Font forget to bring a smile and your confirmation receipt (attached) for a smooth entry</p>
<p>We can't wait to see you and ensure you have an amazing time with us!</p>
<br><br>
<b>Best Regrads,</b><br>
<b>WEplayground</b>
</td>
</tr>
</table>
</td>
</tr>
<!-- END MAIN CONTENT AREA -->
</table>
</div>
</td>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>

View File

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

View File

@ -1,20 +1,20 @@
import { InvoiceTempalte } from '../invoice.template';
const PdfPrinter = require('pdfmake');
const { PassThrough } = require('stream');
import { InvoiceTemplate } from '../invoice.template';
import * as PdfPrinter from 'pdfmake';
import { PassThrough } from 'stream';
export async function GeneratePdf(transaction, invoiceType, banks) {
var fonts = {
const fonts = {
Roboto: {
normal: './fonts/Roboto-Regular.ttf',
bold: './fonts/Roboto-Medium.ttf',
italics: './fonts/Roboto-Italic.ttf',
bolditalics: './fonts/Roboto-MediumItalic.ttf',
normal: './assets/fonts/Roboto-Regular.ttf',
bold: './assets/fonts/Roboto-Medium.ttf',
italics: './assets/fonts/Roboto-Italic.ttf',
bolditalics: './assets/fonts/Roboto-MediumItalic.ttf',
},
};
const printer = new PdfPrinter(fonts);
const docDefinition = InvoiceTempalte(transaction, invoiceType, banks);
const docDefinition = InvoiceTemplate(transaction, invoiceType, banks);
const createPdfBuffer = (docDefinition) => {
return new Promise((resolve, reject) => {

View File

@ -11,12 +11,12 @@ import { InvoiceType } from '../../constants';
import { PaymentMethodEntity } from 'src/modules/transaction/payment-method/domain/entities/payment-method.entity';
import * as fs from 'fs';
export function InvoiceTempalte(
export function InvoiceTemplate(
transaction: TransactionEntity,
invoiceType: InvoiceType,
banks: PaymentMethodEntity[],
) {
const filePath = './image/logo.jpeg';
const filePath = './assets/image/logo.jpeg';
const imageBase64 = fs.readFileSync(filePath).toString('base64');
const imageUrl = `data:image/png;base64,${imageBase64}`;
@ -52,37 +52,37 @@ export function InvoiceTempalte(
{
layout: {
defaultBorder: false,
hLineWidth: function (i, node) {
hLineWidth: function () {
return 1;
},
vLineWidth: function (i, node) {
vLineWidth: function () {
return 1;
},
hLineColor: function (i, node) {
hLineColor: function (i) {
return i === 0 ? '#000000' : '#eaeaea';
},
vLineColor: function (i, node) {
vLineColor: function () {
return '#eaeaea';
},
hLineStyle: function (i, node) {
hLineStyle: function () {
// if (i === 0 || i === node.table.body.length) {
return null;
//}
},
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; },
paddingLeft: function (i, node) {
paddingLeft: function () {
return 10;
},
paddingRight: function (i, node) {
paddingRight: function () {
return 10;
},
paddingTop: function (i, node) {
paddingTop: function () {
return 3;
},
paddingBottom: function (i, node) {
paddingBottom: function () {
return 3;
},
fillColor: function (rowIndex, node, columnIndex) {
fillColor: function () {
return '#fff';
},
},
@ -95,37 +95,37 @@ export function InvoiceTempalte(
{
layout: {
defaultBorder: false,
hLineWidth: function (i, node) {
hLineWidth: function () {
return 1;
},
vLineWidth: function (i, node) {
vLineWidth: function () {
return 1;
},
hLineColor: function (i, node) {
hLineColor: function (i) {
return i === 3 ? '#000000' : '#eaeaea';
},
vLineColor: function (i, node) {
vLineColor: function () {
return '#eaeaea';
},
hLineStyle: function (i, node) {
hLineStyle: function () {
// if (i === 0 || i === node.table.body.length) {
return null;
//}
},
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; },
paddingLeft: function (i, node) {
// vLineStyle: function () { return {dash: { length: 10, space: 4 }}; },
paddingLeft: function () {
return 10;
},
paddingRight: function (i, node) {
paddingRight: function () {
return 10;
},
paddingTop: function (i, node) {
paddingTop: function () {
return 3;
},
paddingBottom: function (i, node) {
paddingBottom: function (i) {
return i === 2 ? 20 : 3;
},
fillColor: function (rowIndex, node, columnIndex) {
fillColor: function () {
return '#fff';
},
},
@ -145,37 +145,37 @@ export function InvoiceTempalte(
{
layout: {
defaultBorder: false,
hLineWidth: function (i, node) {
hLineWidth: function () {
return 1;
},
vLineWidth: function (i, node) {
vLineWidth: function () {
return 1;
},
hLineColor: function (i, node) {
hLineColor: function (i) {
return i === 0 ? '#000000' : '#eaeaea';
},
vLineColor: function (i, node) {
vLineColor: function () {
return '#eaeaea';
},
hLineStyle: function (i, node) {
hLineStyle: function () {
// if (i === 0 || i === node.table.body.length) {
return null;
//}
},
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; },
paddingLeft: function (i, node) {
// vLineStyle: function () { return {dash: { length: 10, space: 4 }}; },
paddingLeft: function () {
return 10;
},
paddingRight: function (i, node) {
paddingRight: function () {
return 10;
},
paddingTop: function (i, node) {
paddingTop: function () {
return 20;
},
paddingBottom: function (i, node) {
paddingBottom: function () {
return 3;
},
fillColor: function (rowIndex, node, columnIndex) {
fillColor: function () {
return '#fff';
},
},

View File

@ -1,6 +1,5 @@
import * as nodemailer from 'nodemailer';
import * as handlebars from 'handlebars';
import * as path from 'path';
import * as fs from 'fs';
import { TransactionPaymentType } from 'src/modules/transaction/transaction/constants';
import { InvoiceType } from 'src/modules/configuration/export/constants';
@ -18,11 +17,7 @@ export async function sendEmail(receivers, invoiceType, attachment?) {
for (const receiver of receivers) {
try {
const templateName = getTemplate(receiver.payment_type, invoiceType);
let templatePath = path.join(
__dirname,
`../email-template/${templateName}.html`,
);
templatePath = templatePath.replace(/dist/g, 'src');
const templatePath = `./assets/email-template/${templateName}.html`;
const templateSource = fs.readFileSync(templatePath, 'utf8');
const template = handlebars.compile(templateSource);
@ -44,7 +39,7 @@ export async function sendEmail(receivers, invoiceType, attachment?) {
await new Promise((f) => setTimeout(f, 2000));
smtpTransport.sendMail(emailContext, function (err, data) {
smtpTransport.sendMail(emailContext, function (err) {
if (err) {
console.log(err, `Error occurs on send to ${receiver.email}`);
} else {

View File

@ -9,8 +9,6 @@ import * as fs from 'fs';
@Public()
@Injectable()
export class MailTemplateController {
constructor() {}
getTemplate(templateName) {
const templatePath = path.join(
__dirname,
@ -52,6 +50,6 @@ export class MailTemplateController {
@Get('refund-request')
async getRefundRequest() {
return this.getTemplate('refunr-request');
return this.getTemplate('refund-request');
}
}

View File

@ -4,7 +4,7 @@ import { EventTopics } from 'src/core/strings/constants/interface.constants';
import { TransactionType } from 'src/modules/transaction/transaction/constants';
import { TransactionModel } from 'src/modules/transaction/transaction/data/models/transaction.model';
import { TransactionEntity } from 'src/modules/transaction/transaction/domain/entities/transaction.entity';
import { Between, ILike } from 'typeorm';
import { Between } from 'typeorm';
import * as _ from 'lodash';
import * as moment from 'moment';
import { EMPTY_UUID, STATUS } from 'src/core/strings/constants/base.constants';
@ -35,7 +35,7 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
const transactions = await this.dataService.getManyByOptions({
where: {
is_recap_transaction: false,
paymnet_type: TransactionType.COUNTER,
payment_type: TransactionType.COUNTER,
status: STATUS.SETTLED,
created_at: Between(this.startOfDay, this.endOfDay),
},
@ -72,7 +72,7 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
payment_type_method_id,
} = first_transaction;
let query = {
const query = {
is_recap_transaction: true,
created_at: Between(this.startOfDay, this.endOfDay),
creator_counter_no: creator_counter_no,

View File

@ -8,6 +8,7 @@ import { FormulaType } from 'src/modules/transaction/sales-price-formula/constan
import { STATUS } from 'src/core/strings/constants/base.constants';
import { TransactionModel } from '../../../data/models/transaction.model';
import { mappingRevertTransaction } from '../managers/helpers/mapping-transaction.helper';
import { apm } from '../../../../../../core/apm';
@EventsHandler(ChangeDocEvent)
export class PosTransactionHandler implements IEventHandler<ChangeDocEvent> {
@ -77,6 +78,7 @@ export class PosTransactionHandler implements IEventHandler<ChangeDocEvent> {
await this.dataService.create(queryRunner, TransactionModel, data);
}
} catch (error) {
apm.captureError(error);
console.log('error handling pos transaction couch');
}
}

View File

@ -31,9 +31,8 @@ export class CancelTransactionManager extends BaseUpdateStatusManager<Transactio
}
async beforeProcess(): Promise<void> {
const freeTransaction = this.data.payment_total < 1;
Object.assign(this.data, {
status: freeTransaction ? STATUS.ACTIVE : STATUS.PENDING,
status: STATUS.CANCEL,
});
return;
}

View File

@ -17,7 +17,6 @@ import { BatchConfirmDataTransactionManager } from './managers/batch-confirm-dat
import { MidtransService } from 'src/modules/configuration/midtrans/data/services/midtrans.service';
import { PdfMakeManager } from 'src/modules/configuration/export/domain/managers/pdf-make.manager';
import { PaymentMethodDataService } from 'src/modules/transaction/payment-method/data/services/payment-method-data.service';
import { InvoiceType } from 'src/modules/configuration/export/constants';
@Injectable()
export class TransactionDataOrchestrator {