@agent-cards/sdk 0.23.17 → 0.23.19
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/CHANGELOG.md +19 -1
- package/README.md +17 -4
- package/dist/aci.d.ts +0 -7
- package/dist/aci.js +0 -19
- package/dist/card-fields.generated.js +963 -33
- package/dist/client.d.ts +24 -1
- package/dist/client.js +198 -57
- package/dist/datatrans.d.ts +2 -2
- package/dist/datatrans.generated.js +16 -11
- package/dist/datatrans.js +2 -2
- package/dist/pelecard.generated.d.ts +2 -1
- package/dist/pelecard.generated.js +14 -5
- package/dist/primer.generated.js +987 -57
- package/dist/stripe-checkout.generated.js +491 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// Generated from @agent-cards/payment-core. Do not edit.
|
|
3
|
-
// artifact-sha256:
|
|
3
|
+
// artifact-sha256: 30904474bf2bd6c0b0aac97deda8fe133514a241e7060e782118af5fba813fe4
|
|
4
4
|
// src/json-path.js
|
|
5
5
|
function roundTrips(parsed, body) {
|
|
6
6
|
try {
|
|
@@ -14,6 +14,7 @@ function roundTrips(parsed, body) {
|
|
|
14
14
|
var PELECARD_TRANSACTION_HOSTS = /* @__PURE__ */ Object.freeze(["gateway21.pelecard.biz", "gateway20.pelecard.biz"]);
|
|
15
15
|
var PELECARD_TRANSACTION_PATH = "/PaymentGW/Transaction";
|
|
16
16
|
var PELECARD_REFUSAL_REASONS = /* @__PURE__ */ Object.freeze(["unsupported", "keep_on_file"]);
|
|
17
|
+
var PELECARD_SUCCESS_CODES = /* @__PURE__ */ Object.freeze(["000", "302"]);
|
|
17
18
|
var UNSUPPORTED_REFUSAL = "Refusing to pay: unsupported Pelecard card payment request.";
|
|
18
19
|
var KEEP_ON_FILE_REFUSAL = "Refusing to pay: this Pelecard payment would keep the card on file without your consent. Nothing was sent.";
|
|
19
20
|
var TEST_CARD_REFUSAL = "Refusing to pay: a Pelecard checkout takes only a documented test card, because the merchant can have Pelecard keep the card without asking you. Nothing was sent.";
|
|
@@ -214,6 +215,9 @@ function landingUrl(value) {
|
|
|
214
215
|
return null;
|
|
215
216
|
}
|
|
216
217
|
}
|
|
218
|
+
function inPageDebit(value) {
|
|
219
|
+
return absent(value.UrlKashCash) && value.StatusDescription !== "Gama Completion Required" && (value.DisplayIshurPopUp === void 0 || value.DisplayIshurPopUp === null || value.DisplayIshurPopUp === false);
|
|
220
|
+
}
|
|
217
221
|
function pelecardResponseOutcome(status, body) {
|
|
218
222
|
if (Number.isInteger(status) && status >= 400 && status < 500)
|
|
219
223
|
return clientErrorOutcome(status, body);
|
|
@@ -225,7 +229,7 @@ function pelecardResponseOutcome(status, body) {
|
|
|
225
229
|
const code = value.StatusCode;
|
|
226
230
|
if (!exact(/^[0-9]{3}$/, code))
|
|
227
231
|
return { outcome: "unknown", reason: "pelecard_unexpected_response" };
|
|
228
|
-
if (code
|
|
232
|
+
if (!PELECARD_SUCCESS_CODES.includes(code)) {
|
|
229
233
|
return absent(value.ApprovalNo) ? { outcome: "refused", code } : { outcome: "unknown", reason: "pelecard_unconfirmed" };
|
|
230
234
|
}
|
|
231
235
|
if (!REDIRECT_KEYS.every((key) => typeof value[key] === "string") || owns(value, "ParamX") && value.ParamX !== null && typeof value.ParamX !== "string") {
|
|
@@ -233,6 +237,9 @@ function pelecardResponseOutcome(status, body) {
|
|
|
233
237
|
}
|
|
234
238
|
if (value.DisplayIshurPopUp === true || !absent(value.UrlOpenFinance))
|
|
235
239
|
return { outcome: "unknown", reason: "pelecard_unconfirmed" };
|
|
240
|
+
if (code === "302" && value.LandingURL === "") {
|
|
241
|
+
return inPageDebit(value) ? { outcome: "approved" } : { outcome: "unknown", reason: "pelecard_unconfirmed" };
|
|
242
|
+
}
|
|
236
243
|
const landing = landingUrl(value.LandingURL);
|
|
237
244
|
if (!landing)
|
|
238
245
|
return { outcome: "unknown", reason: "pelecard_unconfirmed" };
|
|
@@ -246,7 +253,7 @@ function clientErrorOutcome(status, body) {
|
|
|
246
253
|
if (!value || !owns(value, "StatusCode") && !owns(value, "ApprovalNo"))
|
|
247
254
|
return { outcome: "refused", code: `http_${status}` };
|
|
248
255
|
const code = value.StatusCode;
|
|
249
|
-
return exact(/^[0-9]{3}$/, code) && code
|
|
256
|
+
return exact(/^[0-9]{3}$/, code) && !PELECARD_SUCCESS_CODES.includes(code) && absent(value.ApprovalNo) ? { outcome: "refused", code } : { outcome: "unknown", reason: "pelecard_unconfirmed" };
|
|
250
257
|
}
|
|
251
258
|
function sanitizePelecardResponse(body) {
|
|
252
259
|
const fail = () => {
|
|
@@ -260,7 +267,7 @@ function sanitizePelecardResponse(body) {
|
|
|
260
267
|
const safe = {
|
|
261
268
|
LandingURL: value.LandingURL,
|
|
262
269
|
Target: value.Target,
|
|
263
|
-
StatusCode:
|
|
270
|
+
StatusCode: value.StatusCode,
|
|
264
271
|
StatusDescription: markupSafe(value.StatusDescription, 256) && !panLike(value.StatusDescription) ? value.StatusDescription : "",
|
|
265
272
|
ApprovalNo: value.ApprovalNo,
|
|
266
273
|
Token: "",
|
|
@@ -271,6 +278,8 @@ function sanitizePelecardResponse(body) {
|
|
|
271
278
|
safe.UserKey = value.UserKey;
|
|
272
279
|
safe.UseEndOfProcess = value.UseEndOfProcess;
|
|
273
280
|
safe.FeedbackDataTransferMethod = value.FeedbackDataTransferMethod;
|
|
281
|
+
if (value.LandingURL === "")
|
|
282
|
+
safe.UrlOpenFinance = "";
|
|
274
283
|
return JSON.stringify(safe);
|
|
275
284
|
}
|
|
276
285
|
function pelecardFacts(status, body) {
|
|
@@ -280,4 +289,4 @@ function pelecardFacts(status, body) {
|
|
|
280
289
|
refusalCode: verdict.outcome === "refused" && /^[0-9]{3}$/.test(verdict.code) ? verdict.code : null
|
|
281
290
|
};
|
|
282
291
|
}
|
|
283
|
-
export { PELECARD_REFUSAL_REASONS, PELECARD_TRANSACTION_HOSTS, PELECARD_TRANSACTION_PATH, classifyPelecardRequest, injectPelecardCard, isPelecardNewCardBody, isPelecardTransactionRequest, isPelecardTransactionUrl, pelecardBodyRefusal, pelecardFacts, pelecardKeepOnFileRequested, pelecardRefusalMessage, pelecardResponseOutcome, pelecardTransactionRefusal, sanitizePelecardResponse };
|
|
292
|
+
export { PELECARD_REFUSAL_REASONS, PELECARD_SUCCESS_CODES, PELECARD_TRANSACTION_HOSTS, PELECARD_TRANSACTION_PATH, classifyPelecardRequest, injectPelecardCard, isPelecardNewCardBody, isPelecardTransactionRequest, isPelecardTransactionUrl, pelecardBodyRefusal, pelecardFacts, pelecardKeepOnFileRequested, pelecardRefusalMessage, pelecardResponseOutcome, pelecardTransactionRefusal, sanitizePelecardResponse };
|