feat(release): initial release
This commit is contained in:
5
tests/mocks/providers/invoice-2-go.ts
Normal file
5
tests/mocks/providers/invoice-2-go.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { Invoices } from "../services/invoices.ts";
|
||||
|
||||
export class Invoice2Go extends Invoices {
|
||||
public readonly provider = "Invoice2Go";
|
||||
}
|
||||
14
tests/mocks/providers/paypal.ts
Normal file
14
tests/mocks/providers/paypal.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { type Currency, type Payment, Payments } from "../services/payments.ts";
|
||||
|
||||
export class PayPal extends Payments {
|
||||
public async create(customerId: string, currency: Currency, amount: number): Promise<Payment> {
|
||||
return {
|
||||
paymentId: "xyz",
|
||||
customerId,
|
||||
provider: "paypal",
|
||||
status: "created",
|
||||
currency,
|
||||
amount,
|
||||
};
|
||||
}
|
||||
}
|
||||
14
tests/mocks/providers/stripe.ts
Normal file
14
tests/mocks/providers/stripe.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { type Currency, type Payment, Payments } from "../services/payments.ts";
|
||||
|
||||
export class Stripe extends Payments {
|
||||
public async create(customerId: string, currency: Currency, amount: number): Promise<Payment> {
|
||||
return {
|
||||
paymentId: "xyz",
|
||||
customerId,
|
||||
provider: "stripe",
|
||||
status: "created",
|
||||
currency,
|
||||
amount,
|
||||
};
|
||||
}
|
||||
}
|
||||
5
tests/mocks/services/invoices.ts
Normal file
5
tests/mocks/services/invoices.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export abstract class Invoices {
|
||||
public abstract readonly provider: string;
|
||||
|
||||
constructor(public readonly paymentId: string) {}
|
||||
}
|
||||
1
tests/mocks/services/logger.ts
Normal file
1
tests/mocks/services/logger.ts
Normal file
@@ -0,0 +1 @@
|
||||
export class Logger {}
|
||||
22
tests/mocks/services/payments.ts
Normal file
22
tests/mocks/services/payments.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export abstract class Payments {
|
||||
public abstract create(customerId: string, currency: Currency, amount: number): Promise<Payment>;
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------------
|
||||
| Types
|
||||
|--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
export type Payment = {
|
||||
paymentId: string;
|
||||
customerId: string;
|
||||
provider: string;
|
||||
status: Status;
|
||||
currency: Currency;
|
||||
amount: number;
|
||||
};
|
||||
|
||||
export type Status = "created" | "processing" | "failed" | "processed";
|
||||
|
||||
export type Currency = "usd" | "eur" | "jpy";
|
||||
Reference in New Issue
Block a user