@fire-spark/payments-paymentez-checkout 0.24.0 → 0.26.0

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -10
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { PaymentError, createPaymentError, definePaymentErrors, toPaymentError } from "@fire-spark/payments";
1
+ import { PaymentError, createPaymentError, definePaymentErrors, paymentResultAmount, toPaymentError } from "@fire-spark/payments";
2
2
  //#region src/constants.ts
3
3
  const PAYMENTEZ_PROVIDER = "paymentez";
4
4
  /**
@@ -152,7 +152,7 @@ const failedResult = (ctx, error, metadata) => {
152
152
  };
153
153
  return {
154
154
  status: "FAILED",
155
- amount: ctx.amount.value,
155
+ ...paymentResultAmount(ctx.amount.value),
156
156
  metadata: m,
157
157
  error
158
158
  };
@@ -161,15 +161,19 @@ const failedResult = (ctx, error, metadata) => {
161
161
  const paymentezResultOf = (ctx, outcome) => {
162
162
  const metadata = paymentezMetadataOf(ctx, outcome);
163
163
  const amount = ctx.amount.value;
164
- if (outcome.status === "PAID") return {
165
- status: "PAID",
166
- amount,
167
- metadata,
168
- details: cardDetailsOf(outcome)
169
- };
164
+ const exact = paymentResultAmount(amount);
165
+ if (outcome.status === "PAID") {
166
+ const details = cardDetailsOf(outcome);
167
+ return {
168
+ status: "PAID",
169
+ ...exact,
170
+ metadata,
171
+ details
172
+ };
173
+ }
170
174
  if (outcome.status === "PENDING") return {
171
175
  status: "PENDING",
172
- amount,
176
+ ...exact,
173
177
  metadata
174
178
  };
175
179
  const raw = {
@@ -223,7 +227,7 @@ const paymentezCheckoutPayments = (options) => {
223
227
  const metadata = { attempt_reference: ctx.attemptReference };
224
228
  return {
225
229
  status: "PENDING",
226
- amount: ctx.amount.value,
230
+ ...paymentResultAmount(ctx.amount.value),
227
231
  metadata
228
232
  };
229
233
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fire-spark/payments-paymentez-checkout",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "description": "Fire Spark Paymentez (Nuvei LATAM) adapter: card payments through the Paymentez Payment Checkout (web, and React Native through a WebView)",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -17,8 +17,8 @@
17
17
  }
18
18
  },
19
19
  "dependencies": {
20
- "@fire-spark/payments": "^0.24.0",
21
- "@fire-spark/types": "^0.24.0"
20
+ "@fire-spark/payments": "^0.26.0",
21
+ "@fire-spark/types": "^0.26.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "tsdown": "^0.22.14",