@momorail/mock 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Momorail contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,36 @@
1
+ import { TransactionStatus, PaymentProvider, CollectionInput, DisbursementInput, ProviderCapabilities, ProviderCallOptions, Transaction, TransactionRef, RawWebhook, WebhookEvent } from '@momorail/core';
2
+
3
+ /**
4
+ * Outcome the mock should apply to a new transaction. A bare status settles
5
+ * immediately (`'succeeded'` / `'failed'` / …); `{ settleAfterPolls, finalStatus }`
6
+ * keeps the transaction `pending` until it has been fetched that many times.
7
+ */
8
+ type MockOutcome = TransactionStatus | {
9
+ settleAfterPolls: number;
10
+ finalStatus: Extract<TransactionStatus, 'succeeded' | 'failed' | 'expired'>;
11
+ };
12
+ interface MockProviderOptions {
13
+ /** When false, every call rejects with {@link AuthError}. Default true. */
14
+ apiKeyValid?: boolean;
15
+ /** Decide the lifecycle of each new transaction from its input. Default: `'succeeded'`. */
16
+ outcome?: (input: CollectionInput | DisbursementInput) => MockOutcome;
17
+ /** Clock seam for deterministic timestamps. Default `Date.now`. */
18
+ now?: () => number;
19
+ /** Secret used to sign generated webhook bodies. Default `'mock-secret'`. */
20
+ webhookSecret?: string;
21
+ }
22
+ /** A fully in-memory {@link PaymentProvider}. Deterministic, no network, safe to spin up per test. */
23
+ declare class MockProvider implements PaymentProvider {
24
+ #private;
25
+ readonly id = "mock";
26
+ constructor(options?: MockProviderOptions);
27
+ capabilities(): ProviderCapabilities;
28
+ collection(input: CollectionInput, _options?: ProviderCallOptions): Promise<Transaction>;
29
+ disbursement(input: DisbursementInput, _options?: ProviderCallOptions): Promise<Transaction>;
30
+ getTransaction(ref: TransactionRef, _options?: ProviderCallOptions): Promise<Transaction>;
31
+ parseWebhook(raw: RawWebhook): Promise<WebhookEvent>;
32
+ /** Test helper: build a signed webhook body for a stored transaction's current state. */
33
+ buildWebhook(transactionId: string): RawWebhook;
34
+ }
35
+
36
+ export { type MockOutcome, MockProvider, type MockProviderOptions };
package/dist/index.js ADDED
@@ -0,0 +1,174 @@
1
+ // src/index.ts
2
+ import {
3
+ AuthError,
4
+ TransactionNotFoundError,
5
+ ValidationError,
6
+ isOperator,
7
+ webhookEventTypeForStatus
8
+ } from "@momorail/core";
9
+ var CAPABILITIES = {
10
+ collection: true,
11
+ disbursement: true,
12
+ lookupByReference: true,
13
+ hostedCheckout: false,
14
+ operators: ["orange_ml", "moov_ml", "wave_ml", "orange_ci", "mtn_ci", "wave_ci"],
15
+ currencies: ["XOF"]
16
+ };
17
+ var MockProvider = class {
18
+ id = "mock";
19
+ #apiKeyValid;
20
+ #outcome;
21
+ #now;
22
+ #webhookSecret;
23
+ #byId = /* @__PURE__ */ new Map();
24
+ #idByReference = /* @__PURE__ */ new Map();
25
+ #seq = 0;
26
+ constructor(options = {}) {
27
+ this.#apiKeyValid = options.apiKeyValid ?? true;
28
+ this.#outcome = options.outcome;
29
+ this.#now = options.now ?? Date.now;
30
+ this.#webhookSecret = options.webhookSecret ?? "mock-secret";
31
+ }
32
+ capabilities() {
33
+ return CAPABILITIES;
34
+ }
35
+ async collection(input, _options) {
36
+ return this.#create("collection", input, input.customer);
37
+ }
38
+ async disbursement(input, _options) {
39
+ return this.#create("disbursement", input, input.recipient);
40
+ }
41
+ async getTransaction(ref, _options) {
42
+ this.#assertAuth();
43
+ const stored = this.#resolve(ref);
44
+ if (!stored) {
45
+ throw new TransactionNotFoundError("No mock transaction for the given ref", {
46
+ provider: this.id
47
+ });
48
+ }
49
+ return this.#advance(stored);
50
+ }
51
+ async parseWebhook(raw) {
52
+ const payload = typeof raw.body === "string" ? JSON.parse(raw.body) : raw.body instanceof Uint8Array ? JSON.parse(new TextDecoder().decode(raw.body)) : raw.body;
53
+ const id = typeof payload.id === "string" ? payload.id : void 0;
54
+ const stored = id ? this.#byId.get(id) : void 0;
55
+ if (!stored) {
56
+ throw new ValidationError("Unknown transaction in webhook payload", { provider: this.id });
57
+ }
58
+ const snapshot = this.#snapshot(stored);
59
+ return {
60
+ type: webhookEventTypeForStatus(snapshot.status),
61
+ transaction: snapshot,
62
+ providerRaw: payload
63
+ };
64
+ }
65
+ /** Test helper: build a signed webhook body for a stored transaction's current state. */
66
+ buildWebhook(transactionId) {
67
+ const stored = this.#byId.get(transactionId);
68
+ if (!stored) throw new ValidationError("Unknown transaction id");
69
+ const body = JSON.stringify({
70
+ id: stored.id,
71
+ reference: stored.reference,
72
+ status: stored.status
73
+ });
74
+ return {
75
+ headers: {
76
+ "content-type": "application/json",
77
+ "x-mock-signature": sign(body, this.#webhookSecret)
78
+ },
79
+ body
80
+ };
81
+ }
82
+ #create(type, input, party) {
83
+ this.#assertAuth();
84
+ if (party.operator !== void 0 && !isOperator(party.operator)) {
85
+ throw new ValidationError(`Unknown operator: ${party.operator}`, { provider: this.id });
86
+ }
87
+ const existingId = this.#idByReference.get(input.reference);
88
+ if (existingId) {
89
+ const existing = this.#byId.get(existingId);
90
+ if (existing) return this.#snapshot(existing);
91
+ }
92
+ const outcome = this.#outcome?.(input) ?? "succeeded";
93
+ const { pollsRemaining, settleTo, initialStatus } = normaliseOutcome(outcome);
94
+ const ts = new Date(this.#now()).toISOString();
95
+ const id = `mock_${++this.#seq}`;
96
+ const stored = {
97
+ provider: this.id,
98
+ id,
99
+ reference: input.reference,
100
+ type,
101
+ status: initialStatus,
102
+ amount: input.amount,
103
+ operator: party.operator,
104
+ customer: party,
105
+ providerRaw: { engine: "mock", outcome },
106
+ createdAt: ts,
107
+ updatedAt: ts,
108
+ _pollsRemaining: pollsRemaining,
109
+ _settleTo: settleTo
110
+ };
111
+ if (initialStatus === "failed") stored.failureReason = "provider_error";
112
+ this.#byId.set(id, stored);
113
+ this.#idByReference.set(input.reference, id);
114
+ return this.#snapshot(stored);
115
+ }
116
+ #advance(stored) {
117
+ if (stored.status === "pending" || stored.status === "processing") {
118
+ if (stored._pollsRemaining > 0) {
119
+ stored._pollsRemaining -= 1;
120
+ stored.status = "processing";
121
+ }
122
+ if (stored._pollsRemaining <= 0) {
123
+ stored.status = stored._settleTo;
124
+ if (stored.status === "failed") stored.failureReason = "provider_error";
125
+ }
126
+ stored.updatedAt = new Date(this.#now()).toISOString();
127
+ }
128
+ return this.#snapshot(stored);
129
+ }
130
+ #resolve(ref) {
131
+ if (ref.id) return this.#byId.get(ref.id);
132
+ if (ref.reference) {
133
+ const id = this.#idByReference.get(ref.reference);
134
+ return id ? this.#byId.get(id) : void 0;
135
+ }
136
+ return void 0;
137
+ }
138
+ #snapshot(stored) {
139
+ const { _pollsRemaining, _settleTo, ...rest } = stored;
140
+ return structuredClone(rest);
141
+ }
142
+ #assertAuth() {
143
+ if (!this.#apiKeyValid) {
144
+ throw new AuthError("Mock API key rejected", { provider: this.id });
145
+ }
146
+ }
147
+ };
148
+ function normaliseOutcome(outcome) {
149
+ if (typeof outcome === "string") {
150
+ const pendingish = outcome === "pending" || outcome === "processing";
151
+ return {
152
+ pollsRemaining: pendingish ? Number.POSITIVE_INFINITY : 0,
153
+ settleTo: outcome,
154
+ initialStatus: outcome
155
+ };
156
+ }
157
+ return {
158
+ pollsRemaining: Math.max(0, outcome.settleAfterPolls),
159
+ settleTo: outcome.finalStatus,
160
+ initialStatus: outcome.settleAfterPolls <= 0 ? outcome.finalStatus : "pending"
161
+ };
162
+ }
163
+ function sign(body, secret) {
164
+ let hash = 0;
165
+ const input = `${secret}.${body}`;
166
+ for (let i = 0; i < input.length; i++) {
167
+ hash = Math.imul(31, hash) + input.charCodeAt(i) | 0;
168
+ }
169
+ return `mock_${(hash >>> 0).toString(16)}`;
170
+ }
171
+ export {
172
+ MockProvider
173
+ };
174
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n AuthError,\n type CollectionInput,\n type DisbursementInput,\n type Party,\n type PaymentProvider,\n type ProviderCallOptions,\n type ProviderCapabilities,\n type RawWebhook,\n type Transaction,\n TransactionNotFoundError,\n type TransactionRef,\n type TransactionStatus,\n ValidationError,\n type WebhookEvent,\n isOperator,\n webhookEventTypeForStatus,\n} from '@momorail/core';\n\n/**\n * Outcome the mock should apply to a new transaction. A bare status settles\n * immediately (`'succeeded'` / `'failed'` / …); `{ settleAfterPolls, finalStatus }`\n * keeps the transaction `pending` until it has been fetched that many times.\n */\nexport type MockOutcome =\n | TransactionStatus\n | {\n settleAfterPolls: number;\n finalStatus: Extract<TransactionStatus, 'succeeded' | 'failed' | 'expired'>;\n };\n\nexport interface MockProviderOptions {\n /** When false, every call rejects with {@link AuthError}. Default true. */\n apiKeyValid?: boolean;\n /** Decide the lifecycle of each new transaction from its input. Default: `'succeeded'`. */\n outcome?: (input: CollectionInput | DisbursementInput) => MockOutcome;\n /** Clock seam for deterministic timestamps. Default `Date.now`. */\n now?: () => number;\n /** Secret used to sign generated webhook bodies. Default `'mock-secret'`. */\n webhookSecret?: string;\n}\n\ninterface StoredTransaction extends Transaction {\n _pollsRemaining: number;\n _settleTo: TransactionStatus;\n}\n\nconst CAPABILITIES: ProviderCapabilities = {\n collection: true,\n disbursement: true,\n lookupByReference: true,\n hostedCheckout: false,\n operators: ['orange_ml', 'moov_ml', 'wave_ml', 'orange_ci', 'mtn_ci', 'wave_ci'],\n currencies: ['XOF'],\n};\n\n/** A fully in-memory {@link PaymentProvider}. Deterministic, no network, safe to spin up per test. */\nexport class MockProvider implements PaymentProvider {\n readonly id = 'mock';\n\n readonly #apiKeyValid: boolean;\n readonly #outcome: MockProviderOptions['outcome'];\n readonly #now: () => number;\n readonly #webhookSecret: string;\n\n readonly #byId = new Map<string, StoredTransaction>();\n readonly #idByReference = new Map<string, string>();\n #seq = 0;\n\n constructor(options: MockProviderOptions = {}) {\n this.#apiKeyValid = options.apiKeyValid ?? true;\n this.#outcome = options.outcome;\n this.#now = options.now ?? Date.now;\n this.#webhookSecret = options.webhookSecret ?? 'mock-secret';\n }\n\n capabilities(): ProviderCapabilities {\n return CAPABILITIES;\n }\n\n async collection(input: CollectionInput, _options?: ProviderCallOptions): Promise<Transaction> {\n return this.#create('collection', input, input.customer);\n }\n\n async disbursement(\n input: DisbursementInput,\n _options?: ProviderCallOptions,\n ): Promise<Transaction> {\n return this.#create('disbursement', input, input.recipient);\n }\n\n async getTransaction(ref: TransactionRef, _options?: ProviderCallOptions): Promise<Transaction> {\n this.#assertAuth();\n const stored = this.#resolve(ref);\n if (!stored) {\n throw new TransactionNotFoundError('No mock transaction for the given ref', {\n provider: this.id,\n });\n }\n return this.#advance(stored);\n }\n\n async parseWebhook(raw: RawWebhook): Promise<WebhookEvent> {\n const payload =\n typeof raw.body === 'string'\n ? (JSON.parse(raw.body) as Record<string, unknown>)\n : raw.body instanceof Uint8Array\n ? (JSON.parse(new TextDecoder().decode(raw.body)) as Record<string, unknown>)\n : raw.body;\n\n const id = typeof payload.id === 'string' ? payload.id : undefined;\n const stored = id ? this.#byId.get(id) : undefined;\n if (!stored) {\n throw new ValidationError('Unknown transaction in webhook payload', { provider: this.id });\n }\n const snapshot = this.#snapshot(stored);\n return {\n type: webhookEventTypeForStatus(snapshot.status),\n transaction: snapshot,\n providerRaw: payload,\n };\n }\n\n /** Test helper: build a signed webhook body for a stored transaction's current state. */\n buildWebhook(transactionId: string): RawWebhook {\n const stored = this.#byId.get(transactionId);\n if (!stored) throw new ValidationError('Unknown transaction id');\n const body = JSON.stringify({\n id: stored.id,\n reference: stored.reference,\n status: stored.status,\n });\n return {\n headers: {\n 'content-type': 'application/json',\n 'x-mock-signature': sign(body, this.#webhookSecret),\n },\n body,\n };\n }\n\n #create(\n type: 'collection' | 'disbursement',\n input: CollectionInput | DisbursementInput,\n party: Party,\n ): Transaction {\n this.#assertAuth();\n if (party.operator !== undefined && !isOperator(party.operator)) {\n throw new ValidationError(`Unknown operator: ${party.operator}`, { provider: this.id });\n }\n\n const existingId = this.#idByReference.get(input.reference);\n if (existingId) {\n const existing = this.#byId.get(existingId);\n if (existing) return this.#snapshot(existing);\n }\n\n const outcome = this.#outcome?.(input) ?? 'succeeded';\n const { pollsRemaining, settleTo, initialStatus } = normaliseOutcome(outcome);\n const ts = new Date(this.#now()).toISOString();\n const id = `mock_${++this.#seq}`;\n\n const stored: StoredTransaction = {\n provider: this.id,\n id,\n reference: input.reference,\n type,\n status: initialStatus,\n amount: input.amount,\n operator: party.operator,\n customer: party,\n providerRaw: { engine: 'mock', outcome },\n createdAt: ts,\n updatedAt: ts,\n _pollsRemaining: pollsRemaining,\n _settleTo: settleTo,\n };\n if (initialStatus === 'failed') stored.failureReason = 'provider_error';\n\n this.#byId.set(id, stored);\n this.#idByReference.set(input.reference, id);\n return this.#snapshot(stored);\n }\n\n #advance(stored: StoredTransaction): Transaction {\n if (stored.status === 'pending' || stored.status === 'processing') {\n if (stored._pollsRemaining > 0) {\n stored._pollsRemaining -= 1;\n stored.status = 'processing';\n }\n if (stored._pollsRemaining <= 0) {\n stored.status = stored._settleTo;\n if (stored.status === 'failed') stored.failureReason = 'provider_error';\n }\n stored.updatedAt = new Date(this.#now()).toISOString();\n }\n return this.#snapshot(stored);\n }\n\n #resolve(ref: TransactionRef): StoredTransaction | undefined {\n if (ref.id) return this.#byId.get(ref.id);\n if (ref.reference) {\n const id = this.#idByReference.get(ref.reference);\n return id ? this.#byId.get(id) : undefined;\n }\n return undefined;\n }\n\n #snapshot(stored: StoredTransaction): Transaction {\n const { _pollsRemaining, _settleTo, ...rest } = stored;\n return structuredClone(rest);\n }\n\n #assertAuth(): void {\n if (!this.#apiKeyValid) {\n throw new AuthError('Mock API key rejected', { provider: this.id });\n }\n }\n}\n\nfunction normaliseOutcome(outcome: MockOutcome): {\n pollsRemaining: number;\n settleTo: TransactionStatus;\n initialStatus: TransactionStatus;\n} {\n if (typeof outcome === 'string') {\n const pendingish = outcome === 'pending' || outcome === 'processing';\n return {\n pollsRemaining: pendingish ? Number.POSITIVE_INFINITY : 0,\n settleTo: outcome,\n initialStatus: outcome,\n };\n }\n return {\n pollsRemaining: Math.max(0, outcome.settleAfterPolls),\n settleTo: outcome.finalStatus,\n initialStatus: outcome.settleAfterPolls <= 0 ? outcome.finalStatus : 'pending',\n };\n}\n\n/** Deterministic, non-cryptographic digest — the mock only needs repeatability. */\nfunction sign(body: string, secret: string): string {\n let hash = 0;\n const input = `${secret}.${body}`;\n for (let i = 0; i < input.length; i++) {\n hash = (Math.imul(31, hash) + input.charCodeAt(i)) | 0;\n }\n return `mock_${(hash >>> 0).toString(16)}`;\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EASA;AAAA,EAGA;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AA8BP,IAAM,eAAqC;AAAA,EACzC,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,WAAW,CAAC,aAAa,WAAW,WAAW,aAAa,UA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BAAyB,EAAE,UAAU,KAAK,GAAG,CAAC;AAAA,IACpE;AAAA,EACF;AACF;AAEA,SAAS,iBAAiB,SAIxB;AACA,MAAI,OAAO,YAAY,UAAU;AAC/B,UAAM,aAAa,YAAY,aAAa,YAAY;AACxD,WAAO;AAAA,MACL,gBAAgB,aAAa,OAAO,oBAAoB;AAAA,MACxD,UAAU;AAAA,MACV,eAAe;AAAA,IACjB;AAAA,EACF;AACA,SAAO;AAAA,IACL,gBAAgB,KAAK,IAAI,GAAG,QAAQ,gBAAgB;AAAA,IACpD,UAAU,QAAQ;AAAA,IAClB,eAAe,QAAQ,oBAAoB,IAAI,QAAQ,cAAc;AAAA,EACvE;AACF;AAGA,SAAS,KAAK,MAAc,QAAwB;AAClD,MAAI,OAAO;AACX,QAAM,QAAQ,GAAG,MAAM,IAAI,IAAI;AAC/B,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,WAAQ,KAAK,KAAK,IAAI,IAAI,IAAI,MAAM,WAAW,CAAC,IAAK;AAAA,EACvD;AACA,SAAO,SAAS,SAAS,GAAG,SAAS,EAAE,CAAC;AAC1C;","names":[]}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@momorail/mock",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "In-memory mock aggregator adapter for local development and tests",
6
+ "keywords": [
7
+ "mobile-money",
8
+ "payments",
9
+ "west-africa",
10
+ "africa",
11
+ "orange-money",
12
+ "mtn-momo",
13
+ "wave",
14
+ "xof",
15
+ "byo-keys",
16
+ "typescript",
17
+ "mock"
18
+ ],
19
+ "license": "MIT",
20
+ "author": "Boukymen <boukymen@gmail.com>",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/Boukymen/momorail.git",
24
+ "directory": "packages/mock"
25
+ },
26
+ "homepage": "https://github.com/Boukymen/momorail/tree/main/packages/mock#readme",
27
+ "bugs": "https://github.com/Boukymen/momorail/issues",
28
+ "main": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js"
34
+ }
35
+ },
36
+ "files": [
37
+ "dist"
38
+ ],
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "dependencies": {
43
+ "@momorail/core": "0.1.0"
44
+ },
45
+ "devDependencies": {
46
+ "tsup": "^8.3.5",
47
+ "typescript": "^5.7.2",
48
+ "vitest": "^2.1.8",
49
+ "@momorail/conformance": "0.1.0"
50
+ },
51
+ "scripts": {
52
+ "build": "tsup",
53
+ "typecheck": "tsc --noEmit",
54
+ "test": "vitest run"
55
+ }
56
+ }