@laranex/myanmar-payments 0.0.0-stage → 4.0.0-dev.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/CHANGELOG.md +21 -0
- package/LICENSE.md +21 -0
- package/README.md +10 -2
- package/dist/cjs/aya-pay/aya-pay.d.ts +122 -0
- package/dist/cjs/aya-pay/aya-pay.js +301 -0
- package/dist/cjs/aya-pay/index.d.ts +1 -0
- package/dist/cjs/aya-pay/index.js +8 -0
- package/dist/cjs/core/amount.d.ts +57 -0
- package/dist/cjs/core/amount.js +107 -0
- package/dist/cjs/core/cache.d.ts +26 -0
- package/dist/cjs/core/cache.js +35 -0
- package/dist/cjs/core/callback.d.ts +180 -0
- package/dist/cjs/core/callback.js +304 -0
- package/dist/cjs/core/crypto.d.ts +19 -0
- package/dist/cjs/core/crypto.js +50 -0
- package/dist/cjs/core/env.d.ts +21 -0
- package/dist/cjs/core/env.js +54 -0
- package/dist/cjs/core/errors.d.ts +56 -0
- package/dist/cjs/core/errors.js +78 -0
- package/dist/cjs/core/http.d.ts +81 -0
- package/dist/cjs/core/http.js +128 -0
- package/dist/cjs/core/index.d.ts +8 -0
- package/dist/cjs/core/index.js +30 -0
- package/dist/cjs/core/json.d.ts +44 -0
- package/dist/cjs/core/json.js +254 -0
- package/dist/cjs/core/results.d.ts +122 -0
- package/dist/cjs/core/results.js +147 -0
- package/dist/cjs/core/status.d.ts +50 -0
- package/dist/cjs/core/status.js +60 -0
- package/dist/cjs/core/validate.d.ts +46 -0
- package/dist/cjs/core/validate.js +148 -0
- package/dist/cjs/core/values.d.ts +16 -0
- package/dist/cjs/core/values.js +45 -0
- package/dist/cjs/cyber-source/cyber-source.d.ts +95 -0
- package/dist/cjs/cyber-source/cyber-source.js +188 -0
- package/dist/cjs/cyber-source/index.d.ts +1 -0
- package/dist/cjs/cyber-source/index.js +7 -0
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/kbz-pay/index.d.ts +2 -0
- package/dist/cjs/kbz-pay/index.js +8 -0
- package/dist/cjs/kbz-pay/kbz-pay.d.ts +102 -0
- package/dist/cjs/kbz-pay/kbz-pay.js +266 -0
- package/dist/cjs/kbz-pay/signer.d.ts +15 -0
- package/dist/cjs/kbz-pay/signer.js +36 -0
- package/dist/cjs/myanmar-payments.d.ts +50 -0
- package/dist/cjs/myanmar-payments.js +73 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/wave-money/index.d.ts +1 -0
- package/dist/cjs/wave-money/index.js +6 -0
- package/dist/cjs/wave-money/wave-money.d.ts +111 -0
- package/dist/cjs/wave-money/wave-money.js +251 -0
- package/dist/cjs/yoma-mmqr/index.d.ts +1 -0
- package/dist/cjs/yoma-mmqr/index.js +6 -0
- package/dist/cjs/yoma-mmqr/yoma-mmqr.d.ts +105 -0
- package/dist/cjs/yoma-mmqr/yoma-mmqr.js +233 -0
- package/dist/esm/aya-pay/aya-pay.d.ts +122 -0
- package/dist/esm/aya-pay/aya-pay.js +296 -0
- package/dist/esm/aya-pay/index.d.ts +1 -0
- package/dist/esm/aya-pay/index.js +1 -0
- package/dist/esm/core/amount.d.ts +57 -0
- package/dist/esm/core/amount.js +103 -0
- package/dist/esm/core/cache.d.ts +26 -0
- package/dist/esm/core/cache.js +31 -0
- package/dist/esm/core/callback.d.ts +180 -0
- package/dist/esm/core/callback.js +294 -0
- package/dist/esm/core/crypto.d.ts +19 -0
- package/dist/esm/core/crypto.js +41 -0
- package/dist/esm/core/env.d.ts +21 -0
- package/dist/esm/core/env.js +45 -0
- package/dist/esm/core/errors.d.ts +56 -0
- package/dist/esm/core/errors.js +70 -0
- package/dist/esm/core/http.d.ts +81 -0
- package/dist/esm/core/http.js +121 -0
- package/dist/esm/core/index.d.ts +8 -0
- package/dist/esm/core/index.js +7 -0
- package/dist/esm/core/json.d.ts +44 -0
- package/dist/esm/core/json.js +244 -0
- package/dist/esm/core/results.d.ts +122 -0
- package/dist/esm/core/results.js +139 -0
- package/dist/esm/core/status.d.ts +50 -0
- package/dist/esm/core/status.js +56 -0
- package/dist/esm/core/validate.d.ts +46 -0
- package/dist/esm/core/validate.js +142 -0
- package/dist/esm/core/values.d.ts +16 -0
- package/dist/esm/core/values.js +38 -0
- package/dist/esm/cyber-source/cyber-source.d.ts +95 -0
- package/dist/esm/cyber-source/cyber-source.js +184 -0
- package/dist/esm/cyber-source/index.d.ts +1 -0
- package/dist/esm/cyber-source/index.js +1 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/kbz-pay/index.d.ts +2 -0
- package/dist/esm/kbz-pay/index.js +2 -0
- package/dist/esm/kbz-pay/kbz-pay.d.ts +102 -0
- package/dist/esm/kbz-pay/kbz-pay.js +262 -0
- package/dist/esm/kbz-pay/signer.d.ts +15 -0
- package/dist/esm/kbz-pay/signer.js +32 -0
- package/dist/esm/myanmar-payments.d.ts +50 -0
- package/dist/esm/myanmar-payments.js +69 -0
- package/dist/esm/wave-money/index.d.ts +1 -0
- package/dist/esm/wave-money/index.js +1 -0
- package/dist/esm/wave-money/wave-money.d.ts +111 -0
- package/dist/esm/wave-money/wave-money.js +246 -0
- package/dist/esm/yoma-mmqr/index.d.ts +1 -0
- package/dist/esm/yoma-mmqr/index.js +1 -0
- package/dist/esm/yoma-mmqr/yoma-mmqr.d.ts +105 -0
- package/dist/esm/yoma-mmqr/yoma-mmqr.js +229 -0
- package/package.json +151 -4
- package/skills/node-myanmar-payments/SKILL.md +109 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Validator = void 0;
|
|
4
|
+
exports.toAmount = toAmount;
|
|
5
|
+
exports.byteLength = byteLength;
|
|
6
|
+
const amount_js_1 = require("./amount.js");
|
|
7
|
+
const errors_js_1 = require("./errors.js");
|
|
8
|
+
/**
|
|
9
|
+
* Converts an amount input to an {@link Amount}, or `undefined` when it is missing or not a valid
|
|
10
|
+
* non-negative amount. Validation reports why.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
function toAmount(value) {
|
|
15
|
+
if (value instanceof amount_js_1.Amount) {
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
if ((typeof value === 'number' && Number.isSafeInteger(value) && value >= 0) ||
|
|
19
|
+
(typeof value === 'bigint' && value >= 0n)) {
|
|
20
|
+
return amount_js_1.Amount.kyat(value);
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
/** UTF-8 byte length, matching the byte limits in the gateway documentation. @internal */
|
|
25
|
+
function byteLength(value) {
|
|
26
|
+
return Buffer.byteLength(value, 'utf8');
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Collects one error per field (the first one wins) and throws them together.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
class Validator {
|
|
34
|
+
errors = {};
|
|
35
|
+
required(field, value) {
|
|
36
|
+
if (typeof value !== 'string' || value.trim() === '') {
|
|
37
|
+
this.fail(field, `The ${field} field is required.`);
|
|
38
|
+
}
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
/** Fails when the value is set but not a string. */
|
|
42
|
+
string(field, value) {
|
|
43
|
+
if (value !== undefined && value !== null && typeof value !== 'string') {
|
|
44
|
+
this.fail(field, `The ${field} field must be a string.`);
|
|
45
|
+
}
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
length(field, value, min, max) {
|
|
49
|
+
if (typeof value === 'string' && value !== '') {
|
|
50
|
+
const size = byteLength(value);
|
|
51
|
+
if (size < min || size > max) {
|
|
52
|
+
this.fail(field, `The ${field} field must be between ${min} and ${max} characters.`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
max(field, value, max) {
|
|
58
|
+
if (typeof value === 'string' && byteLength(value) > max) {
|
|
59
|
+
this.fail(field, `The ${field} field must not be greater than ${max} characters.`);
|
|
60
|
+
}
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
pattern(field, value, pattern, description) {
|
|
64
|
+
if (typeof value === 'string' && value !== '' && !pattern.test(value)) {
|
|
65
|
+
this.fail(field, `The ${field} field may only contain ${description}.`);
|
|
66
|
+
}
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
/** Fails when a set value is not an integer within [min, max]. */
|
|
70
|
+
between(field, value, min, max) {
|
|
71
|
+
if (value !== undefined &&
|
|
72
|
+
value !== null &&
|
|
73
|
+
(typeof value !== 'number' || !Number.isInteger(value) || value < min || value > max)) {
|
|
74
|
+
this.fail(field, `The ${field} field must be between ${min} and ${max}.`);
|
|
75
|
+
}
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
amount(field, value, rule) {
|
|
79
|
+
if (value === undefined || value === null) {
|
|
80
|
+
return this.fail(field, `The ${field} field is required.`);
|
|
81
|
+
}
|
|
82
|
+
if (typeof value === 'number' && Number.isFinite(value) && !Number.isInteger(value)) {
|
|
83
|
+
return this.fail(field, `The ${field} field must be a whole number of kyat or an Amount; use Amount.parse('10.50') for decimal amounts.`);
|
|
84
|
+
}
|
|
85
|
+
if (!(value instanceof amount_js_1.Amount) && typeof value !== 'number' && typeof value !== 'bigint') {
|
|
86
|
+
return this.fail(field, `The ${field} field must be an Amount, e.g. Amount.kyat(1000) or Amount.parse('1000.50').`);
|
|
87
|
+
}
|
|
88
|
+
const amount = toAmount(value);
|
|
89
|
+
if (amount === undefined) {
|
|
90
|
+
return this.fail(field, `The ${field} field must be a non-negative number such as 1000 or 1000.50.`);
|
|
91
|
+
}
|
|
92
|
+
const places = amount.decimalPlaces();
|
|
93
|
+
if (rule.maxDecimals === 0 && places > 0) {
|
|
94
|
+
return this.fail(field, `${rule.gateway} does not accept decimal amounts; the ${field} field must be a whole number.`);
|
|
95
|
+
}
|
|
96
|
+
if (rule.maxDecimals !== null && rule.maxDecimals > 0 && places > rule.maxDecimals) {
|
|
97
|
+
return this.fail(field, `${rule.gateway} accepts at most ${rule.maxDecimals} decimal places; the ${field} field has ${places}.`);
|
|
98
|
+
}
|
|
99
|
+
if (rule.allowZero !== true && amount.isZero()) {
|
|
100
|
+
return this.fail(field, `The ${field} field must be greater than 0.`);
|
|
101
|
+
}
|
|
102
|
+
if (rule.maxLength !== undefined && amount.toString().length > rule.maxLength) {
|
|
103
|
+
return this.fail(field, `The ${field} field must not be greater than ${rule.maxLength} characters.`);
|
|
104
|
+
}
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
/** Fails when a set value is not an absolute http or https URL. */
|
|
108
|
+
url(field, value) {
|
|
109
|
+
if (typeof value !== 'string' || value === '') {
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
112
|
+
let valid;
|
|
113
|
+
try {
|
|
114
|
+
const parsed = new URL(value);
|
|
115
|
+
valid = (parsed.protocol === 'http:' || parsed.protocol === 'https:') && parsed.host !== '';
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
valid = false;
|
|
119
|
+
}
|
|
120
|
+
if (!valid) {
|
|
121
|
+
this.fail(field, `The ${field} field must be a valid http or https URL.`);
|
|
122
|
+
}
|
|
123
|
+
return this;
|
|
124
|
+
}
|
|
125
|
+
when(condition, field, message) {
|
|
126
|
+
if (condition) {
|
|
127
|
+
this.fail(field, message);
|
|
128
|
+
}
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
/** Whether any check failed so far. */
|
|
132
|
+
failed() {
|
|
133
|
+
return Object.keys(this.errors).length > 0;
|
|
134
|
+
}
|
|
135
|
+
/** Throws an {@link InvalidPaymentDataError} when any check failed. */
|
|
136
|
+
validate() {
|
|
137
|
+
if (this.failed()) {
|
|
138
|
+
throw new errors_js_1.InvalidPaymentDataError(this.errors);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
fail(field, message) {
|
|
142
|
+
if (!Object.prototype.hasOwnProperty.call(this.errors, field)) {
|
|
143
|
+
this.errors[field] = message;
|
|
144
|
+
}
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.Validator = Validator;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type LosslessObject } from './json.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a scalar as the text a gateway signs: strings as is, numbers exactly as sent, booleans as
|
|
4
|
+
* `true`/`false`. Objects, arrays, `null` and `undefined` return `undefined`.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare function scalarString(value: unknown): string | undefined;
|
|
9
|
+
/** The value at `key` as a string, or `''` when it is missing or not a scalar. @internal */
|
|
10
|
+
export declare function get(source: Record<string, unknown>, key: string): string;
|
|
11
|
+
/** The value at `key` as a string, or `undefined` when it is missing, `null` or not a scalar. @internal */
|
|
12
|
+
export declare function optional(source: Record<string, unknown>, key: string): string | undefined;
|
|
13
|
+
/** The value at `key` with surrounding whitespace removed. @internal */
|
|
14
|
+
export declare function trimmed(source: Record<string, unknown>, key: string): string;
|
|
15
|
+
/** The value at `key` when it is an object (not an array). @internal */
|
|
16
|
+
export declare function object(source: Record<string, unknown>, key: string): LosslessObject | undefined;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scalarString = scalarString;
|
|
4
|
+
exports.get = get;
|
|
5
|
+
exports.optional = optional;
|
|
6
|
+
exports.trimmed = trimmed;
|
|
7
|
+
exports.object = object;
|
|
8
|
+
const json_js_1 = require("./json.js");
|
|
9
|
+
/**
|
|
10
|
+
* Returns a scalar as the text a gateway signs: strings as is, numbers exactly as sent, booleans as
|
|
11
|
+
* `true`/`false`. Objects, arrays, `null` and `undefined` return `undefined`.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
function scalarString(value) {
|
|
16
|
+
switch (typeof value) {
|
|
17
|
+
case 'string':
|
|
18
|
+
return value;
|
|
19
|
+
case 'boolean':
|
|
20
|
+
return value ? 'true' : 'false';
|
|
21
|
+
case 'number':
|
|
22
|
+
return Number.isFinite(value) ? String(value) : undefined;
|
|
23
|
+
case 'bigint':
|
|
24
|
+
return value.toString();
|
|
25
|
+
default:
|
|
26
|
+
return value instanceof json_js_1.JsonNumber ? value.text : undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** The value at `key` as a string, or `''` when it is missing or not a scalar. @internal */
|
|
30
|
+
function get(source, key) {
|
|
31
|
+
return scalarString(source[key]) ?? '';
|
|
32
|
+
}
|
|
33
|
+
/** The value at `key` as a string, or `undefined` when it is missing, `null` or not a scalar. @internal */
|
|
34
|
+
function optional(source, key) {
|
|
35
|
+
return scalarString(source[key]);
|
|
36
|
+
}
|
|
37
|
+
/** The value at `key` with surrounding whitespace removed. @internal */
|
|
38
|
+
function trimmed(source, key) {
|
|
39
|
+
return get(source, key).trim();
|
|
40
|
+
}
|
|
41
|
+
/** The value at `key` when it is an object (not an array). @internal */
|
|
42
|
+
function object(source, key) {
|
|
43
|
+
const value = source[key];
|
|
44
|
+
return (0, json_js_1.isLosslessObject)(value) ? value : undefined;
|
|
45
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type AmountInput } from '../core/amount.js';
|
|
2
|
+
import { CallbackRequest, PaymentCallback } from '../core/callback.js';
|
|
3
|
+
import { type EnvSource } from '../core/env.js';
|
|
4
|
+
import { FormPayment } from '../core/results.js';
|
|
5
|
+
/** The settings of {@link CyberSourceConfig}. */
|
|
6
|
+
export interface CyberSourceConfigOptions {
|
|
7
|
+
/** The Secure Acceptance profile id. */
|
|
8
|
+
profileId: string;
|
|
9
|
+
/** The profile's access key. */
|
|
10
|
+
accessKey: string;
|
|
11
|
+
/** The profile's secret key, which signs the fields. */
|
|
12
|
+
secretKey: string;
|
|
13
|
+
/** Use the test environment (default `true`). */
|
|
14
|
+
sandbox?: boolean | undefined;
|
|
15
|
+
/** Overrides the Secure Acceptance base URL. */
|
|
16
|
+
baseUrl?: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A CyberSource Secure Acceptance profile. A missing credential throws a `ConfigurationError`.
|
|
20
|
+
*/
|
|
21
|
+
export declare class CyberSourceConfig {
|
|
22
|
+
static readonly SANDBOX_URL = "https://testsecureacceptance.cybersource.com";
|
|
23
|
+
static readonly PRODUCTION_URL = "https://secureacceptance.cybersource.com";
|
|
24
|
+
readonly profileId: string;
|
|
25
|
+
readonly accessKey: string;
|
|
26
|
+
readonly secretKey: string;
|
|
27
|
+
readonly sandbox: boolean;
|
|
28
|
+
/** The base URL in use. */
|
|
29
|
+
readonly baseUrl: string;
|
|
30
|
+
constructor(options: CyberSourceConfigOptions);
|
|
31
|
+
/**
|
|
32
|
+
* Reads `CYBER_SOURCE_PROFILE_ID`, `CYBER_SOURCE_ACCESS_KEY`, `CYBER_SOURCE_SECRET_KEY`,
|
|
33
|
+
* `CYBER_SOURCE_SANDBOX` and `CYBER_SOURCE_BASE_URL`.
|
|
34
|
+
*/
|
|
35
|
+
static fromEnv(env?: EnvSource): CyberSourceConfig;
|
|
36
|
+
}
|
|
37
|
+
/** What CyberSource does with the card. */
|
|
38
|
+
export type CyberSourceTransactionType = 'sale' | 'authorization' | 'sale,create_payment_token' | 'authorization,create_payment_token';
|
|
39
|
+
/** The CyberSource transaction types. */
|
|
40
|
+
export declare const CyberSourceTransactionType: Readonly<{
|
|
41
|
+
/** Authorize and capture in one step. */
|
|
42
|
+
readonly Sale: "sale";
|
|
43
|
+
/** Authorize only; capture later. */
|
|
44
|
+
readonly Authorization: "authorization";
|
|
45
|
+
/** A sale that also saves the card as a payment token. */
|
|
46
|
+
readonly SaleAndCreateToken: "sale,create_payment_token";
|
|
47
|
+
/** An authorization that also saves the card as a payment token. */
|
|
48
|
+
readonly AuthorizationAndCreateToken: "authorization,create_payment_token";
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* A Secure Acceptance card payment. CyberSource is multi-currency.
|
|
52
|
+
*/
|
|
53
|
+
export interface CyberSourcePaymentData {
|
|
54
|
+
/** Your order id (`reference_number`), at most 50 characters. Echoed back as `req_reference_number`. */
|
|
55
|
+
orderId: string;
|
|
56
|
+
/** The total in `currency`: 0 or more, any decimals, at most 15 characters, e.g. `Amount.parse('10.50')`. */
|
|
57
|
+
amount: AmountInput;
|
|
58
|
+
/** The URL CyberSource posts the result to (`override_backoffice_post_url`), at most 255 characters. */
|
|
59
|
+
callbackUrl: string;
|
|
60
|
+
/** The receipt page (`override_custom_receipt_page`), at most 255 characters. */
|
|
61
|
+
returnUrl?: string | undefined;
|
|
62
|
+
/** The page shown on cancel (`override_custom_cancel_page`), at most 255 characters. */
|
|
63
|
+
cancelUrl?: string | undefined;
|
|
64
|
+
/** An ISO 4217 code (default `MMK`). */
|
|
65
|
+
currency?: string | undefined;
|
|
66
|
+
/** What to do with the card (default `sale`). */
|
|
67
|
+
transactionType?: CyberSourceTransactionType | undefined;
|
|
68
|
+
/** The hosted page language, e.g. `en-us` (the default). */
|
|
69
|
+
locale?: string | undefined;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* CyberSource Secure Acceptance hosted checkout for card payments: signs the form and verifies the
|
|
73
|
+
* result posts. Makes no network calls.
|
|
74
|
+
*/
|
|
75
|
+
export declare class CyberSource {
|
|
76
|
+
/** The configuration in use. */
|
|
77
|
+
readonly config: CyberSourceConfig;
|
|
78
|
+
constructor(config: CyberSourceConfig | CyberSourceConfigOptions);
|
|
79
|
+
/** A gateway configured from the `CYBER_SOURCE_*` environment variables. */
|
|
80
|
+
static fromEnv(env?: EnvSource): CyberSource;
|
|
81
|
+
/** Checks the payment against the Secure Acceptance field reference; throws an `InvalidPaymentDataError`. */
|
|
82
|
+
static validate(data: CyberSourcePaymentData): void;
|
|
83
|
+
/**
|
|
84
|
+
* Signs the payment fields. The customer's browser must POST the returned form to CyberSource;
|
|
85
|
+
* `toHtml()` renders a page that does it.
|
|
86
|
+
*/
|
|
87
|
+
initiate(data: CyberSourcePaymentData): FormPayment;
|
|
88
|
+
/**
|
|
89
|
+
* Verifies CyberSource's result post. The same check works for the browser post to your receipt
|
|
90
|
+
* page.
|
|
91
|
+
*/
|
|
92
|
+
handleCallback(request: CallbackRequest): PaymentCallback;
|
|
93
|
+
/** Signs the fields listed in `signed_field_names`; `undefined` when a listed field is missing. */
|
|
94
|
+
private sign;
|
|
95
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CyberSource = exports.CyberSourceTransactionType = exports.CyberSourceConfig = void 0;
|
|
4
|
+
const callback_js_1 = require("../core/callback.js");
|
|
5
|
+
const crypto_js_1 = require("../core/crypto.js");
|
|
6
|
+
const env_js_1 = require("../core/env.js");
|
|
7
|
+
const errors_js_1 = require("../core/errors.js");
|
|
8
|
+
const json_js_1 = require("../core/json.js");
|
|
9
|
+
const results_js_1 = require("../core/results.js");
|
|
10
|
+
const status_js_1 = require("../core/status.js");
|
|
11
|
+
const validate_js_1 = require("../core/validate.js");
|
|
12
|
+
const values_js_1 = require("../core/values.js");
|
|
13
|
+
/**
|
|
14
|
+
* A CyberSource Secure Acceptance profile. A missing credential throws a `ConfigurationError`.
|
|
15
|
+
*/
|
|
16
|
+
class CyberSourceConfig {
|
|
17
|
+
static SANDBOX_URL = 'https://testsecureacceptance.cybersource.com';
|
|
18
|
+
static PRODUCTION_URL = 'https://secureacceptance.cybersource.com';
|
|
19
|
+
profileId;
|
|
20
|
+
accessKey;
|
|
21
|
+
secretKey;
|
|
22
|
+
sandbox;
|
|
23
|
+
/** The base URL in use. */
|
|
24
|
+
baseUrl;
|
|
25
|
+
constructor(options) {
|
|
26
|
+
this.profileId = (0, env_js_1.requireSetting)('cyber_source', 'profile_id', options.profileId);
|
|
27
|
+
this.accessKey = (0, env_js_1.requireSetting)('cyber_source', 'access_key', options.accessKey);
|
|
28
|
+
this.secretKey = (0, env_js_1.requireSetting)('cyber_source', 'secret_key', options.secretKey);
|
|
29
|
+
this.sandbox = options.sandbox ?? true;
|
|
30
|
+
this.baseUrl = (0, env_js_1.trimUrl)((0, env_js_1.optionalSetting)(options.baseUrl) ??
|
|
31
|
+
(this.sandbox ? CyberSourceConfig.SANDBOX_URL : CyberSourceConfig.PRODUCTION_URL));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Reads `CYBER_SOURCE_PROFILE_ID`, `CYBER_SOURCE_ACCESS_KEY`, `CYBER_SOURCE_SECRET_KEY`,
|
|
35
|
+
* `CYBER_SOURCE_SANDBOX` and `CYBER_SOURCE_BASE_URL`.
|
|
36
|
+
*/
|
|
37
|
+
static fromEnv(env = (0, env_js_1.defaultEnv)()) {
|
|
38
|
+
return new CyberSourceConfig({
|
|
39
|
+
profileId: (0, env_js_1.envFirst)(env, 'CYBER_SOURCE_PROFILE_ID'),
|
|
40
|
+
accessKey: (0, env_js_1.envFirst)(env, 'CYBER_SOURCE_ACCESS_KEY'),
|
|
41
|
+
secretKey: (0, env_js_1.envFirst)(env, 'CYBER_SOURCE_SECRET_KEY'),
|
|
42
|
+
sandbox: (0, env_js_1.envSandbox)(env, 'CYBER_SOURCE_SANDBOX'),
|
|
43
|
+
baseUrl: (0, env_js_1.envFirst)(env, 'CYBER_SOURCE_BASE_URL'),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.CyberSourceConfig = CyberSourceConfig;
|
|
48
|
+
/** The CyberSource transaction types. */
|
|
49
|
+
exports.CyberSourceTransactionType = Object.freeze({
|
|
50
|
+
/** Authorize and capture in one step. */
|
|
51
|
+
Sale: 'sale',
|
|
52
|
+
/** Authorize only; capture later. */
|
|
53
|
+
Authorization: 'authorization',
|
|
54
|
+
/** A sale that also saves the card as a payment token. */
|
|
55
|
+
SaleAndCreateToken: 'sale,create_payment_token',
|
|
56
|
+
/** An authorization that also saves the card as a payment token. */
|
|
57
|
+
AuthorizationAndCreateToken: 'authorization,create_payment_token',
|
|
58
|
+
});
|
|
59
|
+
const TRANSACTION_TYPES = Object.values(exports.CyberSourceTransactionType);
|
|
60
|
+
const SIGNED_FIELDS = [
|
|
61
|
+
'access_key',
|
|
62
|
+
'profile_id',
|
|
63
|
+
'transaction_uuid',
|
|
64
|
+
'signed_field_names',
|
|
65
|
+
'signed_date_time',
|
|
66
|
+
'locale',
|
|
67
|
+
'transaction_type',
|
|
68
|
+
'reference_number',
|
|
69
|
+
'amount',
|
|
70
|
+
'currency',
|
|
71
|
+
'override_custom_receipt_page',
|
|
72
|
+
'override_backoffice_post_url',
|
|
73
|
+
'override_custom_cancel_page',
|
|
74
|
+
];
|
|
75
|
+
const STATUSES = {
|
|
76
|
+
ACCEPT: 'successful',
|
|
77
|
+
REVIEW: 'pending',
|
|
78
|
+
DECLINE: 'failed',
|
|
79
|
+
ERROR: 'failed',
|
|
80
|
+
CANCEL: 'cancelled',
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* CyberSource Secure Acceptance hosted checkout for card payments: signs the form and verifies the
|
|
84
|
+
* result posts. Makes no network calls.
|
|
85
|
+
*/
|
|
86
|
+
class CyberSource {
|
|
87
|
+
/** The configuration in use. */
|
|
88
|
+
config;
|
|
89
|
+
constructor(config) {
|
|
90
|
+
this.config = config instanceof CyberSourceConfig ? config : new CyberSourceConfig(config);
|
|
91
|
+
}
|
|
92
|
+
/** A gateway configured from the `CYBER_SOURCE_*` environment variables. */
|
|
93
|
+
static fromEnv(env = (0, env_js_1.defaultEnv)()) {
|
|
94
|
+
return new CyberSource(CyberSourceConfig.fromEnv(env));
|
|
95
|
+
}
|
|
96
|
+
/** Checks the payment against the Secure Acceptance field reference; throws an `InvalidPaymentDataError`. */
|
|
97
|
+
static validate(data) {
|
|
98
|
+
new validate_js_1.Validator()
|
|
99
|
+
.required('orderId', data.orderId)
|
|
100
|
+
.max('orderId', data.orderId, 50)
|
|
101
|
+
.amount('amount', data.amount, {
|
|
102
|
+
gateway: 'CyberSource',
|
|
103
|
+
maxDecimals: null,
|
|
104
|
+
maxLength: 15,
|
|
105
|
+
allowZero: true,
|
|
106
|
+
})
|
|
107
|
+
.required('callbackUrl', data.callbackUrl)
|
|
108
|
+
.url('callbackUrl', data.callbackUrl)
|
|
109
|
+
.max('callbackUrl', data.callbackUrl, 255)
|
|
110
|
+
.string('returnUrl', data.returnUrl)
|
|
111
|
+
.url('returnUrl', data.returnUrl)
|
|
112
|
+
.max('returnUrl', data.returnUrl, 255)
|
|
113
|
+
.string('cancelUrl', data.cancelUrl)
|
|
114
|
+
.url('cancelUrl', data.cancelUrl)
|
|
115
|
+
.max('cancelUrl', data.cancelUrl, 255)
|
|
116
|
+
.pattern('currency', String(data.currency || 'MMK'), /^[A-Z]{3}$/, 'a three letter ISO 4217 code')
|
|
117
|
+
.pattern('locale', String(data.locale || 'en-us'), /^[a-z]{2}-[a-z]{2}$/, 'a locale code such as en-us')
|
|
118
|
+
.when(!TRANSACTION_TYPES.includes(String(data.transactionType || 'sale')), 'transactionType', 'The transactionType field is not a supported transaction type.')
|
|
119
|
+
.validate();
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Signs the payment fields. The customer's browser must POST the returned form to CyberSource;
|
|
123
|
+
* `toHtml()` renders a page that does it.
|
|
124
|
+
*/
|
|
125
|
+
initiate(data) {
|
|
126
|
+
CyberSource.validate(data);
|
|
127
|
+
const values = {
|
|
128
|
+
access_key: this.config.accessKey,
|
|
129
|
+
profile_id: this.config.profileId,
|
|
130
|
+
transaction_uuid: (0, crypto_js_1.randomHex)(),
|
|
131
|
+
signed_field_names: SIGNED_FIELDS.join(','),
|
|
132
|
+
signed_date_time: new Date().toISOString().replace(/\.\d{3}Z$/, 'Z'),
|
|
133
|
+
locale: data.locale || 'en-us',
|
|
134
|
+
transaction_type: data.transactionType || 'sale',
|
|
135
|
+
reference_number: data.orderId,
|
|
136
|
+
amount: String((0, validate_js_1.toAmount)(data.amount)),
|
|
137
|
+
currency: data.currency || 'MMK',
|
|
138
|
+
override_custom_receipt_page: data.returnUrl ?? '',
|
|
139
|
+
override_backoffice_post_url: data.callbackUrl,
|
|
140
|
+
override_custom_cancel_page: data.cancelUrl ?? '',
|
|
141
|
+
};
|
|
142
|
+
const fields = SIGNED_FIELDS.map((name) => ({ name, value: values[name] }));
|
|
143
|
+
fields.push({ name: 'signature', value: this.sign(values) });
|
|
144
|
+
return new results_js_1.FormPayment({
|
|
145
|
+
orderId: data.orderId,
|
|
146
|
+
action: `${this.config.baseUrl}/pay`,
|
|
147
|
+
fields,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Verifies CyberSource's result post. The same check works for the browser post to your receipt
|
|
152
|
+
* page.
|
|
153
|
+
*/
|
|
154
|
+
handleCallback(request) {
|
|
155
|
+
const payload = (0, callback_js_1.losslessInput)(request);
|
|
156
|
+
const expected = this.sign(payload);
|
|
157
|
+
if (expected === undefined || !(0, crypto_js_1.safeEqual)(expected, (0, values_js_1.get)(payload, 'signature'))) {
|
|
158
|
+
throw new errors_js_1.SignatureVerificationError('CyberSource callback signature verification failed.', (0, json_js_1.toPlainObject)(payload));
|
|
159
|
+
}
|
|
160
|
+
const decision = (0, values_js_1.trimmed)(payload, 'decision').toUpperCase();
|
|
161
|
+
return new callback_js_1.PaymentCallback({
|
|
162
|
+
orderId: (0, values_js_1.get)(payload, 'req_reference_number'),
|
|
163
|
+
status: (0, status_js_1.resolveStatus)(STATUSES, decision),
|
|
164
|
+
gatewayStatus: decision,
|
|
165
|
+
gatewayReference: (0, values_js_1.optional)(payload, 'transaction_id'),
|
|
166
|
+
amount: (0, values_js_1.get)(payload, 'auth_amount') || (0, values_js_1.optional)(payload, 'req_amount'),
|
|
167
|
+
raw: (0, json_js_1.toPlainObject)(payload),
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/** Signs the fields listed in `signed_field_names`; `undefined` when a listed field is missing. */
|
|
171
|
+
sign(fields) {
|
|
172
|
+
const pairs = [];
|
|
173
|
+
for (const name of (0, values_js_1.get)(fields, 'signed_field_names').split(',')) {
|
|
174
|
+
if (name === '') {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
const value = (0, values_js_1.scalarString)(fields[name]);
|
|
178
|
+
if (value === undefined) {
|
|
179
|
+
return undefined;
|
|
180
|
+
}
|
|
181
|
+
pairs.push(`${name}=${value}`);
|
|
182
|
+
}
|
|
183
|
+
return pairs.length === 0
|
|
184
|
+
? undefined
|
|
185
|
+
: (0, crypto_js_1.hmacSha256Base64)(this.config.secretKey, pairs.join(','));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
exports.CyberSource = CyberSource;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CyberSource, CyberSourceConfig, CyberSourceTransactionType, type CyberSourceConfigOptions, type CyberSourcePaymentData, } from './cyber-source.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CyberSourceTransactionType = exports.CyberSourceConfig = exports.CyberSource = void 0;
|
|
4
|
+
var cyber_source_js_1 = require("./cyber-source.js");
|
|
5
|
+
Object.defineProperty(exports, "CyberSource", { enumerable: true, get: function () { return cyber_source_js_1.CyberSource; } });
|
|
6
|
+
Object.defineProperty(exports, "CyberSourceConfig", { enumerable: true, get: function () { return cyber_source_js_1.CyberSourceConfig; } });
|
|
7
|
+
Object.defineProperty(exports, "CyberSourceTransactionType", { enumerable: true, get: function () { return cyber_source_js_1.CyberSourceTransactionType; } });
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './core/index.js';
|
|
2
|
+
export * from './aya-pay/index.js';
|
|
3
|
+
export * from './cyber-source/index.js';
|
|
4
|
+
export * from './kbz-pay/index.js';
|
|
5
|
+
export * from './wave-money/index.js';
|
|
6
|
+
export * from './yoma-mmqr/index.js';
|
|
7
|
+
export { MyanmarPayments, type MyanmarPaymentsConfig, type MyanmarPaymentsOptions, } from './myanmar-payments.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.MyanmarPayments = void 0;
|
|
18
|
+
__exportStar(require("./core/index.js"), exports);
|
|
19
|
+
__exportStar(require("./aya-pay/index.js"), exports);
|
|
20
|
+
__exportStar(require("./cyber-source/index.js"), exports);
|
|
21
|
+
__exportStar(require("./kbz-pay/index.js"), exports);
|
|
22
|
+
__exportStar(require("./wave-money/index.js"), exports);
|
|
23
|
+
__exportStar(require("./yoma-mmqr/index.js"), exports);
|
|
24
|
+
var myanmar_payments_js_1 = require("./myanmar-payments.js");
|
|
25
|
+
Object.defineProperty(exports, "MyanmarPayments", { enumerable: true, get: function () { return myanmar_payments_js_1.MyanmarPayments; } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KbzPaySigner = exports.KbzPayConfig = exports.KbzPay = void 0;
|
|
4
|
+
var kbz_pay_js_1 = require("./kbz-pay.js");
|
|
5
|
+
Object.defineProperty(exports, "KbzPay", { enumerable: true, get: function () { return kbz_pay_js_1.KbzPay; } });
|
|
6
|
+
Object.defineProperty(exports, "KbzPayConfig", { enumerable: true, get: function () { return kbz_pay_js_1.KbzPayConfig; } });
|
|
7
|
+
var signer_js_1 = require("./signer.js");
|
|
8
|
+
Object.defineProperty(exports, "KbzPaySigner", { enumerable: true, get: function () { return signer_js_1.KbzPaySigner; } });
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { type AmountInput } from '../core/amount.js';
|
|
2
|
+
import { CallbackRequest, PaymentCallback, PaymentStatusResult } from '../core/callback.js';
|
|
3
|
+
import { type EnvSource } from '../core/env.js';
|
|
4
|
+
import { type GatewayOptions, type RequestOptions } from '../core/http.js';
|
|
5
|
+
import { AppPayment, QrPayment, RedirectPayment } from '../core/results.js';
|
|
6
|
+
import { KbzPaySigner } from './signer.js';
|
|
7
|
+
/** The settings of {@link KbzPayConfig}. */
|
|
8
|
+
export interface KbzPayConfigOptions {
|
|
9
|
+
/** The `appid` KBZ issued for your merchant app. */
|
|
10
|
+
appId: string;
|
|
11
|
+
/** The secret key used to sign requests. */
|
|
12
|
+
appKey: string;
|
|
13
|
+
/** The `merch_code` KBZ issued. */
|
|
14
|
+
merchantCode: string;
|
|
15
|
+
/** Use the UAT endpoints (default `true`). UAT and production issue separate credentials. */
|
|
16
|
+
sandbox?: boolean | undefined;
|
|
17
|
+
/** Overrides the API base URL, e.g. to go through a proxy. */
|
|
18
|
+
apiUrl?: string | undefined;
|
|
19
|
+
/** Overrides the PWA checkout URL. A trailing `#` or `#/` is normalized to `#/`. */
|
|
20
|
+
pwaUrl?: string | undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* KBZ Pay credentials and endpoints. A missing credential throws a `ConfigurationError`.
|
|
24
|
+
*/
|
|
25
|
+
export declare class KbzPayConfig {
|
|
26
|
+
static readonly SANDBOX_API_URL = "http://api-uat.kbzpay.com/payment/gateway/uat";
|
|
27
|
+
static readonly PRODUCTION_API_URL = "https://api.kbzpay.com/payment/gateway";
|
|
28
|
+
static readonly SANDBOX_PWA_URL = "https://static.kbzpay.com/pgw/uat/pwa/#/";
|
|
29
|
+
static readonly PRODUCTION_PWA_URL = "https://wap.kbzpay.com/pgw/pwa/#/";
|
|
30
|
+
readonly appId: string;
|
|
31
|
+
readonly appKey: string;
|
|
32
|
+
readonly merchantCode: string;
|
|
33
|
+
readonly sandbox: boolean;
|
|
34
|
+
/** The API base URL in use. */
|
|
35
|
+
readonly apiUrl: string;
|
|
36
|
+
/** The PWA checkout URL in use, always ending in `/`. */
|
|
37
|
+
readonly pwaUrl: string;
|
|
38
|
+
constructor(options: KbzPayConfigOptions);
|
|
39
|
+
/**
|
|
40
|
+
* Reads `KBZ_PAY_APP_ID`, `KBZ_PAY_APP_KEY`, `KBZ_PAY_MERCHANT_CODE`, `KBZ_PAY_SANDBOX`,
|
|
41
|
+
* `KBZ_PAY_BASE_URL` and `KBZ_PAY_PWA_BASE_REDIRECT_URL`.
|
|
42
|
+
*/
|
|
43
|
+
static fromEnv(env?: EnvSource): KbzPayConfig;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A KBZ Pay order, used for the PWA, QR and in-app flows alike. KBZ Pay only accepts MMK.
|
|
47
|
+
*/
|
|
48
|
+
export interface KbzPayPaymentData {
|
|
49
|
+
/** Your unique order id (`merch_order_id`): letters, digits and `_` only, at most 40. */
|
|
50
|
+
orderId: string;
|
|
51
|
+
/** Kyat, greater than 0 with at most 2 decimal places, e.g. `Amount.kyat(1000)` or `Amount.parse('1000.50')`. */
|
|
52
|
+
amount: AmountInput;
|
|
53
|
+
/** The public URL KBZ posts the result to (`notify_url`): at most 512 characters, no query string. */
|
|
54
|
+
callbackUrl: string;
|
|
55
|
+
/** The product name shown to the customer. */
|
|
56
|
+
title?: string | undefined;
|
|
57
|
+
/** How long the order stays payable, 1 to 120 minutes. KBZ defaults to 120. */
|
|
58
|
+
timeoutMinutes?: number | undefined;
|
|
59
|
+
/** Free text KBZ sends back unchanged in the callback, at most 512 characters once URL-encoded. */
|
|
60
|
+
callbackInfo?: string | undefined;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* KBZ Pay: PWA (redirect), QR and in-app payments, order status queries and payment
|
|
64
|
+
* notifications.
|
|
65
|
+
*/
|
|
66
|
+
export declare class KbzPay {
|
|
67
|
+
/** The configuration in use. */
|
|
68
|
+
readonly config: KbzPayConfig;
|
|
69
|
+
/** KBZ Pay's request signer, for custom calls. */
|
|
70
|
+
readonly signer: KbzPaySigner;
|
|
71
|
+
private readonly transport;
|
|
72
|
+
constructor(config: KbzPayConfig | KbzPayConfigOptions, options?: GatewayOptions);
|
|
73
|
+
/** A gateway configured from the `KBZ_PAY_*` environment variables. */
|
|
74
|
+
static fromEnv(env?: EnvSource, options?: GatewayOptions): KbzPay;
|
|
75
|
+
/** Checks the order against KBZ's documented limits; throws an `InvalidPaymentDataError`. */
|
|
76
|
+
static validate(data: KbzPayPaymentData): void;
|
|
77
|
+
/**
|
|
78
|
+
* Creates an order and returns the KBZ Pay PWA checkout URL to redirect the customer to.
|
|
79
|
+
*
|
|
80
|
+
* The redirect only works on a phone with the KBZ Pay app installed, and its Referer must match
|
|
81
|
+
* the URL registered with KBZ.
|
|
82
|
+
*/
|
|
83
|
+
pwa(data: KbzPayPaymentData, options?: RequestOptions): Promise<RedirectPayment>;
|
|
84
|
+
/** Creates an order and returns a QR payload for the customer to scan with the KBZ Pay app. */
|
|
85
|
+
qr(data: KbzPayPaymentData, options?: RequestOptions): Promise<QrPayment>;
|
|
86
|
+
/**
|
|
87
|
+
* Creates an order and returns the signed values your mobile app passes to `KBZPay.startPay()`.
|
|
88
|
+
* The SDK's own result only means the payment screen closed; rely on the callback or `status()`.
|
|
89
|
+
*/
|
|
90
|
+
app(data: KbzPayPaymentData, options?: RequestOptions): Promise<AppPayment>;
|
|
91
|
+
/** Asks KBZ Pay for the current state of an order (`queryorder`). */
|
|
92
|
+
status(orderId: string, options?: RequestOptions): Promise<PaymentStatusResult>;
|
|
93
|
+
/**
|
|
94
|
+
* Verifies KBZ Pay's payment notification. Reply with the callback's `acknowledgement` (plain
|
|
95
|
+
* `success`) or KBZ retries.
|
|
96
|
+
*/
|
|
97
|
+
handleCallback(request: CallbackRequest): PaymentCallback;
|
|
98
|
+
private precreate;
|
|
99
|
+
/** Sends a signed request and returns the `Response` object, throwing when KBZ reports an error. */
|
|
100
|
+
private call;
|
|
101
|
+
private orderInfoFields;
|
|
102
|
+
}
|