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/env/$env_target .env
COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist COPY --from=builder /app/dist ./dist
COPY --from=builder /app/assets ./assets
COPY --from=builder /app/package.json ./package.json 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"] 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> <!doctype html>
<html> <html>
<head> <head>
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Email Confirmation</title> <title>Email Confirmation</title>
<style> <style>
/* ------------------------------------- /* -------------------------------------
GLOBAL RESETS GLOBAL RESETS
------------------------------------- */ ------------------------------------- */
img { img {
border: none; border: none;
-ms-interpolation-mode: bicubic; -ms-interpolation-mode: bicubic;
max-width: 100%; max-width: 100%;
} }
body { body {
background-color: #f6f6f6; background-color: #f6f6f6;
font-family: sans-serif; font-family: sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
font-size: 14px; font-size: 14px;
line-height: 1.4; line-height: 1.4;
margin: 0; margin: 0;
padding: 0; padding: 0;
-ms-text-size-adjust: 100%; -ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
} }
table { table {
border-collapse: separate; border-collapse: separate;
mso-table-lspace: 0pt; mso-table-lspace: 0pt;
width: 100%; width: 100%;
} }
table td { table td {
font-family: sans-serif; font-family: sans-serif;
font-size: 14px; font-size: 14px;
vertical-align: top; vertical-align: top;
} }
/* ------------------------------------- /* -------------------------------------
BODY & CONTAINER BODY & CONTAINER
------------------------------------- */ ------------------------------------- */
.body { .body {
background-color: #f6f6f6; background-color: #f6f6f6;
width: 100%; width: 100%;
} }
/* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink /* 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 */ down on a phone or something */
.container { .container {
display: block; display: block;
Margin: 0 auto !important; Margin: 0 auto !important;
/* makes it centered */ /* makes it centered */
max-width: 580px; max-width: 580px;
padding: 10px; padding: 10px;
width: 580px; width: 580px;
} }
/* This should also be a block element, so that it will fill 100% of the .container */ /* This should also be a block element, so that it will fill 100% of the .container */
.content { .content {
box-sizing: border-box; box-sizing: border-box;
display: block; display: block;
Margin: 0 auto; Margin: 0 auto;
max-width: 580px; max-width: 580px;
padding: 10px; padding: 10px;
} }
/* ------------------------------------- /* -------------------------------------
HEADER, FOOTER, MAIN HEADER, FOOTER, MAIN
------------------------------------- */ ------------------------------------- */
.main { .main {
background: #ffffff; background: #ffffff;
border-radius: 3px; border-radius: 3px;
width: 100%; width: 100%;
} }
.wrapper { .wrapper {
box-sizing: border-box; box-sizing: border-box;
padding: 20px; padding: 20px;
} }
.content-block { .content-block {
padding-bottom: 10px; padding-bottom: 10px;
padding-top: 10px; padding-top: 10px;
} }
.footer { .footer {
clear: both; clear: both;
Margin-top: 10px; Margin-top: 10px;
text-align: center; text-align: center;
width: 100%; width: 100%;
} }
.footer td, .footer td,
.footer p, .footer p,
.footer span, .footer span,
.footer a { .footer a {
color: #999999; color: #999999;
font-size: 12px; font-size: 12px;
text-align: center; text-align: center;
} }
/* ------------------------------------- /* -------------------------------------
TYPOGRAPHY TYPOGRAPHY
------------------------------------- */ ------------------------------------- */
h1, h1,
h2, h2,
h3, h3,
h4 { h4 {
color: #000000; color: #000000;
font-family: sans-serif; font-family: sans-serif;
font-weight: 400; font-weight: 400;
line-height: 1.4; line-height: 1.4;
margin: 0; margin: 0;
Margin-bottom: 30px; Margin-bottom: 30px;
} }
h1 { h1 {
font-size: 35px; font-size: 35px;
font-weight: 300; font-weight: 300;
text-align: center; text-align: center;
text-transform: capitalize; text-transform: capitalize;
} }
p, p,
ul, ul,
ol { ol {
font-family: sans-serif; font-family: sans-serif;
font-size: 14px; font-size: 14px;
font-weight: normal; font-weight: normal;
margin: 0; margin: 0;
Margin-bottom: 15px; Margin-bottom: 15px;
} }
p li, p li,
ul li, ul li,
ol li { ol li {
list-style-position: inside; list-style-position: inside;
margin-left: 5px; margin-left: 5px;
} }
a { a {
color: #3498db; color: #3498db;
text-decoration: underline; text-decoration: underline;
} }
/* ------------------------------------- /* -------------------------------------
BUTTONS BUTTONS
------------------------------------- */ ------------------------------------- */
.btn { .btn {
box-sizing: border-box; box-sizing: border-box;
width: 100%; width: 100%;
} }
.btn>tbody>tr>td { .btn>tbody>tr>td {
padding-bottom: 15px; padding-bottom: 15px;
} }
.btn table { .btn table {
width: auto; width: auto;
} }
.btn table td { .btn table td {
background-color: #ffffff; background-color: #ffffff;
border-radius: 5px; border-radius: 5px;
text-align: center; text-align: center;
} }
.btn a { .btn a {
background-color: #ffffff; background-color: #ffffff;
border: solid 1px #3498db; border: solid 1px #3498db;
border-radius: 5px; border-radius: 5px;
box-sizing: border-box; box-sizing: border-box;
color: #3498db; color: #3498db;
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
font-size: 14px; font-size: 14px;
font-weight: bold; font-weight: bold;
margin: 0; margin: 0;
padding: 12px 25px; padding: 12px 25px;
text-decoration: none; text-decoration: none;
text-transform: capitalize; text-transform: capitalize;
} }
.btn-primary table td { .btn-primary table td {
background-color: #3498db; background-color: #3498db;
} }
.btn-primary a { .btn-primary a {
background-color: #3498db; background-color: #3498db;
border-color: #3498db; border-color: #3498db;
color: #ffffff; color: #ffffff;
} }
/* ------------------------------------- /* -------------------------------------
OTHER STYLES THAT MIGHT BE USEFUL OTHER STYLES THAT MIGHT BE USEFUL
------------------------------------- */ ------------------------------------- */
.last { .last {
margin-bottom: 0; margin-bottom: 0;
} }
.first { .first {
margin-top: 0; margin-top: 0;
} }
.align-center { .align-center {
text-align: center; text-align: center;
} }
.align-right { .align-right {
text-align: right; text-align: right;
} }
.align-left { .align-left {
text-align: left; text-align: left;
} }
.clear { .clear {
clear: both; clear: both;
} }
.mt0 { .mt0 {
margin-top: 0; margin-top: 0;
} }
.mb0 { .mb0 {
margin-bottom: 0; margin-bottom: 0;
} }
.preheader { .preheader {
color: transparent; color: transparent;
display: none; display: none;
height: 0; height: 0;
max-height: 0; max-height: 0;
max-width: 0; max-width: 0;
opacity: 0; opacity: 0;
overflow: hidden; overflow: hidden;
visibility: hidden; visibility: hidden;
width: 0; width: 0;
} }
.powered-by a { .powered-by a {
text-decoration: none; text-decoration: none;
} }
hr { hr {
border: 0; border: 0;
border-bottom: 1px solid #f6f6f6; border-bottom: 1px solid #f6f6f6;
Margin: 20px 0; Margin: 20px 0;
} }
/* ------------------------------------- /* -------------------------------------
RESPONSIVE AND MOBILE FRIENDLY STYLES RESPONSIVE AND MOBILE FRIENDLY STYLES
------------------------------------- */ ------------------------------------- */
@media only screen and (max-width: 620px) { @media only screen and (max-width: 620px) {
table[class=body] h1 { table[class=body] h1 {
font-size: 28px !important; font-size: 28px !important;
margin-bottom: 10px !important; margin-bottom: 10px !important;
} }
table[class=body] p, table[class=body] p,
table[class=body] ul, table[class=body] ul,
table[class=body] ol, table[class=body] ol,
table[class=body] td, table[class=body] td,
table[class=body] span, table[class=body] span,
table[class=body] a { table[class=body] a {
font-size: 16px !important; font-size: 16px !important;
} }
table[class=body] .wrapper, table[class=body] .wrapper,
table[class=body] .article { table[class=body] .article {
padding: 10px !important; padding: 10px !important;
} }
table[class=body] .content { table[class=body] .content {
padding: 0 !important; padding: 0 !important;
} }
table[class=body] .container { table[class=body] .container {
padding: 0 !important; padding: 0 !important;
width: 100% !important; width: 100% !important;
} }
table[class=body] .main { table[class=body] .main {
border-left-width: 0 !important; border-left-width: 0 !important;
border-radius: 0 !important; border-radius: 0 !important;
border-right-width: 0 !important; border-right-width: 0 !important;
} }
table[class=body] .btn table { table[class=body] .btn table {
width: 100% !important; width: 100% !important;
} }
table[class=body] .btn a { table[class=body] .btn a {
width: 100% !important; width: 100% !important;
} }
table[class=body] .img-responsive { table[class=body] .img-responsive {
height: auto !important; height: auto !important;
max-width: 100% !important; max-width: 100% !important;
width: auto !important; width: auto !important;
} }
} }
/* ------------------------------------- /* -------------------------------------
PRESERVE THESE STYLES IN THE HEAD PRESERVE THESE STYLES IN THE HEAD
------------------------------------- */ ------------------------------------- */
@media all { @media all {
.ExternalClass { .ExternalClass {
width: 100%; width: 100%;
} }
.ExternalClass, .ExternalClass,
.ExternalClass p, .ExternalClass p,
.ExternalClass span, .ExternalClass span,
.ExternalClass font, .ExternalClass font,
.ExternalClass td, .ExternalClass td,
.ExternalClass div { .ExternalClass div {
line-height: 100%; line-height: 100%;
} }
.apple-link a { .apple-link a {
color: inherit !important; color: inherit !important;
font-family: inherit !important; font-family: inherit !important;
font-size: inherit !important; font-size: inherit !important;
font-weight: inherit !important; font-weight: inherit !important;
line-height: inherit !important; line-height: inherit !important;
text-decoration: none !important; text-decoration: none !important;
} }
.btn-primary table td:hover { .btn-primary table td:hover {
background-color: #34495e !important; background-color: #34495e !important;
} }
.btn-primary a:hover { .btn-primary a:hover {
background-color: #34495e !important; background-color: #34495e !important;
border-color: #34495e !important; border-color: #34495e !important;
} }
} }
ol { ol {
padding: 0 0 0 1em; padding: 0 0 0 1em;
} }
ol li { ol li {
margin: 1em 0; margin: 1em 0;
} }
</style> </style>
</head> </head>
<body class=""> <body class="">
<table border="0" cellpadding="0" cellspacing="0" class="body"> <table border="0" cellpadding="0" cellspacing="0" class="body">
<tr> <tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td class="container"> <td class="container">
<div class="content"> <div class="content">
<table class="main"> <table class="main">
<!-- START MAIN CONTENT AREA --> <!-- START MAIN CONTENT AREA -->
<tr> <tr>
<td class="wrapper"> <td class="wrapper">
<table border="0" cellpadding="0" cellspacing="0"> <table border="0" cellpadding="0" cellspacing="0">
<tr> <tr>
<td> <td>
<p class="mb0"><b>Dear,</b></p> <p class="mb0"><b>Dear,</b></p>
<p class="mb0">{{customer_name}}</p> <p class="mb0">{{customer_name}}</p>
<p>{{customer_phone}}</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">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">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 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> <p>It's your golden ticket to all the fun and excitement awaiting you!</p>
<br> <br>
<p class="mb0">Here's a quick recap:</p> <p class="mb0">Here's a quick recap:</p>
<p class="mb0">Booking Date: {{booking_date}}</p> <p class="mb0">Booking Date: {{booking_date}}</p>
<p class="mb0">Invoice Code: {{invoice_code}}</p> <p class="mb0">Invoice Code: {{invoice_code}}</p>
<p class="mb0">Payment Date: {{payment_date}}</p> <p class="mb0">Payment Date: {{payment_date}}</p>
<p class="mb0">Payment Code: {{payment_code}}</p> <p class="mb0">Payment Code: {{payment_code}}</p>
<p class="mb0">Payment Via: {{payment_via}}</p> <p class="mb0">Payment Via: {{payment_via}}</p>
<p class="mb0">Account No: {{account_no}}</p> <p class="mb0">Account No: {{account_no}}</p>
<p>On Behalf Of: {{account_name}}</p> <p>On Behalf Of: {{account_name}}</p>
<br> <br>
<p class="mb0">If you have any questions or need assistance, feel free to reach out to our support team at</p> <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> <b>{{phone_cs}}</b>
<br> <br>
<p class="mb0">Font forget to bring a smile and your confirmation receipt (attached) for a smooth entry</p> <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> <p>We can't wait to see you and ensure you have an amazing time with us!</p>
<br><br> <br><br>
<b>Best Regrads,</b><br> <b>Best Regrads,</b><br>
<b>WEplayground</b> <b>WEplayground</b>
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
<!-- END MAIN CONTENT AREA --> <!-- END MAIN CONTENT AREA -->
</table> </table>
</div> </div>
</td> </td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
</table> </table>
</body> </body>
</html> </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'; import { InvoiceTemplate } from '../invoice.template';
const PdfPrinter = require('pdfmake'); import * as PdfPrinter from 'pdfmake';
const { PassThrough } = require('stream'); import { PassThrough } from 'stream';
export async function GeneratePdf(transaction, invoiceType, banks) { export async function GeneratePdf(transaction, invoiceType, banks) {
var fonts = { const fonts = {
Roboto: { Roboto: {
normal: './fonts/Roboto-Regular.ttf', normal: './assets/fonts/Roboto-Regular.ttf',
bold: './fonts/Roboto-Medium.ttf', bold: './assets/fonts/Roboto-Medium.ttf',
italics: './fonts/Roboto-Italic.ttf', italics: './assets/fonts/Roboto-Italic.ttf',
bolditalics: './fonts/Roboto-MediumItalic.ttf', bolditalics: './assets/fonts/Roboto-MediumItalic.ttf',
}, },
}; };
const printer = new PdfPrinter(fonts); const printer = new PdfPrinter(fonts);
const docDefinition = InvoiceTempalte(transaction, invoiceType, banks); const docDefinition = InvoiceTemplate(transaction, invoiceType, banks);
const createPdfBuffer = (docDefinition) => { const createPdfBuffer = (docDefinition) => {
return new Promise((resolve, reject) => { 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 { PaymentMethodEntity } from 'src/modules/transaction/payment-method/domain/entities/payment-method.entity';
import * as fs from 'fs'; import * as fs from 'fs';
export function InvoiceTempalte( export function InvoiceTemplate(
transaction: TransactionEntity, transaction: TransactionEntity,
invoiceType: InvoiceType, invoiceType: InvoiceType,
banks: PaymentMethodEntity[], banks: PaymentMethodEntity[],
) { ) {
const filePath = './image/logo.jpeg'; const filePath = './assets/image/logo.jpeg';
const imageBase64 = fs.readFileSync(filePath).toString('base64'); const imageBase64 = fs.readFileSync(filePath).toString('base64');
const imageUrl = `data:image/png;base64,${imageBase64}`; const imageUrl = `data:image/png;base64,${imageBase64}`;
@ -52,37 +52,37 @@ export function InvoiceTempalte(
{ {
layout: { layout: {
defaultBorder: false, defaultBorder: false,
hLineWidth: function (i, node) { hLineWidth: function () {
return 1; return 1;
}, },
vLineWidth: function (i, node) { vLineWidth: function () {
return 1; return 1;
}, },
hLineColor: function (i, node) { hLineColor: function (i) {
return i === 0 ? '#000000' : '#eaeaea'; return i === 0 ? '#000000' : '#eaeaea';
}, },
vLineColor: function (i, node) { vLineColor: function () {
return '#eaeaea'; return '#eaeaea';
}, },
hLineStyle: function (i, node) { hLineStyle: function () {
// if (i === 0 || i === node.table.body.length) { // if (i === 0 || i === node.table.body.length) {
return null; return null;
//} //}
}, },
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; }, // vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; },
paddingLeft: function (i, node) { paddingLeft: function () {
return 10; return 10;
}, },
paddingRight: function (i, node) { paddingRight: function () {
return 10; return 10;
}, },
paddingTop: function (i, node) { paddingTop: function () {
return 3; return 3;
}, },
paddingBottom: function (i, node) { paddingBottom: function () {
return 3; return 3;
}, },
fillColor: function (rowIndex, node, columnIndex) { fillColor: function () {
return '#fff'; return '#fff';
}, },
}, },
@ -95,37 +95,37 @@ export function InvoiceTempalte(
{ {
layout: { layout: {
defaultBorder: false, defaultBorder: false,
hLineWidth: function (i, node) { hLineWidth: function () {
return 1; return 1;
}, },
vLineWidth: function (i, node) { vLineWidth: function () {
return 1; return 1;
}, },
hLineColor: function (i, node) { hLineColor: function (i) {
return i === 3 ? '#000000' : '#eaeaea'; return i === 3 ? '#000000' : '#eaeaea';
}, },
vLineColor: function (i, node) { vLineColor: function () {
return '#eaeaea'; return '#eaeaea';
}, },
hLineStyle: function (i, node) { hLineStyle: function () {
// if (i === 0 || i === node.table.body.length) { // if (i === 0 || i === node.table.body.length) {
return null; return null;
//} //}
}, },
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; }, // vLineStyle: function () { return {dash: { length: 10, space: 4 }}; },
paddingLeft: function (i, node) { paddingLeft: function () {
return 10; return 10;
}, },
paddingRight: function (i, node) { paddingRight: function () {
return 10; return 10;
}, },
paddingTop: function (i, node) { paddingTop: function () {
return 3; return 3;
}, },
paddingBottom: function (i, node) { paddingBottom: function (i) {
return i === 2 ? 20 : 3; return i === 2 ? 20 : 3;
}, },
fillColor: function (rowIndex, node, columnIndex) { fillColor: function () {
return '#fff'; return '#fff';
}, },
}, },
@ -145,37 +145,37 @@ export function InvoiceTempalte(
{ {
layout: { layout: {
defaultBorder: false, defaultBorder: false,
hLineWidth: function (i, node) { hLineWidth: function () {
return 1; return 1;
}, },
vLineWidth: function (i, node) { vLineWidth: function () {
return 1; return 1;
}, },
hLineColor: function (i, node) { hLineColor: function (i) {
return i === 0 ? '#000000' : '#eaeaea'; return i === 0 ? '#000000' : '#eaeaea';
}, },
vLineColor: function (i, node) { vLineColor: function () {
return '#eaeaea'; return '#eaeaea';
}, },
hLineStyle: function (i, node) { hLineStyle: function () {
// if (i === 0 || i === node.table.body.length) { // if (i === 0 || i === node.table.body.length) {
return null; return null;
//} //}
}, },
// vLineStyle: function (i, node) { return {dash: { length: 10, space: 4 }}; }, // vLineStyle: function () { return {dash: { length: 10, space: 4 }}; },
paddingLeft: function (i, node) { paddingLeft: function () {
return 10; return 10;
}, },
paddingRight: function (i, node) { paddingRight: function () {
return 10; return 10;
}, },
paddingTop: function (i, node) { paddingTop: function () {
return 20; return 20;
}, },
paddingBottom: function (i, node) { paddingBottom: function () {
return 3; return 3;
}, },
fillColor: function (rowIndex, node, columnIndex) { fillColor: function () {
return '#fff'; return '#fff';
}, },
}, },

View File

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

View File

@ -9,8 +9,6 @@ import * as fs from 'fs';
@Public() @Public()
@Injectable() @Injectable()
export class MailTemplateController { export class MailTemplateController {
constructor() {}
getTemplate(templateName) { getTemplate(templateName) {
const templatePath = path.join( const templatePath = path.join(
__dirname, __dirname,
@ -52,6 +50,6 @@ export class MailTemplateController {
@Get('refund-request') @Get('refund-request')
async getRefundRequest() { 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 { TransactionType } from 'src/modules/transaction/transaction/constants';
import { TransactionModel } from 'src/modules/transaction/transaction/data/models/transaction.model'; import { TransactionModel } from 'src/modules/transaction/transaction/data/models/transaction.model';
import { TransactionEntity } from 'src/modules/transaction/transaction/domain/entities/transaction.entity'; 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 _ from 'lodash';
import * as moment from 'moment'; import * as moment from 'moment';
import { EMPTY_UUID, STATUS } from 'src/core/strings/constants/base.constants'; 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({ const transactions = await this.dataService.getManyByOptions({
where: { where: {
is_recap_transaction: false, is_recap_transaction: false,
paymnet_type: TransactionType.COUNTER, payment_type: TransactionType.COUNTER,
status: STATUS.SETTLED, status: STATUS.SETTLED,
created_at: Between(this.startOfDay, this.endOfDay), created_at: Between(this.startOfDay, this.endOfDay),
}, },
@ -72,7 +72,7 @@ export class RecapReconciliationManager extends BaseCustomManager<TransactionEnt
payment_type_method_id, payment_type_method_id,
} = first_transaction; } = first_transaction;
let query = { const query = {
is_recap_transaction: true, is_recap_transaction: true,
created_at: Between(this.startOfDay, this.endOfDay), created_at: Between(this.startOfDay, this.endOfDay),
creator_counter_no: creator_counter_no, 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 { STATUS } from 'src/core/strings/constants/base.constants';
import { TransactionModel } from '../../../data/models/transaction.model'; import { TransactionModel } from '../../../data/models/transaction.model';
import { mappingRevertTransaction } from '../managers/helpers/mapping-transaction.helper'; import { mappingRevertTransaction } from '../managers/helpers/mapping-transaction.helper';
import { apm } from '../../../../../../core/apm';
@EventsHandler(ChangeDocEvent) @EventsHandler(ChangeDocEvent)
export class PosTransactionHandler implements IEventHandler<ChangeDocEvent> { export class PosTransactionHandler implements IEventHandler<ChangeDocEvent> {
@ -77,6 +78,7 @@ export class PosTransactionHandler implements IEventHandler<ChangeDocEvent> {
await this.dataService.create(queryRunner, TransactionModel, data); await this.dataService.create(queryRunner, TransactionModel, data);
} }
} catch (error) { } catch (error) {
apm.captureError(error);
console.log('error handling pos transaction couch'); console.log('error handling pos transaction couch');
} }
} }

View File

@ -31,9 +31,8 @@ export class CancelTransactionManager extends BaseUpdateStatusManager<Transactio
} }
async beforeProcess(): Promise<void> { async beforeProcess(): Promise<void> {
const freeTransaction = this.data.payment_total < 1;
Object.assign(this.data, { Object.assign(this.data, {
status: freeTransaction ? STATUS.ACTIVE : STATUS.PENDING, status: STATUS.CANCEL,
}); });
return; 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 { MidtransService } from 'src/modules/configuration/midtrans/data/services/midtrans.service';
import { PdfMakeManager } from 'src/modules/configuration/export/domain/managers/pdf-make.manager'; 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 { PaymentMethodDataService } from 'src/modules/transaction/payment-method/data/services/payment-method-data.service';
import { InvoiceType } from 'src/modules/configuration/export/constants';
@Injectable() @Injectable()
export class TransactionDataOrchestrator { export class TransactionDataOrchestrator {