@reeboot/strapi-payment-plugin 0.0.2 → 0.0.4

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/README.md CHANGED
@@ -48,7 +48,7 @@ A comprehensive Stripe integration plugin for Strapi v5 that provides complete p
48
48
 
49
49
  2. Install dependencies:
50
50
  ```bash
51
- npm install @stripe/stripe-js stripe
51
+ npm install
52
52
  ```
53
53
 
54
54
  3. Configure the plugin in `config/plugins.ts`:
@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
3
3
  import { Box, Typography, Flex, ProgressBar, Grid, Loader, EmptyStateLayout, Button, SingleSelect, SingleSelectOption, Card, Badge, Table, Thead, Tr, Th, Tbody, Td } from "@strapi/design-system";
4
4
  import { useIntl } from "react-intl";
5
5
  import { useFetchClient } from "@strapi/strapi/admin";
6
- import { P as PLUGIN_ID } from "./index-Bz8V_5zH.mjs";
6
+ import { P as PLUGIN_ID } from "./index-DS_PYNkf.mjs";
7
7
  const AnalyticsChart = ({ data, currency = "usd", type }) => {
8
8
  const formatCurrency = (amount) => {
9
9
  return new Intl.NumberFormat("en-US", {
@@ -5,7 +5,7 @@ const React = require("react");
5
5
  const designSystem = require("@strapi/design-system");
6
6
  const reactIntl = require("react-intl");
7
7
  const admin = require("@strapi/strapi/admin");
8
- const index = require("./index-BTk7a2T5.js");
8
+ const index = require("./index-BqqrpI6D.js");
9
9
  const AnalyticsChart = ({ data, currency = "usd", type }) => {
10
10
  const formatCurrency = (amount) => {
11
11
  return new Intl.NumberFormat("en-US", {
@@ -5,15 +5,15 @@ const React = require("react");
5
5
  const reactRouterDom = require("react-router-dom");
6
6
  const reactIntl = require("react-intl");
7
7
  const designSystem = require("@strapi/design-system");
8
- const index = require("./index-BTk7a2T5.js");
8
+ const index = require("./index-BqqrpI6D.js");
9
9
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
10
10
  const React__default = /* @__PURE__ */ _interopDefault(React);
11
- const Dashboard = React__default.default.lazy(() => Promise.resolve().then(() => require("./Dashboard-CuqclLak.js")).then((m) => ({ default: m.Dashboard })));
12
- const Payments = React__default.default.lazy(() => Promise.resolve().then(() => require("./Payments-CIMyOC3n.js")).then((m) => ({ default: m.Payments })));
13
- const Orders = React__default.default.lazy(() => Promise.resolve().then(() => require("./Orders-5WGSzPGo.js")).then((m) => ({ default: m.Orders })));
14
- const Customers = React__default.default.lazy(() => Promise.resolve().then(() => require("./Customers-D0O5ET5C.js")).then((m) => ({ default: m.Customers })));
15
- const Analytics = React__default.default.lazy(() => Promise.resolve().then(() => require("./Analytics-C2GKvPDX.js")).then((m) => ({ default: m.Analytics })));
16
- const Settings = React__default.default.lazy(() => Promise.resolve().then(() => require("./Settings-BXMLePI_.js")).then((m) => ({ default: m.Settings })));
11
+ const Dashboard = React__default.default.lazy(() => Promise.resolve().then(() => require("./Dashboard-CNMTzSyc.js")).then((m) => ({ default: m.Dashboard })));
12
+ const Payments = React__default.default.lazy(() => Promise.resolve().then(() => require("./Payments-BLen1P9N.js")).then((m) => ({ default: m.Payments })));
13
+ const Orders = React__default.default.lazy(() => Promise.resolve().then(() => require("./Orders-OG-pwV-B.js")).then((m) => ({ default: m.Orders })));
14
+ const Customers = React__default.default.lazy(() => Promise.resolve().then(() => require("./Customers-BpFzfglV.js")).then((m) => ({ default: m.Customers })));
15
+ const Analytics = React__default.default.lazy(() => Promise.resolve().then(() => require("./Analytics-nBSdLT2v.js")).then((m) => ({ default: m.Analytics })));
16
+ const Settings = React__default.default.lazy(() => Promise.resolve().then(() => require("./Settings-Dq1xy32B.js")).then((m) => ({ default: m.Settings })));
17
17
  const App = () => {
18
18
  const { formatMessage } = reactIntl.useIntl();
19
19
  const links = [
@@ -3,13 +3,13 @@ import React, { Suspense } from "react";
3
3
  import { NavLink, Routes, Route, Navigate } from "react-router-dom";
4
4
  import { useIntl } from "react-intl";
5
5
  import { Flex, SubNav, SubNavHeader, SubNavSections, SubNavSection, SubNavLink, Box, Loader } from "@strapi/design-system";
6
- import { P as PLUGIN_ID } from "./index-Bz8V_5zH.mjs";
7
- const Dashboard = React.lazy(() => import("./Dashboard-D8-ifJqB.mjs").then((m) => ({ default: m.Dashboard })));
8
- const Payments = React.lazy(() => import("./Payments-CRnRBf48.mjs").then((m) => ({ default: m.Payments })));
9
- const Orders = React.lazy(() => import("./Orders-ClJJaQrX.mjs").then((m) => ({ default: m.Orders })));
10
- const Customers = React.lazy(() => import("./Customers-B8BlQ1BO.mjs").then((m) => ({ default: m.Customers })));
11
- const Analytics = React.lazy(() => import("./Analytics-Chydh3dg.mjs").then((m) => ({ default: m.Analytics })));
12
- const Settings = React.lazy(() => import("./Settings-TeAvV4RH.mjs").then((m) => ({ default: m.Settings })));
6
+ import { P as PLUGIN_ID } from "./index-DS_PYNkf.mjs";
7
+ const Dashboard = React.lazy(() => import("./Dashboard-Dbwl0ZBo.mjs").then((m) => ({ default: m.Dashboard })));
8
+ const Payments = React.lazy(() => import("./Payments-DSDJ-HWm.mjs").then((m) => ({ default: m.Payments })));
9
+ const Orders = React.lazy(() => import("./Orders-CBkT2YfP.mjs").then((m) => ({ default: m.Orders })));
10
+ const Customers = React.lazy(() => import("./Customers-C6FH7-zG.mjs").then((m) => ({ default: m.Customers })));
11
+ const Analytics = React.lazy(() => import("./Analytics-DSJqY9ng.mjs").then((m) => ({ default: m.Analytics })));
12
+ const Settings = React.lazy(() => import("./Settings-jmGslDsB.mjs").then((m) => ({ default: m.Settings })));
13
13
  const App = () => {
14
14
  const { formatMessage } = useIntl();
15
15
  const links = [
@@ -5,7 +5,7 @@ const React = require("react");
5
5
  const designSystem = require("@strapi/design-system");
6
6
  const reactIntl = require("react-intl");
7
7
  const admin = require("@strapi/strapi/admin");
8
- const index = require("./index-BTk7a2T5.js");
8
+ const index = require("./index-BqqrpI6D.js");
9
9
  const Customers = () => {
10
10
  const { formatMessage } = reactIntl.useIntl();
11
11
  const { get } = admin.useFetchClient();
@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
3
3
  import { Box, Flex, Loader, EmptyStateLayout, Button, Typography, Card, Grid, TextInput, SingleSelect, SingleSelectOption, Table, Thead, Tr, Th, Tbody, Td, Pagination, Badge } from "@strapi/design-system";
4
4
  import { useIntl } from "react-intl";
5
5
  import { useFetchClient } from "@strapi/strapi/admin";
6
- import { P as PLUGIN_ID } from "./index-Bz8V_5zH.mjs";
6
+ import { P as PLUGIN_ID } from "./index-DS_PYNkf.mjs";
7
7
  const Customers = () => {
8
8
  const { formatMessage } = useIntl();
9
9
  const { get } = useFetchClient();
@@ -5,7 +5,7 @@ const React = require("react");
5
5
  const designSystem = require("@strapi/design-system");
6
6
  const admin = require("@strapi/strapi/admin");
7
7
  const reactIntl = require("react-intl");
8
- const index = require("./index-BTk7a2T5.js");
8
+ const index = require("./index-BqqrpI6D.js");
9
9
  const Dashboard = () => {
10
10
  const { formatMessage } = reactIntl.useIntl();
11
11
  const { get, post } = admin.useFetchClient();
@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
3
3
  import { Box, Flex, Loader, EmptyStateLayout, Button, Typography, Grid, Card, Table, Thead, Tr, Th, Tbody, Td, Badge } from "@strapi/design-system";
4
4
  import { useFetchClient } from "@strapi/strapi/admin";
5
5
  import { useIntl } from "react-intl";
6
- import { P as PLUGIN_ID } from "./index-Bz8V_5zH.mjs";
6
+ import { P as PLUGIN_ID } from "./index-DS_PYNkf.mjs";
7
7
  const Dashboard = () => {
8
8
  const { formatMessage } = useIntl();
9
9
  const { get, post } = useFetchClient();
@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
3
3
  import { Box, Flex, Loader, EmptyStateLayout, Button, Typography, Card, Grid, TextInput, SingleSelect, SingleSelectOption, Table, Thead, Tr, Th, Tbody, Td, Pagination, Badge } from "@strapi/design-system";
4
4
  import { useIntl } from "react-intl";
5
5
  import { useFetchClient } from "@strapi/strapi/admin";
6
- import { P as PLUGIN_ID } from "./index-Bz8V_5zH.mjs";
6
+ import { P as PLUGIN_ID } from "./index-DS_PYNkf.mjs";
7
7
  const Orders = () => {
8
8
  const { formatMessage } = useIntl();
9
9
  const { get } = useFetchClient();
@@ -279,7 +279,7 @@ const Orders = () => {
279
279
  /* @__PURE__ */ jsx(Tbody, { children: paginatedOrders.map((order) => /* @__PURE__ */ jsxs(Tr, { children: [
280
280
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", fontFamily: "monospace", children: order.orderNumber }) }),
281
281
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Box, { children: [
282
- /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", children: order.customerName || "Unknown" }),
282
+ /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", children: order.customerName || "Unknown -" }),
283
283
  /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "epsilon", children: order.customerEmail })
284
284
  ] }) }),
285
285
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Typography, { textColor: "neutral600", children: [
@@ -5,7 +5,7 @@ const React = require("react");
5
5
  const designSystem = require("@strapi/design-system");
6
6
  const reactIntl = require("react-intl");
7
7
  const admin = require("@strapi/strapi/admin");
8
- const index = require("./index-BTk7a2T5.js");
8
+ const index = require("./index-BqqrpI6D.js");
9
9
  const Orders = () => {
10
10
  const { formatMessage } = reactIntl.useIntl();
11
11
  const { get } = admin.useFetchClient();
@@ -281,7 +281,7 @@ const Orders = () => {
281
281
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: paginatedOrders.map((order) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
282
282
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", fontFamily: "monospace", children: order.orderNumber }) }),
283
283
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
284
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", children: order.customerName || "Unknown" }),
284
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", children: order.customerName || "Unknown -" }),
285
285
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: order.customerEmail })
286
286
  ] }) }),
287
287
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { textColor: "neutral600", children: [
@@ -5,7 +5,7 @@ const React = require("react");
5
5
  const designSystem = require("@strapi/design-system");
6
6
  const reactIntl = require("react-intl");
7
7
  const admin = require("@strapi/strapi/admin");
8
- const index = require("./index-BTk7a2T5.js");
8
+ const index = require("./index-BqqrpI6D.js");
9
9
  const RefundModal = ({ payment, onClose, onSuccess }) => {
10
10
  const { formatMessage } = reactIntl.useIntl();
11
11
  const { post } = admin.useFetchClient();
@@ -421,7 +421,7 @@ const Payments = () => {
421
421
  ] }) }),
422
422
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: paginatedPayments.map((payment) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
423
423
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
424
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", children: payment.customerName || "Unknown" }),
424
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", children: payment.customerName || "Unknown -" }),
425
425
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: payment.customerEmail })
426
426
  ] }) }),
427
427
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", children: formatCurrency(payment.amount, payment.currency) }) }),
@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
3
3
  import { Dialog, Typography, Flex, Box, Button, TextInput, Textarea, Alert, Divider, Loader, EmptyStateLayout, Card, Grid, SingleSelect, SingleSelectOption, Table, Thead, Tr, Th, Tbody, Td, Pagination, Badge } from "@strapi/design-system";
4
4
  import { useIntl } from "react-intl";
5
5
  import { useFetchClient } from "@strapi/strapi/admin";
6
- import { P as PLUGIN_ID } from "./index-Bz8V_5zH.mjs";
6
+ import { P as PLUGIN_ID } from "./index-DS_PYNkf.mjs";
7
7
  const RefundModal = ({ payment, onClose, onSuccess }) => {
8
8
  const { formatMessage } = useIntl();
9
9
  const { post } = useFetchClient();
@@ -419,7 +419,7 @@ const Payments = () => {
419
419
  ] }) }),
420
420
  /* @__PURE__ */ jsx(Tbody, { children: paginatedPayments.map((payment) => /* @__PURE__ */ jsxs(Tr, { children: [
421
421
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Box, { children: [
422
- /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", children: payment.customerName || "Unknown" }),
422
+ /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", children: payment.customerName || "Unknown -" }),
423
423
  /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "epsilon", children: payment.customerEmail })
424
424
  ] }) }),
425
425
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", children: formatCurrency(payment.amount, payment.currency) }) }),
@@ -5,7 +5,7 @@ const React = require("react");
5
5
  const designSystem = require("@strapi/design-system");
6
6
  const reactIntl = require("react-intl");
7
7
  const admin = require("@strapi/strapi/admin");
8
- const index = require("./index-BTk7a2T5.js");
8
+ const index = require("./index-BqqrpI6D.js");
9
9
  const Settings = () => {
10
10
  const { formatMessage } = reactIntl.useIntl();
11
11
  const { get, put } = admin.useFetchClient();
@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
3
3
  import { Box, Flex, Typography, Alert, Button, Grid, Card, TextInput, SingleSelect, SingleSelectOption, Switch } from "@strapi/design-system";
4
4
  import { useIntl } from "react-intl";
5
5
  import { useFetchClient } from "@strapi/strapi/admin";
6
- import { P as PLUGIN_ID } from "./index-Bz8V_5zH.mjs";
6
+ import { P as PLUGIN_ID } from "./index-DS_PYNkf.mjs";
7
7
  const Settings = () => {
8
8
  const { formatMessage } = useIntl();
9
9
  const { get, put } = useFetchClient();
@@ -37,7 +37,7 @@ const index = {
37
37
  defaultMessage: "Payment Management"
38
38
  },
39
39
  Component: async () => {
40
- const { App } = await Promise.resolve().then(() => require("./App-E2k2mo5p.js"));
40
+ const { App } = await Promise.resolve().then(() => require("./App-B83DZ9NG.js"));
41
41
  return App;
42
42
  }
43
43
  });
@@ -36,7 +36,7 @@ const index = {
36
36
  defaultMessage: "Payment Management"
37
37
  },
38
38
  Component: async () => {
39
- const { App } = await import("./App-BCbEuN6h.mjs");
39
+ const { App } = await import("./App-BUSTbkyy.mjs");
40
40
  return App;
41
41
  }
42
42
  });
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-BTk7a2T5.js");
2
+ const index = require("../_chunks/index-BqqrpI6D.js");
3
3
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-Bz8V_5zH.mjs";
1
+ import { i } from "../_chunks/index-DS_PYNkf.mjs";
2
2
  export {
3
3
  i as default
4
4
  };
@@ -1287,7 +1287,7 @@ const routes$2 = {
1287
1287
  },
1288
1288
  {
1289
1289
  method: "POST",
1290
- path: "/payments/confirm/:id",
1290
+ path: "/payments/confirm/:paymentIntentId",
1291
1291
  handler: "stripe.confirmPayment",
1292
1292
  config: {
1293
1293
  policies: []
@@ -1536,6 +1536,22 @@ const stripeService = ({ strapi: strapi2 }) => {
1536
1536
  const getStripe = () => {
1537
1537
  return stripe;
1538
1538
  };
1539
+ const mapStripeStatusToStrapi = (stripeStatus) => {
1540
+ switch (stripeStatus) {
1541
+ case "succeeded":
1542
+ return "succeeded";
1543
+ case "canceled":
1544
+ return "canceled";
1545
+ case "processing":
1546
+ case "requires_action":
1547
+ case "requires_capture":
1548
+ case "requires_confirmation":
1549
+ case "requires_payment_method":
1550
+ return "pending";
1551
+ default:
1552
+ return "pending";
1553
+ }
1554
+ };
1539
1555
  const createPaymentIntent = async (params) => {
1540
1556
  try {
1541
1557
  const stripe2 = await initializeStripe();
@@ -1760,7 +1776,7 @@ const stripeService = ({ strapi: strapi2 }) => {
1760
1776
  stripe_payment_intent_id: paymentIntent.id,
1761
1777
  amount: paymentIntent.amount / 100,
1762
1778
  currency: paymentIntent.currency,
1763
- status: paymentIntent.status,
1779
+ status: mapStripeStatusToStrapi(paymentIntent.status),
1764
1780
  payment_method: paymentIntent.payment_method || "card",
1765
1781
  metadata: paymentIntent.metadata,
1766
1782
  customer: customerId,
@@ -1284,7 +1284,7 @@ const routes$2 = {
1284
1284
  },
1285
1285
  {
1286
1286
  method: "POST",
1287
- path: "/payments/confirm/:id",
1287
+ path: "/payments/confirm/:paymentIntentId",
1288
1288
  handler: "stripe.confirmPayment",
1289
1289
  config: {
1290
1290
  policies: []
@@ -1533,6 +1533,22 @@ const stripeService = ({ strapi: strapi2 }) => {
1533
1533
  const getStripe = () => {
1534
1534
  return stripe;
1535
1535
  };
1536
+ const mapStripeStatusToStrapi = (stripeStatus) => {
1537
+ switch (stripeStatus) {
1538
+ case "succeeded":
1539
+ return "succeeded";
1540
+ case "canceled":
1541
+ return "canceled";
1542
+ case "processing":
1543
+ case "requires_action":
1544
+ case "requires_capture":
1545
+ case "requires_confirmation":
1546
+ case "requires_payment_method":
1547
+ return "pending";
1548
+ default:
1549
+ return "pending";
1550
+ }
1551
+ };
1536
1552
  const createPaymentIntent = async (params) => {
1537
1553
  try {
1538
1554
  const stripe2 = await initializeStripe();
@@ -1757,7 +1773,7 @@ const stripeService = ({ strapi: strapi2 }) => {
1757
1773
  stripe_payment_intent_id: paymentIntent.id,
1758
1774
  amount: paymentIntent.amount / 100,
1759
1775
  currency: paymentIntent.currency,
1760
- status: paymentIntent.status,
1776
+ status: mapStripeStatusToStrapi(paymentIntent.status),
1761
1777
  payment_method: paymentIntent.payment_method || "card",
1762
1778
  metadata: paymentIntent.metadata,
1763
1779
  customer: customerId,
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.2",
2
+ "version": "0.0.4",
3
3
  "keywords": [],
4
4
  "type": "commonjs",
5
5
  "exports": {