@easypayment/medusa-paypal 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +99 -256
- package/.medusa/server/src/admin/index.mjs +99 -256
- package/.medusa/server/src/api/store/paypal/webhook/route.d.ts.map +1 -1
- package/.medusa/server/src/api/store/paypal/webhook/route.js +1 -1
- package/.medusa/server/src/api/store/paypal/webhook/route.js.map +1 -1
- package/.medusa/server/src/jobs/paypal-webhook-retry.d.ts.map +1 -1
- package/.medusa/server/src/jobs/paypal-webhook-retry.js +1 -1
- package/.medusa/server/src/jobs/paypal-webhook-retry.js.map +1 -1
- package/.medusa/server/src/modules/paypal/index.d.ts +0 -14
- package/.medusa/server/src/modules/paypal/index.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/service.d.ts +0 -43
- package/.medusa/server/src/modules/paypal/service.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/service.js +0 -43
- package/.medusa/server/src/modules/paypal/service.js.map +1 -1
- package/.medusa/server/src/modules/paypal/webhook-processor.d.ts +0 -13
- package/.medusa/server/src/modules/paypal/webhook-processor.d.ts.map +1 -1
- package/.medusa/server/src/modules/paypal/webhook-processor.js +0 -96
- package/.medusa/server/src/modules/paypal/webhook-processor.js.map +1 -1
- package/package.json +1 -1
- package/src/admin/routes/settings/paypal/_components/Tabs.tsx +0 -1
- package/src/api/store/paypal/webhook/route.ts +1 -2
- package/src/jobs/paypal-webhook-retry.ts +1 -2
- package/src/modules/paypal/service.ts +0 -58
- package/src/modules/paypal/webhook-processor.ts +2 -114
- package/.medusa/server/src/api/admin/paypal/disputes/[id]/route.d.ts +0 -3
- package/.medusa/server/src/api/admin/paypal/disputes/[id]/route.d.ts.map +0 -1
- package/.medusa/server/src/api/admin/paypal/disputes/[id]/route.js +0 -17
- package/.medusa/server/src/api/admin/paypal/disputes/[id]/route.js.map +0 -1
- package/.medusa/server/src/api/admin/paypal/disputes/route.d.ts +0 -3
- package/.medusa/server/src/api/admin/paypal/disputes/route.d.ts.map +0 -1
- package/.medusa/server/src/api/admin/paypal/disputes/route.js +0 -27
- package/.medusa/server/src/api/admin/paypal/disputes/route.js.map +0 -1
- package/.medusa/server/src/api/admin/paypal/disputes/summary/route.d.ts +0 -3
- package/.medusa/server/src/api/admin/paypal/disputes/summary/route.d.ts.map +0 -1
- package/.medusa/server/src/api/admin/paypal/disputes/summary/route.js +0 -17
- package/.medusa/server/src/api/admin/paypal/disputes/summary/route.js.map +0 -1
- package/.medusa/server/src/api/store/paypal/disputes/route.d.ts +0 -3
- package/.medusa/server/src/api/store/paypal/disputes/route.d.ts.map +0 -1
- package/.medusa/server/src/api/store/paypal/disputes/route.js +0 -46
- package/.medusa/server/src/api/store/paypal/disputes/route.js.map +0 -1
- package/.medusa/server/src/modules/paypal/migrations/20260501090000_create_paypal_dispute.d.ts +0 -6
- package/.medusa/server/src/modules/paypal/migrations/20260501090000_create_paypal_dispute.d.ts.map +0 -1
- package/.medusa/server/src/modules/paypal/migrations/20260501090000_create_paypal_dispute.js +0 -43
- package/.medusa/server/src/modules/paypal/migrations/20260501090000_create_paypal_dispute.js.map +0 -1
- package/.medusa/server/src/modules/paypal/models/paypal_dispute.d.ts +0 -16
- package/.medusa/server/src/modules/paypal/models/paypal_dispute.d.ts.map +0 -1
- package/.medusa/server/src/modules/paypal/models/paypal_dispute.js +0 -19
- package/.medusa/server/src/modules/paypal/models/paypal_dispute.js.map +0 -1
- package/src/admin/routes/settings/paypal/disputes/page.tsx +0 -186
- package/src/api/admin/paypal/disputes/[id]/route.ts +0 -19
- package/src/api/admin/paypal/disputes/route.ts +0 -30
- package/src/api/admin/paypal/disputes/summary/route.ts +0 -18
- package/src/api/store/paypal/disputes/route.ts +0 -67
- package/src/modules/paypal/migrations/20260501090000_create_paypal_dispute.ts +0 -40
- package/src/modules/paypal/models/paypal_dispute.ts +0 -18
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
|
2
|
-
import type PayPalModuleService from "../../../../modules/paypal/service"
|
|
3
|
-
|
|
4
|
-
export async function GET(req: MedusaRequest, res: MedusaResponse) {
|
|
5
|
-
const paypal = req.scope.resolve<PayPalModuleService>("paypal_onboarding")
|
|
6
|
-
|
|
7
|
-
const query = (req.query || {}) as Record<string, string | string[] | undefined>
|
|
8
|
-
const filters: Record<string, string> = {}
|
|
9
|
-
|
|
10
|
-
const addFilter = (key: string) => {
|
|
11
|
-
const value = query[key]
|
|
12
|
-
if (Array.isArray(value)) {
|
|
13
|
-
if (value[0]) {
|
|
14
|
-
filters[key] = value[0]
|
|
15
|
-
}
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
-
if (typeof value === "string" && value.trim()) {
|
|
19
|
-
filters[key] = value.trim()
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
addFilter("status")
|
|
24
|
-
addFilter("order_id")
|
|
25
|
-
addFilter("cart_id")
|
|
26
|
-
addFilter("dispute_id")
|
|
27
|
-
|
|
28
|
-
const disputes = await paypal.listPayPalDisputes(filters)
|
|
29
|
-
return res.json({ disputes })
|
|
30
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
|
2
|
-
import type PayPalModuleService from "../../../../../modules/paypal/service"
|
|
3
|
-
|
|
4
|
-
export async function GET(req: MedusaRequest, res: MedusaResponse) {
|
|
5
|
-
const paypal = req.scope.resolve<PayPalModuleService>("paypal_onboarding")
|
|
6
|
-
const disputes = await paypal.listPayPalDisputes({})
|
|
7
|
-
const counts: Record<string, number> = {}
|
|
8
|
-
|
|
9
|
-
for (const dispute of disputes || []) {
|
|
10
|
-
const status = dispute.status || "unknown"
|
|
11
|
-
counts[status] = (counts[status] || 0) + 1
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return res.json({
|
|
15
|
-
total: disputes?.length ?? 0,
|
|
16
|
-
statuses: counts,
|
|
17
|
-
})
|
|
18
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
|
|
2
|
-
import type PayPalModuleService from "../../../../modules/paypal/service"
|
|
3
|
-
|
|
4
|
-
type DisputeRecord = {
|
|
5
|
-
id: string
|
|
6
|
-
dispute_id: string
|
|
7
|
-
status?: string | null
|
|
8
|
-
reason?: string | null
|
|
9
|
-
stage?: string | null
|
|
10
|
-
amount?: string | null
|
|
11
|
-
currency_code?: string | null
|
|
12
|
-
transaction_id?: string | null
|
|
13
|
-
seller_transaction_id?: string | null
|
|
14
|
-
order_id?: string | null
|
|
15
|
-
cart_id?: string | null
|
|
16
|
-
created_at?: string
|
|
17
|
-
updated_at?: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function toPublicDispute(dispute: any): DisputeRecord {
|
|
21
|
-
return {
|
|
22
|
-
id: dispute.id,
|
|
23
|
-
dispute_id: dispute.dispute_id,
|
|
24
|
-
status: dispute.status ?? null,
|
|
25
|
-
reason: dispute.reason ?? null,
|
|
26
|
-
stage: dispute.stage ?? null,
|
|
27
|
-
amount: dispute.amount ?? null,
|
|
28
|
-
currency_code: dispute.currency_code ?? null,
|
|
29
|
-
transaction_id: dispute.transaction_id ?? null,
|
|
30
|
-
seller_transaction_id: dispute.seller_transaction_id ?? null,
|
|
31
|
-
order_id: dispute.order_id ?? null,
|
|
32
|
-
cart_id: dispute.cart_id ?? null,
|
|
33
|
-
created_at: dispute.created_at ?? null,
|
|
34
|
-
updated_at: dispute.updated_at ?? null,
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export async function GET(req: MedusaRequest, res: MedusaResponse) {
|
|
39
|
-
const paypal = req.scope.resolve<PayPalModuleService>("paypal_onboarding")
|
|
40
|
-
|
|
41
|
-
const query = (req.query || {}) as Record<string, string | string[] | undefined>
|
|
42
|
-
const filters: Record<string, string> = {}
|
|
43
|
-
|
|
44
|
-
const addFilter = (key: string) => {
|
|
45
|
-
const value = query[key]
|
|
46
|
-
if (Array.isArray(value)) {
|
|
47
|
-
if (value[0]) {
|
|
48
|
-
filters[key] = value[0]
|
|
49
|
-
}
|
|
50
|
-
return
|
|
51
|
-
}
|
|
52
|
-
if (typeof value === "string" && value.trim()) {
|
|
53
|
-
filters[key] = value.trim()
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
addFilter("order_id")
|
|
58
|
-
addFilter("cart_id")
|
|
59
|
-
addFilter("dispute_id")
|
|
60
|
-
|
|
61
|
-
if (Object.keys(filters).length === 0) {
|
|
62
|
-
return res.status(400).json({ message: "order_id, cart_id, or dispute_id is required" })
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const disputes = await paypal.listPayPalDisputes(filters)
|
|
66
|
-
return res.json({ disputes: (disputes || []).map(toPublicDispute) })
|
|
67
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Migration } from "@medusajs/framework/mikro-orm/migrations"
|
|
2
|
-
|
|
3
|
-
export class Migration20260501090000 extends Migration {
|
|
4
|
-
async up(): Promise<void> {
|
|
5
|
-
this.addSql(`
|
|
6
|
-
CREATE TABLE IF NOT EXISTS "paypal_dispute" (
|
|
7
|
-
"id" text NOT NULL,
|
|
8
|
-
"dispute_id" text NOT NULL,
|
|
9
|
-
"status" text NULL,
|
|
10
|
-
"reason" text NULL,
|
|
11
|
-
"stage" text NULL,
|
|
12
|
-
"amount" text NULL,
|
|
13
|
-
"currency_code" text NULL,
|
|
14
|
-
"transaction_id" text NULL,
|
|
15
|
-
"seller_transaction_id" text NULL,
|
|
16
|
-
"order_id" text NULL,
|
|
17
|
-
"cart_id" text NULL,
|
|
18
|
-
"payload" jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
19
|
-
"created_at" timestamptz NOT NULL DEFAULT now(),
|
|
20
|
-
"updated_at" timestamptz NOT NULL DEFAULT now(),
|
|
21
|
-
"deleted_at" timestamptz NULL,
|
|
22
|
-
CONSTRAINT "paypal_dispute_pkey" PRIMARY KEY ("id"),
|
|
23
|
-
CONSTRAINT "paypal_dispute_dispute_id_unique" UNIQUE ("dispute_id")
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
CREATE INDEX IF NOT EXISTS "idx_paypal_dispute_deleted_at"
|
|
27
|
-
ON "paypal_dispute" ("deleted_at");
|
|
28
|
-
CREATE INDEX IF NOT EXISTS "idx_paypal_dispute_order_id"
|
|
29
|
-
ON "paypal_dispute" ("order_id");
|
|
30
|
-
CREATE INDEX IF NOT EXISTS "idx_paypal_dispute_cart_id"
|
|
31
|
-
ON "paypal_dispute" ("cart_id");
|
|
32
|
-
`)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async down(): Promise<void> {
|
|
36
|
-
this.addSql(`
|
|
37
|
-
DROP TABLE IF EXISTS "paypal_dispute" CASCADE;
|
|
38
|
-
`)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { model } from "@medusajs/framework/utils"
|
|
2
|
-
|
|
3
|
-
const PayPalDispute = model.define("paypal_dispute", {
|
|
4
|
-
id: model.id().primaryKey(),
|
|
5
|
-
dispute_id: model.text().unique(),
|
|
6
|
-
status: model.text().nullable(),
|
|
7
|
-
reason: model.text().nullable(),
|
|
8
|
-
stage: model.text().nullable(),
|
|
9
|
-
amount: model.text().nullable(),
|
|
10
|
-
currency_code: model.text().nullable(),
|
|
11
|
-
transaction_id: model.text().nullable(),
|
|
12
|
-
seller_transaction_id: model.text().nullable(),
|
|
13
|
-
order_id: model.text().nullable(),
|
|
14
|
-
cart_id: model.text().nullable(),
|
|
15
|
-
payload: model.json().nullable(),
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
export default PayPalDispute
|