import Inject from "@entity-access/entity-access/dist/di/di.js"; import { StoreJournal } from "../../../model/entities/StoreJournal.js"; import StorePaymentAttempt, { paymentStatusType } from "../../../model/entities/StorePaymentAttempt.js"; import StorePaymentGateway from "../../../model/entities/StorePaymentGateway.js"; import LedgerPaymentGateway from "../LedgerPaymentGateway.js"; import EncryptionService from "../../encryption/EncryptionService.js"; export default class extends LedgerPaymentGateway { @Inject es: EncryptionService; createPayment(host: string, gateway: StorePaymentGateway, order: StoreJournal, pa: StorePaymentAttempt) { const eAttemptID = this.es.general.encrypt(pa.attemptID.toString()); const url = new URL(`https://${host}/store/mock-pg/${eAttemptID}/`); const successUrl = new URL(url); successUrl.searchParams.set("result", "success"); const failedUrl = new URL(url); failedUrl.searchParams.set("result", "failed"); url.searchParams.set("success",successUrl.toString()); url.searchParams.set("failed",failedUrl.toString()); return { url: url.toString() }; } async getStatus(pa: StorePaymentAttempt): Promise { return pa.status; } async refund(pa: StorePaymentAttempt): Promise<"refunded" | void> { return "refunded"; } }