@fire-spark/payments-transbank-webpay 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 +5 -4
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createPaymentError, definePaymentErrors, toPaymentError } from "@fire-spark/payments";
1
+ import { createPaymentError, definePaymentErrors, paymentResultAmount, toPaymentError } from "@fire-spark/payments";
2
2
  //#region src/constants.ts
3
3
  const TRANSBANK_PROVIDER = "transbank";
4
4
  const WEBPAY_METHOD = "CARD";
@@ -136,7 +136,7 @@ const failedResult = (ctx, error, metadata) => {
136
136
  };
137
137
  return {
138
138
  status: "FAILED",
139
- amount: ctx.amount.value,
139
+ ...paymentResultAmount(ctx.amount.value),
140
140
  metadata: m,
141
141
  error
142
142
  };
@@ -162,11 +162,12 @@ const webpayErrorOf = (ctx, outcome) => {
162
162
  const webpayResultOf = (ctx, outcome) => {
163
163
  const metadata = webpayMetadataOf(ctx, outcome);
164
164
  const amount = ctx.amount.value;
165
+ const exact = paymentResultAmount(amount);
165
166
  if (outcome.status === "PAID") {
166
167
  const details = cardDetailsOf(outcome);
167
168
  const paid = {
168
169
  status: "PAID",
169
- amount,
170
+ ...exact,
170
171
  metadata
171
172
  };
172
173
  return details ? {
@@ -176,7 +177,7 @@ const webpayResultOf = (ctx, outcome) => {
176
177
  }
177
178
  if (outcome.status === "PENDING") return {
178
179
  status: "PENDING",
179
- amount,
180
+ ...exact,
180
181
  metadata
181
182
  };
182
183
  return failedResult(ctx, webpayErrorOf(ctx, outcome), metadata);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fire-spark/payments-transbank-webpay",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "description": "Fire Spark Transbank Webpay Plus adapter (Chile): card payments from the web and apps through the Webpay form, committed by Fire Spark",
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",