Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(payment): payment and session methods #6138

Merged
merged 46 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
3cf8365
wip: setup
fPolic Jan 17, 2024
ac1c083
Merge branch 'feat/payment-module-interfaces' into feat/payment-modul…
fPolic Jan 17, 2024
b83ef41
feat: create
fPolic Jan 17, 2024
7b20a7d
Merge branch 'feat/payment-module-interfaces' into feat/payment-modul…
fPolic Jan 17, 2024
426d609
feat: delete PC
fPolic Jan 17, 2024
71d5d8f
fix; param
fPolic Jan 17, 2024
fee5e19
feat: list methods
fPolic Jan 17, 2024
d00fc3c
feat: update, list, tests wip
fPolic Jan 17, 2024
66044a5
feat: list tests
fPolic Jan 18, 2024
8cf8581
feat: update, retrieve, tests
fPolic Jan 18, 2024
7c90f75
Merge branch 'develop' into feat/payment-module-payment-collection-crud
fPolic Jan 18, 2024
b1c9851
refactor: use abstract service
fPolic Jan 18, 2024
ebd8ea6
fix: add missing props for update
fPolic Jan 19, 2024
9fd4715
fix: move enum
fPolic Jan 19, 2024
c7da017
chore: import
fPolic Jan 19, 2024
083ca5f
wip: Payment and PaymentSession services, creation of entities and tests
fPolic Jan 19, 2024
f430524
feat: create Session and Payment
fPolic Jan 19, 2024
045c27e
wip: update Payment
fPolic Jan 19, 2024
5e69650
wip: Refund & Capture
fPolic Jan 19, 2024
172a5e0
fix: create, refactor model, finalise test
fPolic Jan 22, 2024
c1a20af
fix: tests
fPolic Jan 22, 2024
1ce795e
feat: Capture/Refund and tests
fPolic Jan 22, 2024
943d8fb
Merge branch 'develop' into feat/payment-module-payment-and-session-crud
fPolic Jan 22, 2024
19e5551
refactor: new repo approach
fPolic Jan 22, 2024
1cab80b
chore: Collection and Payment DTOs
fPolic Jan 22, 2024
360f723
wip: computing refunded and captured amounts
fPolic Jan 23, 2024
ad103ea
fix: temp fix for build
fPolic Jan 24, 2024
16c5ee6
refactor: add todos
fPolic Jan 24, 2024
1166603
Merge branch 'develop' into feat/payment-module-payment-and-session-crud
fPolic Jan 24, 2024
8abf730
fix: params
fPolic Jan 24, 2024
c761f8c
fix: return param
fPolic Jan 24, 2024
7864e3d
Merge branch 'develop' into feat/payment-module-payment-and-session-crud
fPolic Jan 24, 2024
821ab18
fix: refactor test util
fPolic Jan 24, 2024
beea4ae
Merge branch 'develop' into feat/payment-module-payment-and-session-crud
fPolic Jan 25, 2024
918bb38
fix: conflicts
fPolic Jan 25, 2024
c98844a
feat: capture bulk
fPolic Jan 25, 2024
3d81950
feat: refund bulk
fPolic Jan 25, 2024
facf7f8
fix: payment service test
fPolic Jan 25, 2024
082b4c0
Merge branch 'develop' into feat/payment-module-payment-and-session-crud
fPolic Feb 2, 2024
02b82c5
Merge branch 'develop' into feat/payment-module-payment-and-session-crud
fPolic Feb 5, 2024
75468c8
chore: migrate to new abstract service
fPolic Feb 5, 2024
a17609e
fix: address comments
fPolic Feb 5, 2024
81ac0cc
refactor: remove payment service
fPolic Feb 5, 2024
ddbde24
Merge branch 'develop' into feat/payment-module-payment-and-session-crud
fPolic Feb 5, 2024
c1dea05
fix: revisit DTOs, add todos
fPolic Feb 5, 2024
11e60bf
fix: build
fPolic Feb 5, 2024
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
67 changes: 67 additions & 0 deletions packages/payment/integration-tests/__fixtures__/data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
export const defaultPaymentCollectionData = [
{
id: "pay-col-id-1",
amount: 100,
region_id: "region-id-1",
currency_code: "usd",
},
{
id: "pay-col-id-2",
amount: 200,
region_id: "region-id-1",
currency_code: "usd",
},
{
id: "pay-col-id-3",
amount: 300,
region_id: "region-id-2",
currency_code: "usd",
},
]

export const defaultPaymentSessionData = [
{
id: "pay-sess-id-1",
amount: 100,
currency_code: "usd",
provider_id: "manual",
payment_collection: "pay-col-id-1",
},
{
id: "pay-sess-id-2",
amount: 100,
currency_code: "usd",
provider_id: "manual",
payment_collection: "pay-col-id-2",
},
{
id: "pay-sess-id-3",
amount: 100,
currency_code: "usd",
provider_id: "manual",
payment_collection: "pay-col-id-2",
},
]

export const defaultPaymentData = [
{
id: "pay-id-1",
amount: 100,
currency_code: "usd",
payment_collection: "pay-col-id-1",
payment_session: "pay-sess-id-1",
provider_id: "manual",
authorized_amount: 100,
data: {},
},
{
id: "pay-id-2",
amount: 100,
authorized_amount: 100,
currency_code: "usd",
payment_collection: "pay-col-id-2",
payment_session: "pay-sess-id-2",
provider_id: "manual",
data: {},
},
]
53 changes: 53 additions & 0 deletions packages/payment/integration-tests/__fixtures__/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { EntityName } from "@mikro-orm/core"
import { SqlEntityManager } from "@mikro-orm/postgresql"

import { Payment, PaymentSession, PaymentCollection } from "@models"

import {
defaultPaymentCollectionData,
defaultPaymentData,
defaultPaymentSessionData,
} from "./data"

export * from "./data"

async function createEntities<
T extends EntityName<Payment | PaymentCollection | PaymentSession>
>(manager: SqlEntityManager, entity: T, data: any[]) {
const created: T[] = []
for (let record of data) {
created.push(manager.create(entity, record))
}

await manager.persistAndFlush(created)
return created
}

export async function createPaymentCollections(
manager: SqlEntityManager,
paymentCollectionData = defaultPaymentCollectionData
): Promise<PaymentCollection[]> {
return await createEntities<PaymentCollection>(
manager,
PaymentCollection,
paymentCollectionData
)
}

export async function createPaymentSessions(
manager: SqlEntityManager,
paymentSessionData = defaultPaymentSessionData
): Promise<PaymentCollection[]> {
return await createEntities<PaymentSession>(
manager,
PaymentSession,
paymentSessionData
)
}

export async function createPayments(
manager: SqlEntityManager,
paymentData = defaultPaymentData
): Promise<PaymentCollection[]> {
return await createEntities<Payment>(manager, Payment, paymentData)
}

This file was deleted.

This file was deleted.

Loading
Loading