@sakeetech/viva-payments-core 0.2.1
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/LICENSE +21 -0
- package/README.md +413 -0
- package/dist/auth/http.d.ts +44 -0
- package/dist/auth/http.d.ts.map +1 -0
- package/dist/auth/http.js +80 -0
- package/dist/auth/http.js.map +1 -0
- package/dist/auth/index.d.ts +19 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +18 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/oauth2-strategy.d.ts +117 -0
- package/dist/auth/oauth2-strategy.d.ts.map +1 -0
- package/dist/auth/oauth2-strategy.js +217 -0
- package/dist/auth/oauth2-strategy.js.map +1 -0
- package/dist/auth/reseller-strategy.d.ts +65 -0
- package/dist/auth/reseller-strategy.d.ts.map +1 -0
- package/dist/auth/reseller-strategy.js +68 -0
- package/dist/auth/reseller-strategy.js.map +1 -0
- package/dist/auth/single-flight.d.ts +81 -0
- package/dist/auth/single-flight.d.ts.map +1 -0
- package/dist/auth/single-flight.js +160 -0
- package/dist/auth/single-flight.js.map +1 -0
- package/dist/auth/token-cache.d.ts +50 -0
- package/dist/auth/token-cache.d.ts.map +1 -0
- package/dist/auth/token-cache.js +59 -0
- package/dist/auth/token-cache.js.map +1 -0
- package/dist/errors/api-error.d.ts +15 -0
- package/dist/errors/api-error.d.ts.map +1 -0
- package/dist/errors/api-error.js +18 -0
- package/dist/errors/api-error.js.map +1 -0
- package/dist/errors/auth-error.d.ts +14 -0
- package/dist/errors/auth-error.d.ts.map +1 -0
- package/dist/errors/auth-error.js +17 -0
- package/dist/errors/auth-error.js.map +1 -0
- package/dist/errors/base.d.ts +59 -0
- package/dist/errors/base.d.ts.map +1 -0
- package/dist/errors/base.js +51 -0
- package/dist/errors/base.js.map +1 -0
- package/dist/errors/index.d.ts +18 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +16 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/mode-mismatch-error.d.ts +19 -0
- package/dist/errors/mode-mismatch-error.d.ts.map +1 -0
- package/dist/errors/mode-mismatch-error.js +22 -0
- package/dist/errors/mode-mismatch-error.js.map +1 -0
- package/dist/errors/rate-limit-error.d.ts +20 -0
- package/dist/errors/rate-limit-error.d.ts.map +1 -0
- package/dist/errors/rate-limit-error.js +20 -0
- package/dist/errors/rate-limit-error.js.map +1 -0
- package/dist/errors/validation-error.d.ts +14 -0
- package/dist/errors/validation-error.d.ts.map +1 -0
- package/dist/errors/validation-error.js +17 -0
- package/dist/errors/validation-error.js.map +1 -0
- package/dist/errors/webhook-error.d.ts +14 -0
- package/dist/errors/webhook-error.d.ts.map +1 -0
- package/dist/errors/webhook-error.js +17 -0
- package/dist/errors/webhook-error.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/isv/accounts.d.ts +38 -0
- package/dist/isv/accounts.d.ts.map +1 -0
- package/dist/isv/accounts.js +60 -0
- package/dist/isv/accounts.js.map +1 -0
- package/dist/isv/client.d.ts +187 -0
- package/dist/isv/client.d.ts.map +1 -0
- package/dist/isv/client.js +465 -0
- package/dist/isv/client.js.map +1 -0
- package/dist/isv/index.d.ts +52 -0
- package/dist/isv/index.d.ts.map +1 -0
- package/dist/isv/index.js +53 -0
- package/dist/isv/index.js.map +1 -0
- package/dist/isv/legacy-basic-client.d.ts +122 -0
- package/dist/isv/legacy-basic-client.d.ts.map +1 -0
- package/dist/isv/legacy-basic-client.js +281 -0
- package/dist/isv/legacy-basic-client.js.map +1 -0
- package/dist/isv/payments.d.ts +199 -0
- package/dist/isv/payments.d.ts.map +1 -0
- package/dist/isv/payments.js +385 -0
- package/dist/isv/payments.js.map +1 -0
- package/dist/isv/sources.d.ts +80 -0
- package/dist/isv/sources.d.ts.map +1 -0
- package/dist/isv/sources.js +112 -0
- package/dist/isv/sources.js.map +1 -0
- package/dist/isv/webhooks-api.d.ts +48 -0
- package/dist/isv/webhooks-api.d.ts.map +1 -0
- package/dist/isv/webhooks-api.js +66 -0
- package/dist/isv/webhooks-api.js.map +1 -0
- package/dist/legacy/client.d.ts +199 -0
- package/dist/legacy/client.d.ts.map +1 -0
- package/dist/legacy/client.js +351 -0
- package/dist/legacy/client.js.map +1 -0
- package/dist/legacy/index.d.ts +15 -0
- package/dist/legacy/index.d.ts.map +1 -0
- package/dist/legacy/index.js +14 -0
- package/dist/legacy/index.js.map +1 -0
- package/dist/observability/context.d.ts +30 -0
- package/dist/observability/context.d.ts.map +1 -0
- package/dist/observability/context.js +40 -0
- package/dist/observability/context.js.map +1 -0
- package/dist/observability/index.d.ts +15 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +11 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/logger.d.ts +81 -0
- package/dist/observability/logger.d.ts.map +1 -0
- package/dist/observability/logger.js +127 -0
- package/dist/observability/logger.js.map +1 -0
- package/dist/observability/metrics.d.ts +37 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +40 -0
- package/dist/observability/metrics.js.map +1 -0
- package/dist/observability/redact.d.ts +21 -0
- package/dist/observability/redact.d.ts.map +1 -0
- package/dist/observability/redact.js +72 -0
- package/dist/observability/redact.js.map +1 -0
- package/dist/observability/tracer.d.ts +25 -0
- package/dist/observability/tracer.d.ts.map +1 -0
- package/dist/observability/tracer.js +18 -0
- package/dist/observability/tracer.js.map +1 -0
- package/dist/payments/client.d.ts +247 -0
- package/dist/payments/client.d.ts.map +1 -0
- package/dist/payments/client.js +488 -0
- package/dist/payments/client.js.map +1 -0
- package/dist/payments/index.d.ts +14 -0
- package/dist/payments/index.d.ts.map +1 -0
- package/dist/payments/index.js +13 -0
- package/dist/payments/index.js.map +1 -0
- package/dist/refunds/fast-refund-client.d.ts +128 -0
- package/dist/refunds/fast-refund-client.d.ts.map +1 -0
- package/dist/refunds/fast-refund-client.js +138 -0
- package/dist/refunds/fast-refund-client.js.map +1 -0
- package/dist/refunds/index.d.ts +19 -0
- package/dist/refunds/index.d.ts.map +1 -0
- package/dist/refunds/index.js +17 -0
- package/dist/refunds/index.js.map +1 -0
- package/dist/refunds/strategy.d.ts +78 -0
- package/dist/refunds/strategy.d.ts.map +1 -0
- package/dist/refunds/strategy.js +75 -0
- package/dist/refunds/strategy.js.map +1 -0
- package/dist/types/auth.d.ts +80 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +12 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/card-types.d.ts +48 -0
- package/dist/types/card-types.d.ts.map +1 -0
- package/dist/types/card-types.js +62 -0
- package/dist/types/card-types.js.map +1 -0
- package/dist/types/common.d.ts +160 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +70 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +21 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/isv-accounts.d.ts +109 -0
- package/dist/types/isv-accounts.d.ts.map +1 -0
- package/dist/types/isv-accounts.js +22 -0
- package/dist/types/isv-accounts.js.map +1 -0
- package/dist/types/isv-payments.d.ts +262 -0
- package/dist/types/isv-payments.d.ts.map +1 -0
- package/dist/types/isv-payments.js +19 -0
- package/dist/types/isv-payments.js.map +1 -0
- package/dist/types/status.d.ts +125 -0
- package/dist/types/status.d.ts.map +1 -0
- package/dist/types/status.js +19 -0
- package/dist/types/status.js.map +1 -0
- package/dist/types/webhook-events.d.ts +447 -0
- package/dist/types/webhook-events.d.ts.map +1 -0
- package/dist/types/webhook-events.js +76 -0
- package/dist/types/webhook-events.js.map +1 -0
- package/dist/webhooks/challenge-response.d.ts +28 -0
- package/dist/webhooks/challenge-response.d.ts.map +1 -0
- package/dist/webhooks/challenge-response.js +35 -0
- package/dist/webhooks/challenge-response.js.map +1 -0
- package/dist/webhooks/event-types.d.ts +44 -0
- package/dist/webhooks/event-types.d.ts.map +1 -0
- package/dist/webhooks/event-types.js +50 -0
- package/dist/webhooks/event-types.js.map +1 -0
- package/dist/webhooks/extract-client-ip.d.ts +40 -0
- package/dist/webhooks/extract-client-ip.d.ts.map +1 -0
- package/dist/webhooks/extract-client-ip.js +72 -0
- package/dist/webhooks/extract-client-ip.js.map +1 -0
- package/dist/webhooks/hmac-verify.d.ts +38 -0
- package/dist/webhooks/hmac-verify.d.ts.map +1 -0
- package/dist/webhooks/hmac-verify.js +92 -0
- package/dist/webhooks/hmac-verify.js.map +1 -0
- package/dist/webhooks/index.d.ts +19 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/index.js +19 -0
- package/dist/webhooks/index.js.map +1 -0
- package/dist/webhooks/ip-allowlist.d.ts +59 -0
- package/dist/webhooks/ip-allowlist.d.ts.map +1 -0
- package/dist/webhooks/ip-allowlist.js +147 -0
- package/dist/webhooks/ip-allowlist.js.map +1 -0
- package/dist/webhooks/status-lattice.d.ts +72 -0
- package/dist/webhooks/status-lattice.d.ts.map +1 -0
- package/dist/webhooks/status-lattice.js +208 -0
- package/dist/webhooks/status-lattice.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viva's numeric CardTypeId → string scheme name mapping.
|
|
3
|
+
*
|
|
4
|
+
* Used by `Payments.retrieveTransaction` to populate the normalized
|
|
5
|
+
* `cardType: string` field for downstream consumers (e.g.,
|
|
6
|
+
* {@link import('../refunds/strategy.js').resolveRefundStrategy resolveRefundStrategy}).
|
|
7
|
+
*
|
|
8
|
+
* Mapping source: `references/viva-docs/md/wh-transaction-payment-created.txt`
|
|
9
|
+
* (search for `CardTypeId`). Viva documents the following nine values:
|
|
10
|
+
*
|
|
11
|
+
* 0 = Visa
|
|
12
|
+
* 1 = Mastercard
|
|
13
|
+
* 2 = Diners
|
|
14
|
+
* 3 = Amex
|
|
15
|
+
* 4 = Invalid
|
|
16
|
+
* 5 = Unknown
|
|
17
|
+
* 6 = Maestro
|
|
18
|
+
* 7 = Discover
|
|
19
|
+
* 8 = JCB
|
|
20
|
+
*
|
|
21
|
+
* Casing note:
|
|
22
|
+
* `resolveRefundStrategy` matches the Fast-Refund eligible-scheme set
|
|
23
|
+
* case-sensitively against the string emitted here. The strategy's set
|
|
24
|
+
* uses `'MasterCard'` (camelCase). We emit `'MasterCard'` for cardTypeId
|
|
25
|
+
* `1` to match — this is the only difference from the doc's raw casing.
|
|
26
|
+
* Diners is emitted as the doc's `'Diners'` (no "Club") so future
|
|
27
|
+
* eligibility additions key off a single canonical string.
|
|
28
|
+
*
|
|
29
|
+
* The sentinel categories `Invalid` (4) and `Unknown` (5) are intentionally
|
|
30
|
+
* NOT exposed as scheme strings — they indicate "no useful card info" and
|
|
31
|
+
* `resolveCardType` returns `undefined` for them so the auto-refund
|
|
32
|
+
* decision falls through to `auto-no-card-info`.
|
|
33
|
+
*
|
|
34
|
+
* @see references/viva-docs/md/wh-transaction-payment-created.txt — search "CardTypeId"
|
|
35
|
+
* @see ../refunds/strategy.ts (FAST_REFUND_ELIGIBLE_SCHEMES)
|
|
36
|
+
* @see docs/STATE-MACHINE.md §3.1
|
|
37
|
+
*/
|
|
38
|
+
export const CARD_TYPE_BY_ID = Object.freeze({
|
|
39
|
+
0: 'Visa',
|
|
40
|
+
1: 'MasterCard',
|
|
41
|
+
2: 'Diners',
|
|
42
|
+
3: 'Amex',
|
|
43
|
+
// 4 = Invalid → intentionally omitted (sentinel, not a scheme)
|
|
44
|
+
// 5 = Unknown → intentionally omitted (sentinel, not a scheme)
|
|
45
|
+
6: 'Maestro',
|
|
46
|
+
7: 'Discover',
|
|
47
|
+
8: 'JCB',
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Pure helper — returns the string scheme name for a Viva numeric cardTypeId,
|
|
51
|
+
* or `undefined` if the id is null/undefined, a known sentinel (Invalid /
|
|
52
|
+
* Unknown), or not present in the documented mapping.
|
|
53
|
+
*
|
|
54
|
+
* Pure, no I/O. Safe to call from anywhere — including refund strategy
|
|
55
|
+
* decisions and tests.
|
|
56
|
+
*/
|
|
57
|
+
export function resolveCardType(cardTypeId) {
|
|
58
|
+
if (cardTypeId == null)
|
|
59
|
+
return undefined;
|
|
60
|
+
return CARD_TYPE_BY_ID[cardTypeId];
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=card-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-types.js","sourceRoot":"","sources":["../../src/types/card-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,MAAM,eAAe,GAAqC,MAAM,CAAC,MAAM,CAAC;IAC7E,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,YAAY;IACf,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,MAAM;IACT,gEAAgE;IAChE,gEAAgE;IAChE,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,KAAK;CACT,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAqC;IAErC,IAAI,UAAU,IAAI,IAAI;QAAE,OAAO,SAAS,CAAC;IACzC,OAAO,eAAe,CAAC,UAAU,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common primitives shared across the Viva Wallet ISV API surface.
|
|
3
|
+
*
|
|
4
|
+
* Covers: currency branding, money representation, ID aliases,
|
|
5
|
+
* environment enumeration, and pagination helpers.
|
|
6
|
+
*
|
|
7
|
+
* @see references/viva-docs/md/wh-transaction-payment-created.txt:487
|
|
8
|
+
* @see references/viva-docs/md/webhooks-for-payments.txt:383
|
|
9
|
+
* @see references/viva-docs/md/oauth2-authentication.txt:145
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* ISO 4217 numeric currency code, represented as a three-digit string.
|
|
13
|
+
* Examples: '978' for EUR, '826' for GBP, '840' for USD.
|
|
14
|
+
*
|
|
15
|
+
* Branded so it cannot be confused with an arbitrary string.
|
|
16
|
+
*
|
|
17
|
+
* @see references/viva-docs/md/wh-transaction-payment-created.txt:487
|
|
18
|
+
*/
|
|
19
|
+
export type CurrencyCode = string & {
|
|
20
|
+
readonly __brand: 'CurrencyCode';
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Narrow cast helper — call when you have a validated ISO 4217 numeric string.
|
|
24
|
+
* Runtime validation lives in the implementation layer (S2/S6).
|
|
25
|
+
*/
|
|
26
|
+
export declare function asCurrencyCode(code: string): CurrencyCode;
|
|
27
|
+
/**
|
|
28
|
+
* Commonly used ISO 4217 numeric currency codes.
|
|
29
|
+
* The map provides ergonomic named constants; the type accepts any 3-digit
|
|
30
|
+
* numeric string so the list is non-exhaustive.
|
|
31
|
+
*
|
|
32
|
+
* @see references/viva-docs/md/wh-transaction-payment-created.txt:487
|
|
33
|
+
*/
|
|
34
|
+
export declare const CURRENCY_CODES: {
|
|
35
|
+
readonly EUR: CurrencyCode;
|
|
36
|
+
readonly GBP: CurrencyCode;
|
|
37
|
+
readonly USD: CurrencyCode;
|
|
38
|
+
readonly PLN: CurrencyCode;
|
|
39
|
+
readonly RON: CurrencyCode;
|
|
40
|
+
readonly CZK: CurrencyCode;
|
|
41
|
+
readonly HUF: CurrencyCode;
|
|
42
|
+
readonly BGN: CurrencyCode;
|
|
43
|
+
readonly DKK: CurrencyCode;
|
|
44
|
+
readonly SEK: CurrencyCode;
|
|
45
|
+
readonly NOK: CurrencyCode;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Integer minor units (e.g. EUR 12.34 = 1234n).
|
|
49
|
+
*
|
|
50
|
+
* Plan P15 mandates bigint minor units throughout viva-payments-core.
|
|
51
|
+
* Wire format to/from Viva is a JSON integer; convert at the boundary only.
|
|
52
|
+
* NEVER use number for amounts.
|
|
53
|
+
*/
|
|
54
|
+
export type MinorUnits = bigint;
|
|
55
|
+
/**
|
|
56
|
+
* A typed money value combining minor-unit amount with its currency.
|
|
57
|
+
*/
|
|
58
|
+
export interface Money {
|
|
59
|
+
/** Integer minor units. E.g. 1234n for EUR 12.34. */
|
|
60
|
+
readonly amount: MinorUnits;
|
|
61
|
+
/** ISO 4217 numeric currency code. */
|
|
62
|
+
readonly currency: CurrencyCode;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* UUID string representing a Viva Merchant ID.
|
|
66
|
+
*
|
|
67
|
+
* @see references/viva-docs/md/wh-transaction-payment-created.txt:175
|
|
68
|
+
*/
|
|
69
|
+
export type MerchantId = string & {
|
|
70
|
+
readonly __brand: 'MerchantId';
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* UUID string representing a Viva Connected Account ID.
|
|
74
|
+
* Used for ISV and Marketplace onboarding.
|
|
75
|
+
*
|
|
76
|
+
* @see references/viva-docs/md/wh-account-connected.txt:153
|
|
77
|
+
*/
|
|
78
|
+
export type ConnectedAccountId = string & {
|
|
79
|
+
readonly __brand: 'ConnectedAccountId';
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* UUID string representing a Viva Transaction ID.
|
|
83
|
+
*
|
|
84
|
+
* @see references/viva-docs/md/wh-transaction-payment-created.txt:193
|
|
85
|
+
*/
|
|
86
|
+
export type TransactionId = string & {
|
|
87
|
+
readonly __brand: 'TransactionId';
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Long integer (bigint in TS) representing a Viva Order Code.
|
|
91
|
+
* Viva uses int64 for order codes; docs show values like 2271655739472609.
|
|
92
|
+
* Stored as bigint to avoid loss of precision beyond Number.MAX_SAFE_INTEGER.
|
|
93
|
+
*
|
|
94
|
+
* @see references/viva-docs/md/wh-transaction-payment-created.txt:176
|
|
95
|
+
*/
|
|
96
|
+
export type OrderCode = bigint;
|
|
97
|
+
/**
|
|
98
|
+
* Viva Wallet API environment selector.
|
|
99
|
+
*
|
|
100
|
+
* - `demo` → https://demo-accounts.vivapayments.com (auth)
|
|
101
|
+
* https://demo-api.vivapayments.com (API)
|
|
102
|
+
* - `production` → https://accounts.vivapayments.com (auth)
|
|
103
|
+
* https://api.vivapayments.com (API)
|
|
104
|
+
*
|
|
105
|
+
* @see references/viva-docs/md/oauth2-authentication.txt:145
|
|
106
|
+
*/
|
|
107
|
+
export type VivaEnvironment = 'demo' | 'production';
|
|
108
|
+
/**
|
|
109
|
+
* Base URLs for each environment.
|
|
110
|
+
*
|
|
111
|
+
* @see references/viva-docs/md/oauth2-authentication.txt:145
|
|
112
|
+
*/
|
|
113
|
+
export interface VivaEnvironmentUrls {
|
|
114
|
+
readonly authBaseUrl: string;
|
|
115
|
+
readonly apiBaseUrl: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Well-known base URLs keyed by environment.
|
|
119
|
+
*
|
|
120
|
+
* @see references/viva-docs/md/oauth2-authentication.txt:145
|
|
121
|
+
*/
|
|
122
|
+
export declare const ENVIRONMENT_URLS: Record<VivaEnvironment, VivaEnvironmentUrls>;
|
|
123
|
+
/**
|
|
124
|
+
* Legacy host base URLs (Basic auth endpoints).
|
|
125
|
+
*
|
|
126
|
+
* The Viva legacy API lives on `demo.vivapayments.com` / `www.vivapayments.com`.
|
|
127
|
+
* These hosts are used for endpoints that Viva has NOT migrated to the v2/OAuth2
|
|
128
|
+
* surface — specifically `POST /api/transactions/{transactionId}` (refund/cancel-transaction).
|
|
129
|
+
*
|
|
130
|
+
* Verified against Viva sandbox 2026-04-25 (probe scripts):
|
|
131
|
+
* - `POST /checkout/v2/transactions/{id}` (v2/OAuth2) → 405 Method Not Allowed.
|
|
132
|
+
* - `POST /api/transactions/{id}` (legacy/Basic) → 200 with PascalCase response.
|
|
133
|
+
*
|
|
134
|
+
* @see references/viva-docs/md/tut-create-recurring-payment.txt:288
|
|
135
|
+
*/
|
|
136
|
+
export declare const LEGACY_HOST: Record<VivaEnvironment, string>;
|
|
137
|
+
/**
|
|
138
|
+
* Generic page-based pagination wrapper used by data-service list endpoints.
|
|
139
|
+
*
|
|
140
|
+
* @see references/viva-docs/md/account-api.txt:1069
|
|
141
|
+
*/
|
|
142
|
+
export interface PaginatedResponse<T> {
|
|
143
|
+
readonly currentPage: number;
|
|
144
|
+
readonly pageSize: number;
|
|
145
|
+
readonly totalPages: number;
|
|
146
|
+
readonly totalDataCount: number;
|
|
147
|
+
readonly data: readonly T[];
|
|
148
|
+
readonly links: PaginationLinks;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Navigation links returned alongside paginated results.
|
|
152
|
+
*
|
|
153
|
+
* @see references/viva-docs/md/account-api.txt:1183
|
|
154
|
+
*/
|
|
155
|
+
export interface PaginationLinks {
|
|
156
|
+
readonly self: string;
|
|
157
|
+
readonly next?: string;
|
|
158
|
+
readonly previous?: string;
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC;AAEzE;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAEzD;AAED;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;CAYsB,CAAC;AAMlD;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,sCAAsC;IACtC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;CACjC;AAMD;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;CAAE,CAAC;AAErE;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAErF;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAA;CAAE,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAM/B;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,YAAY,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,eAAe,EAAE,mBAAmB,CAShE,CAAC;AAEX;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAG9C,CAAC;AAMX;;;;GAIG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common primitives shared across the Viva Wallet ISV API surface.
|
|
3
|
+
*
|
|
4
|
+
* Covers: currency branding, money representation, ID aliases,
|
|
5
|
+
* environment enumeration, and pagination helpers.
|
|
6
|
+
*
|
|
7
|
+
* @see references/viva-docs/md/wh-transaction-payment-created.txt:487
|
|
8
|
+
* @see references/viva-docs/md/webhooks-for-payments.txt:383
|
|
9
|
+
* @see references/viva-docs/md/oauth2-authentication.txt:145
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Narrow cast helper — call when you have a validated ISO 4217 numeric string.
|
|
13
|
+
* Runtime validation lives in the implementation layer (S2/S6).
|
|
14
|
+
*/
|
|
15
|
+
export function asCurrencyCode(code) {
|
|
16
|
+
return code;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Commonly used ISO 4217 numeric currency codes.
|
|
20
|
+
* The map provides ergonomic named constants; the type accepts any 3-digit
|
|
21
|
+
* numeric string so the list is non-exhaustive.
|
|
22
|
+
*
|
|
23
|
+
* @see references/viva-docs/md/wh-transaction-payment-created.txt:487
|
|
24
|
+
*/
|
|
25
|
+
export const CURRENCY_CODES = {
|
|
26
|
+
EUR: asCurrencyCode('978'),
|
|
27
|
+
GBP: asCurrencyCode('826'),
|
|
28
|
+
USD: asCurrencyCode('840'),
|
|
29
|
+
PLN: asCurrencyCode('985'),
|
|
30
|
+
RON: asCurrencyCode('946'),
|
|
31
|
+
CZK: asCurrencyCode('203'),
|
|
32
|
+
HUF: asCurrencyCode('348'),
|
|
33
|
+
BGN: asCurrencyCode('975'),
|
|
34
|
+
DKK: asCurrencyCode('208'),
|
|
35
|
+
SEK: asCurrencyCode('752'),
|
|
36
|
+
NOK: asCurrencyCode('578'),
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Well-known base URLs keyed by environment.
|
|
40
|
+
*
|
|
41
|
+
* @see references/viva-docs/md/oauth2-authentication.txt:145
|
|
42
|
+
*/
|
|
43
|
+
export const ENVIRONMENT_URLS = {
|
|
44
|
+
demo: {
|
|
45
|
+
authBaseUrl: 'https://demo-accounts.vivapayments.com',
|
|
46
|
+
apiBaseUrl: 'https://demo-api.vivapayments.com',
|
|
47
|
+
},
|
|
48
|
+
production: {
|
|
49
|
+
authBaseUrl: 'https://accounts.vivapayments.com',
|
|
50
|
+
apiBaseUrl: 'https://api.vivapayments.com',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Legacy host base URLs (Basic auth endpoints).
|
|
55
|
+
*
|
|
56
|
+
* The Viva legacy API lives on `demo.vivapayments.com` / `www.vivapayments.com`.
|
|
57
|
+
* These hosts are used for endpoints that Viva has NOT migrated to the v2/OAuth2
|
|
58
|
+
* surface — specifically `POST /api/transactions/{transactionId}` (refund/cancel-transaction).
|
|
59
|
+
*
|
|
60
|
+
* Verified against Viva sandbox 2026-04-25 (probe scripts):
|
|
61
|
+
* - `POST /checkout/v2/transactions/{id}` (v2/OAuth2) → 405 Method Not Allowed.
|
|
62
|
+
* - `POST /api/transactions/{id}` (legacy/Basic) → 200 with PascalCase response.
|
|
63
|
+
*
|
|
64
|
+
* @see references/viva-docs/md/tut-create-recurring-payment.txt:288
|
|
65
|
+
*/
|
|
66
|
+
export const LEGACY_HOST = {
|
|
67
|
+
demo: 'https://demo.vivapayments.com',
|
|
68
|
+
production: 'https://www.vivapayments.com',
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAgBH;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,IAAoB,CAAC;AAC9B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC;IAC1B,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC;IAC1B,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC;IAC1B,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC;IAC1B,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC;IAC1B,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC;IAC1B,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC;IAC1B,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC;IAC1B,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC;IAC1B,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC;IAC1B,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC;CACqB,CAAC;AAsFlD;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAiD;IAC5E,IAAI,EAAE;QACJ,WAAW,EAAE,wCAAwC;QACrD,UAAU,EAAE,mCAAmC;KAChD;IACD,UAAU,EAAE;QACV,WAAW,EAAE,mCAAmC;QAChD,UAAU,EAAE,8BAA8B;KAC3C;CACO,CAAC;AAEX;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,WAAW,GAAoC;IAC1D,IAAI,EAAE,+BAA+B;IACrC,UAAU,EAAE,8BAA8B;CAClC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* viva-payments-core/types — barrel re-export.
|
|
3
|
+
*
|
|
4
|
+
* Subpath: `viva-payments-core/types`
|
|
5
|
+
*
|
|
6
|
+
* Re-exports all types consumed by S2 (auth), S3 (isv), S4 (webhooks),
|
|
7
|
+
* and S6/S8 (medusa adapter).
|
|
8
|
+
*
|
|
9
|
+
* Attribution: types hand-rolled fresh. Structure partially referenced from
|
|
10
|
+
* @nkhind/vivawallet-sdk for API surface awareness — no code copied.
|
|
11
|
+
*/
|
|
12
|
+
export type { CurrencyCode, MinorUnits, Money, MerchantId, ConnectedAccountId, TransactionId, OrderCode, VivaEnvironment, VivaEnvironmentUrls, PaginatedResponse, PaginationLinks, } from './common.js';
|
|
13
|
+
export { asCurrencyCode, CURRENCY_CODES, ENVIRONMENT_URLS, LEGACY_HOST, } from './common.js';
|
|
14
|
+
export type { OAuth2TokenResponse, CachedToken, ResellerBasicAuthCredentials, AuthStrategy, } from './auth.js';
|
|
15
|
+
export type { CreateOrderRequest, CreateOrderResponse, RetrieveTransactionResponse, RefundRequest, RefundResponse, CancelOrderResponse, } from './isv-payments.js';
|
|
16
|
+
export { CARD_TYPE_BY_ID, resolveCardType, } from './card-types.js';
|
|
17
|
+
export type { CreateConnectedAccountRequest, CreateConnectedAccountResponse, GetConnectedAccountResponse, RegisterWebhookRequest, RetrieveWebhookKeyResponse, } from './isv-accounts.js';
|
|
18
|
+
export type { VivaStatusLetter, VivaTransactionStatus, VivaClaimSubstate, StatusLetterToTransactionStatus, ClaimStatusLetter, TerminalVivaTransactionStatus, NonTerminalVivaTransactionStatus, StatusTransition, StatusTransitionResult, } from './status.js';
|
|
19
|
+
export type { WebhookEnvelope, VivaEventTypeId, TransactionEventData, TransactionPaymentCreatedEventData, TransactionReversalCreatedEventData, TransactionFailedEventData, OrderUpdatedEventData, AccountConnectedEventData, AccountVerificationStatusChangedEventData, VivaWebhookEnvelope, } from './webhook-events.js';
|
|
20
|
+
export { EVENT_TYPES, DEFERRED_EVENT_TYPES, } from './webhook-events.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,YAAY,EAEV,YAAY,EACZ,UAAU,EACV,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EAEL,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,WAAW,GACZ,MAAM,aAAa,CAAC;AAErB,YAAY,EAEV,mBAAmB,EACnB,WAAW,EACX,4BAA4B,EAC5B,YAAY,GACb,MAAM,WAAW,CAAC;AAEnB,YAAY,EAEV,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,aAAa,EACb,cAAc,EACd,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAEL,eAAe,EACf,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAEV,6BAA6B,EAC7B,8BAA8B,EAC9B,2BAA2B,EAC3B,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EAEV,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,+BAA+B,EAC/B,iBAAiB,EACjB,6BAA6B,EAC7B,gCAAgC,EAChC,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAErB,YAAY,EAEV,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,kCAAkC,EAClC,mCAAmC,EACnC,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,EACzB,yCAAyC,EACzC,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAEL,WAAW,EACX,oBAAoB,GACrB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* viva-payments-core/types — barrel re-export.
|
|
3
|
+
*
|
|
4
|
+
* Subpath: `viva-payments-core/types`
|
|
5
|
+
*
|
|
6
|
+
* Re-exports all types consumed by S2 (auth), S3 (isv), S4 (webhooks),
|
|
7
|
+
* and S6/S8 (medusa adapter).
|
|
8
|
+
*
|
|
9
|
+
* Attribution: types hand-rolled fresh. Structure partially referenced from
|
|
10
|
+
* @nkhind/vivawallet-sdk for API surface awareness — no code copied.
|
|
11
|
+
*/
|
|
12
|
+
export {
|
|
13
|
+
// common.ts — runtime values
|
|
14
|
+
asCurrencyCode, CURRENCY_CODES, ENVIRONMENT_URLS, LEGACY_HOST, } from './common.js';
|
|
15
|
+
export {
|
|
16
|
+
// card-types.ts — runtime values
|
|
17
|
+
CARD_TYPE_BY_ID, resolveCardType, } from './card-types.js';
|
|
18
|
+
export {
|
|
19
|
+
// webhook-events.ts — runtime values
|
|
20
|
+
EVENT_TYPES, DEFERRED_EVENT_TYPES, } from './webhook-events.js';
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAiBH,OAAO;AACL,6BAA6B;AAC7B,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,WAAW,GACZ,MAAM,aAAa,CAAC;AAoBrB,OAAO;AACL,iCAAiC;AACjC,eAAe,EACf,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAsCzB,OAAO;AACL,qCAAqC;AACrC,WAAW,EACX,oBAAoB,GACrB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ISV Connected Account + Webhook Registration types.
|
|
3
|
+
*
|
|
4
|
+
* Probe-verified 2026-05-11 against `docs/payment-isv-api.yaml`. All shapes
|
|
5
|
+
* below match the live demo response observed at `demo-api.vivapayments.com`.
|
|
6
|
+
*
|
|
7
|
+
* Endpoints (all Bearer auth, OAuth2 scopes
|
|
8
|
+
* `urn:viva:payments:core:api:isv urn:viva:payments:core:api:redirectcheckout`):
|
|
9
|
+
*
|
|
10
|
+
* - POST /isv/v1/accounts — create connected account
|
|
11
|
+
* - GET /isv/v1/accounts/{accountId} — retrieve connected account
|
|
12
|
+
* - POST /isv/v1/webhooks — register webhook (204 No Content)
|
|
13
|
+
* - GET /isv/v1/webhooks/token — generate verification key
|
|
14
|
+
*
|
|
15
|
+
* Endpoints NOT in the ISV spec (intentionally absent from this module):
|
|
16
|
+
*
|
|
17
|
+
* - List webhooks (not exposed; CLI must rely on POST idempotency)
|
|
18
|
+
* - Update/Delete webhook (not exposed; manage via banking UI)
|
|
19
|
+
* - Update connected account (not exposed for ISV; merchant edits via UI)
|
|
20
|
+
*/
|
|
21
|
+
import type { ConnectedAccountId } from './common.js';
|
|
22
|
+
/**
|
|
23
|
+
* Request body for `POST /isv/v1/accounts`.
|
|
24
|
+
*
|
|
25
|
+
* Probe-verified shape. The ISV API does NOT accept `countryCode`, `firstName`,
|
|
26
|
+
* `lastName`, `currency`, `sendOnboardingEmail`, or `merchantType` — Viva
|
|
27
|
+
* collects all of those from the merchant during KYC via the invitation URL.
|
|
28
|
+
*/
|
|
29
|
+
export interface CreateConnectedAccountRequest {
|
|
30
|
+
/** Merchant email address; the invitation link is sent here. */
|
|
31
|
+
readonly email: string;
|
|
32
|
+
/** URL the merchant returns to after completing the Viva-hosted onboarding flow. */
|
|
33
|
+
readonly returnUrl: string;
|
|
34
|
+
/**
|
|
35
|
+
* Optional ISV branding shown on Viva's onboarding pages.
|
|
36
|
+
* `partnerName` and `logoUrl` are required when `branding` is present.
|
|
37
|
+
*/
|
|
38
|
+
readonly branding?: {
|
|
39
|
+
readonly partnerName: string;
|
|
40
|
+
readonly logoUrl: string;
|
|
41
|
+
/** Hex code, e.g. `#1F2439`. */
|
|
42
|
+
readonly primaryColor?: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Response from `POST /isv/v1/accounts` (HTTP 200).
|
|
47
|
+
*
|
|
48
|
+
* Probe-verified shape. The onboarding URL lives at `invitation.redirectUrl`
|
|
49
|
+
* — not at a top-level `redirectUrl` field.
|
|
50
|
+
*/
|
|
51
|
+
export interface CreateConnectedAccountResponse {
|
|
52
|
+
readonly accountId: ConnectedAccountId;
|
|
53
|
+
readonly invitation: {
|
|
54
|
+
readonly email: string;
|
|
55
|
+
/** Viva-hosted onboarding URL. Only functional in production. */
|
|
56
|
+
readonly redirectUrl: string;
|
|
57
|
+
/** ISO 8601 timestamp. */
|
|
58
|
+
readonly created: string;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Response from `GET /isv/v1/accounts/{accountId}` (HTTP 200).
|
|
63
|
+
*
|
|
64
|
+
* Probe-verified shape. All scalar fields are nullable when the account has
|
|
65
|
+
* not been verified — `merchantId` is the field consumers care about most;
|
|
66
|
+
* it remains `null` until `verified === true`.
|
|
67
|
+
*/
|
|
68
|
+
export interface GetConnectedAccountResponse {
|
|
69
|
+
readonly accountId: ConnectedAccountId;
|
|
70
|
+
/** Populated only after KYC is complete. Use as `merchantId` query param on createOrder. */
|
|
71
|
+
readonly merchantId: string | null;
|
|
72
|
+
readonly email: string | null;
|
|
73
|
+
/** `true` once Viva has verified the merchant via KYC/KYB. */
|
|
74
|
+
readonly verified: boolean;
|
|
75
|
+
/** `true` when the merchant can accept card payments. Maps to `vivaPayoutsEnabled` locally. */
|
|
76
|
+
readonly acquiringEnabled: boolean;
|
|
77
|
+
readonly created: string | null;
|
|
78
|
+
readonly taxNumber: string | null;
|
|
79
|
+
readonly vatNumber: string | null;
|
|
80
|
+
readonly legalName: string | null;
|
|
81
|
+
readonly registrationNumber: string | null;
|
|
82
|
+
readonly invitation: {
|
|
83
|
+
readonly email: string | null;
|
|
84
|
+
readonly redirectUrl: string | null;
|
|
85
|
+
readonly created: string | null;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Request body for `POST /isv/v1/webhooks`.
|
|
90
|
+
*
|
|
91
|
+
* Probe-verified shape. The spec does NOT include `isActive` — the API has no
|
|
92
|
+
* concept of inactive webhook registrations.
|
|
93
|
+
*/
|
|
94
|
+
export interface RegisterWebhookRequest {
|
|
95
|
+
/** Numeric Viva EventTypeId (e.g. 1796 = Transaction Payment Created). */
|
|
96
|
+
readonly eventTypeId: number;
|
|
97
|
+
/** HTTPS URL that will receive webhook POST notifications. */
|
|
98
|
+
readonly url: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Response from `GET /isv/v1/webhooks/token` (HTTP 200).
|
|
102
|
+
*
|
|
103
|
+
* The returned `key` must be echoed in the URL-verify GET handshake on the
|
|
104
|
+
* webhook endpoint so Viva can confirm ownership.
|
|
105
|
+
*/
|
|
106
|
+
export interface RetrieveWebhookKeyResponse {
|
|
107
|
+
readonly key: string;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=isv-accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isv-accounts.d.ts","sourceRoot":"","sources":["../../src/types/isv-accounts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAMtD;;;;;;GAMG;AACH,MAAM,WAAW,6BAA6B;IAC5C,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,oFAAoF;IACpF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAClB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,gCAAgC;QAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;KAChC,CAAC;CACH;AAED;;;;;GAKG;AACH,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,UAAU,EAAE;QACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,iEAAiE;QACjE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,0BAA0B;QAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAMD;;;;;;GAMG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,4FAA4F;IAC5F,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,+FAA+F;IAC/F,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE;QACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;KACjC,CAAC;CACH;AAMD;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ISV Connected Account + Webhook Registration types.
|
|
3
|
+
*
|
|
4
|
+
* Probe-verified 2026-05-11 against `docs/payment-isv-api.yaml`. All shapes
|
|
5
|
+
* below match the live demo response observed at `demo-api.vivapayments.com`.
|
|
6
|
+
*
|
|
7
|
+
* Endpoints (all Bearer auth, OAuth2 scopes
|
|
8
|
+
* `urn:viva:payments:core:api:isv urn:viva:payments:core:api:redirectcheckout`):
|
|
9
|
+
*
|
|
10
|
+
* - POST /isv/v1/accounts — create connected account
|
|
11
|
+
* - GET /isv/v1/accounts/{accountId} — retrieve connected account
|
|
12
|
+
* - POST /isv/v1/webhooks — register webhook (204 No Content)
|
|
13
|
+
* - GET /isv/v1/webhooks/token — generate verification key
|
|
14
|
+
*
|
|
15
|
+
* Endpoints NOT in the ISV spec (intentionally absent from this module):
|
|
16
|
+
*
|
|
17
|
+
* - List webhooks (not exposed; CLI must rely on POST idempotency)
|
|
18
|
+
* - Update/Delete webhook (not exposed; manage via banking UI)
|
|
19
|
+
* - Update connected account (not exposed for ISV; merchant edits via UI)
|
|
20
|
+
*/
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=isv-accounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isv-accounts.js","sourceRoot":"","sources":["../../src/types/isv-accounts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}
|