Compare commits

..

No commits in common. "399ca0bdda14e4ae00ac3b4485545e343b70d64f" and "18afc47030deb1a6d02017de5a886261e9639819" have entirely different histories.

9 changed files with 0 additions and 172 deletions

View File

@ -1,19 +0,0 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class AddBookingDescriptionToItem1749537252986
implements MigrationInterface
{
name = 'AddBookingDescriptionToItem1749537252986';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "items" ADD "booking_description" text`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "items" DROP COLUMN "booking_description"`,
);
}
}

View File

@ -5,7 +5,6 @@ import { TransactionType } from 'src/modules/transaction/transaction/constants';
import { CreateTransactionManager } from 'src/modules/transaction/transaction/domain/usecases/managers/create-transaction.manager';
import { generateInvoiceCodeHelper } from 'src/modules/transaction/transaction/domain/usecases/managers/helpers/generate-invoice-code.helper';
import { mappingRevertTransaction } from 'src/modules/transaction/transaction/domain/usecases/managers/helpers/mapping-transaction.helper';
import { WhatsappService } from 'src/services/whatsapp/whatsapp.service';
import { v4 as uuidv4 } from 'uuid';
export class CreateBookingManager extends CreateTransactionManager {
@ -44,20 +43,4 @@ export class CreateBookingManager extends CreateTransactionManager {
});
return;
}
async afterProcess(): Promise<void> {
const whatsapp = new WhatsappService();
console.log(`/snap/v4/redirection/${this.data.payment_midtrans_token}`);
console.log(this.data.payment_midtrans_url);
await whatsapp.bookingRegister(
{
phone: this.data.customer_phone,
code: this.data.invoice_code,
name: this.data.customer_name,
time: this.data.booking_date,
id: this.data.id,
},
`snap/v4/redirection/${this.data.payment_midtrans_token}`,
);
}
}

View File

@ -57,13 +57,6 @@ export class RescheduleVerificationManager {
phone: transaction.customer_phone,
code: otp.toString(),
});
// whatsapp.bookingReschedule({
// phone: transaction.customer_phone,
// code: otp.toString(),
// name: transaction.customer_name,
// time: new Date(request.reschedule_date).getTime(),
// id: transaction.id,
// });
return result;
} catch (error) {
// You can customize the error handling as needed, e.g., throw HttpException for NestJS

View File

@ -27,9 +27,6 @@ export class ItemModel
@Column('varchar', { name: 'name', unique: true })
name: string;
@Column('text', { name: 'booking_description', nullable: true })
booking_description: string;
@Column('varchar', { name: 'image_url', nullable: true })
image_url: string;

View File

@ -18,5 +18,4 @@ export interface ItemEntity extends BaseStatusEntity {
use_queue: boolean;
show_to_booking: boolean;
breakdown_bundling?: boolean;
booking_description?: string;
}

View File

@ -56,7 +56,6 @@ export class DetailItemManager extends BaseDetailManager<ItemEntity> {
`${this.tableName}.show_to_booking`,
`${this.tableName}.breakdown_bundling`,
`${this.tableName}.play_estimation`,
`${this.tableName}.booking_description`,
`item_category.id`,
`item_category.name`,

View File

@ -54,7 +54,6 @@ export class IndexItemManager extends BaseIndexManager<ItemEntity> {
`${this.tableName}.breakdown_bundling`,
`${this.tableName}.play_estimation`,
`${this.tableName}.show_to_booking`,
`${this.tableName}.booking_description`,
`item_category.id`,
`item_category.name`,

View File

@ -138,17 +138,6 @@ export class ItemDto extends BaseStatusDto implements ItemEntity {
@ValidateIf((body) => body.show_to_booking)
show_to_booking: boolean;
@ApiProperty({
type: String,
required: false,
example: '...',
})
@ValidateIf((body) => body.show_to_booking)
@IsString({
message: 'Booking description is required when show to booking is enabled.',
})
booking_description: string;
@ApiProperty({
name: 'bundling_items',
type: [Object],

View File

@ -199,118 +199,6 @@ export class WhatsappService {
);
}
async bookingRegister(data: WhatsappBookingCreate, paymentUrl: string) {
const momentDate = moment(data.time);
const fallbackValue = momentDate.locale('id').format('dddd, DD MMMM YYYY');
const payload = {
messaging_product: 'whatsapp',
to: phoneNumberOnly(data.phone), // recipient's phone number
type: 'template',
template: {
name: 'booking_register',
language: {
code: 'id', // language code
},
components: [
{
type: 'body',
parameters: [
{
type: 'text',
parameter_name: 'customer',
text: data.name, // replace with name variable
},
{
type: 'text',
parameter_name: 'booking_date',
text: fallbackValue,
},
],
},
{
type: 'button',
sub_type: 'url',
index: '0',
parameters: [
{
type: 'text',
text: paymentUrl, // replace with dynamic URL
},
],
},
],
},
};
const response = await this.sendMessage(payload);
if (response)
Logger.log(
`Notification register Booking for ${data.code} send to ${data.phone}`,
);
}
async bookingReschedule(data: WhatsappBookingCreate) {
const momentDate = moment(data.time);
const fallbackValue = momentDate.locale('id').format('dddd, DD MMMM YYYY');
const payload = {
messaging_product: 'whatsapp',
to: phoneNumberOnly(data.phone), // recipient's phone number
type: 'template',
template: {
name: 'booking_reschedule',
language: {
code: 'id', // language code
},
components: [
{
type: 'body',
parameters: [
{
type: 'text',
parameter_name: 'customer',
text: data.name, // replace with name variable
},
{
type: 'text',
parameter_name: 'booking_code',
text: data.code, // replace with queue_code variable
},
{
type: 'text',
parameter_name: 'booking_date',
text: fallbackValue,
},
{
type: 'text',
parameter_name: 'otp',
text: data.code,
},
],
},
{
type: 'button',
sub_type: 'copy_code',
index: '0',
parameters: [
{
type: 'coupon_code',
coupon_code: data.code,
},
],
},
],
},
};
const response = await this.sendMessage(payload);
if (response)
Logger.log(
`Notification reschedule Booking for ${data.code} send to ${data.phone}`,
);
}
async sendOtpNotification(data: { phone: string; code: string }) {
// Compose the WhatsApp message payload for OTP using Facebook WhatsApp API
const payload = {