@fire-spark/payments-credibanco 0.23.0 → 0.25.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.
- package/dist/index.js +14 -10
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PaymentError, createPaymentError, definePaymentErrors } from "@fire-spark/payments";
|
|
1
|
+
import { PaymentError, createPaymentError, definePaymentErrors, paymentResultAmount } from "@fire-spark/payments";
|
|
2
2
|
//#region src/constants.ts
|
|
3
3
|
const CREDIBANCO_PROVIDER = "credibanco";
|
|
4
4
|
/** AlterPay payment ways offered on `BANK_TRANSFER`. */
|
|
@@ -90,7 +90,7 @@ const failedResult = (ctx, error, metadata) => {
|
|
|
90
90
|
};
|
|
91
91
|
return {
|
|
92
92
|
status: "FAILED",
|
|
93
|
-
|
|
93
|
+
...paymentResultAmount(ctx.amount.value),
|
|
94
94
|
metadata: m,
|
|
95
95
|
error
|
|
96
96
|
};
|
|
@@ -99,7 +99,7 @@ const pendingResult = (ctx, mdOrder) => {
|
|
|
99
99
|
const metadata = credibancoMetadataOf(ctx, mdOrder);
|
|
100
100
|
return {
|
|
101
101
|
status: "PENDING",
|
|
102
|
-
|
|
102
|
+
...paymentResultAmount(ctx.amount.value),
|
|
103
103
|
metadata
|
|
104
104
|
};
|
|
105
105
|
};
|
|
@@ -131,15 +131,19 @@ const credibancoResultOf = (ctx, input) => {
|
|
|
131
131
|
const card = input.card ?? null;
|
|
132
132
|
const metadata = credibancoMetadataOf(ctx, mdOrder, outcome, card);
|
|
133
133
|
const amount = ctx.amount.value;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
134
|
+
const exact = paymentResultAmount(amount);
|
|
135
|
+
if (outcome.status === "PAID") {
|
|
136
|
+
const details = detailsOf(card, input.processor ?? null, outcome, mdOrder);
|
|
137
|
+
return {
|
|
138
|
+
status: "PAID",
|
|
139
|
+
...exact,
|
|
140
|
+
metadata,
|
|
141
|
+
details
|
|
142
|
+
};
|
|
143
|
+
}
|
|
140
144
|
if (outcome.status === "PENDING") return {
|
|
141
145
|
status: "PENDING",
|
|
142
|
-
|
|
146
|
+
...exact,
|
|
143
147
|
metadata
|
|
144
148
|
};
|
|
145
149
|
let code = (input.kind ? input.kind === "card" : Boolean(card)) ? "CARD_DECLINED" : "WALLET_REJECTED";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fire-spark/payments-credibanco",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Fire Spark Credibanco adapters (Colombia): card saved first and paid with its binding (3-D Secure by redirect), PSE and Botón Bancolombia through AlterPay, verified by the Fire Spark API; credentials never reach the channel",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@fire-spark/payments": "^0.
|
|
21
|
-
"@fire-spark/types": "^0.
|
|
20
|
+
"@fire-spark/payments": "^0.25.0",
|
|
21
|
+
"@fire-spark/types": "^0.25.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"tsdown": "^0.22.14",
|