Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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 app/transaction_events/usecase/usecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,16 @@ func (u *usecase) GetOrderDetail(ctx context.Context, orderNo string) (domain.Ge
paymentDate = &registration.PaymentDate.Time
}

baseURL := u.cfg.BaseURL
imageURL := fmt.Sprintf("%s/api/v1/public/storage/images/%s", baseURL, event.Image)
Comment thread
akwanmaroso marked this conversation as resolved.
Outdated

response := domain.GetOrderDetailResponse{
OrderNo: registration.OrderNo,
TransactionNo: transactionNo,
PaymentDate: paymentDate,
Status: registration.Status,
PaymentURL: *transaction.InvoiceURL,
CreatedAt: transaction.CreatedAt,
EventDetail: domain.OrderEventDetail{
Title: event.Title,
Date: eventDate,
Expand All @@ -427,6 +432,7 @@ func (u *usecase) GetOrderDetail(ctx context.Context, orderNo string) (domain.Ge
Duration: event.Duration,
Price: event.Price,
SessionType: event.SessionType,
Image: imageURL,
},
UserDetail: domain.OrderUserDetail{
Fullname: registration.User.Fullname,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ CREATE TABLE IF NOT EXISTS "public"."transaction_events" (
);

-- Create indexes for performance
CREATE INDEX idx_trx_no ON transaction_events(transaction_no);
CREATE INDEX idx_trx_registration ON transaction_events(registration_id);
CREATE INDEX idx_trx_status ON transaction_events(status);
CREATE INDEX idx_trx_external_id ON transaction_events(external_id);
CREATE INDEX IF NOT EXISTS idx_trx_no ON transaction_events(transaction_no);
CREATE INDEX IF NOT EXISTS idx_trx_registration ON transaction_events(registration_id);
CREATE INDEX IF NOT EXISTS idx_trx_status ON transaction_events(status);
CREATE INDEX IF NOT EXISTS idx_trx_external_id ON transaction_events(external_id);

COMMENT ON TABLE "public"."transaction_events" IS 'Payment transactions for event registrations';
COMMENT ON COLUMN "public"."transaction_events"."status" IS 'pending, paid, expired';
Expand Down
11 changes: 11 additions & 0 deletions database/migration/20260108131316_table_drop_testing_tables.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- +goose Up
-- +goose StatementBegin
DROP TABLE IF EXISTS "public"."testing_transaction";
DROP TABLE IF EXISTS "public"."testing";
DROP SEQUENCE IF EXISTS testing_id_seq;
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
-- Recreate if needed for rollback (optional)
-- +goose StatementEnd
3 changes: 3 additions & 0 deletions domain/transaction_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ type GetOrderDetailResponse struct {
TransactionNo string `json:"transaction_no"`
PaymentDate *time.Time `json:"payment_date"`
Status string `json:"status"`
PaymentURL string `json:"payment_url"`
CreatedAt time.Time `json:"created_at"`
EventDetail OrderEventDetail `json:"event_detail"`
UserDetail OrderUserDetail `json:"user_detail"`
}
Expand All @@ -65,6 +67,7 @@ type OrderEventDetail struct {
Duration string `json:"duration"`
Price float64 `json:"price"`
SessionType string `json:"session_type"`
Image string `json:"image"`
}

type OrderUserDetail struct {
Expand Down
10 changes: 9 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ serve-http:
@go run main.go http
migrate:
@go run main.go migrate
migrate-up:
@go run main.go migrate:up
migrate-down:
@go run main.go migrate:down
migrate-create:
@go run main.go migrate:create
migrate-fresh:
@go run main.go migrate:fresh
.PHONY: run
run:
run:
@swag init --parseDependency -g main.go && air http