@monimesl/dot-cli 1.0.0-beta.1 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/templates/showcase/pages/dash/payments/cases.ts +15 -15
- package/dist/templates/showcase/pages/dash/payments/controller.ts +15 -3
- package/dist/templates/showcase/pages/dash/payments/state.ts +2 -0
- package/dist/templates/showcase/pages/dash/payments/view.dml +2 -0
- package/package.json +6 -6
|
@@ -115,13 +115,13 @@ export const GROUPS: CaseGroup[] = [
|
|
|
115
115
|
id: 'orange',
|
|
116
116
|
title: 'Orange Money only',
|
|
117
117
|
expect: 'Mobile money with only Orange Money (m17).',
|
|
118
|
-
options: paying([{ type: 'momo', providers:
|
|
118
|
+
options: paying([{ type: 'momo', providers: ['m17'] }]),
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
121
|
id: 'africell',
|
|
122
122
|
title: 'Africell Money only',
|
|
123
123
|
expect: 'Mobile money with only Africell Money (m18).',
|
|
124
|
-
options: paying([{ type: 'momo', providers:
|
|
124
|
+
options: paying([{ type: 'momo', providers: ['m18'] }]),
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
127
|
id: 'one-number',
|
|
@@ -134,30 +134,30 @@ export const GROUPS: CaseGroup[] = [
|
|
|
134
134
|
),
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
|
-
id: '
|
|
138
|
-
title: '
|
|
139
|
-
expect: 'Linked accounts,
|
|
140
|
-
options: paying([{ type: 'link', providers:
|
|
137
|
+
id: 'any-provider',
|
|
138
|
+
title: 'An empty list of providers',
|
|
139
|
+
expect: 'Linked accounts at any provider, as an empty list means all of them.',
|
|
140
|
+
options: paying([{ type: 'link', providers: [] }]),
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
id: 'banks',
|
|
144
144
|
title: 'Bank accounts only',
|
|
145
145
|
expect: 'Linked accounts at slb001, slb004 and slb007 only, so no mobile money wallets.',
|
|
146
|
-
options: paying([{ type: 'link', providers:
|
|
146
|
+
options: paying([{ type: 'link', providers: ['slb001', 'slb004', 'slb007'] }]),
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
149
|
id: 'orange-or-account',
|
|
150
150
|
title: 'Orange Money from one number, or an account',
|
|
151
151
|
expect:
|
|
152
|
-
'Mobile money limited to Orange Money and the number above, then linked accounts
|
|
152
|
+
'Mobile money limited to Orange Money and the number above, then linked accounts at slb001 only.',
|
|
153
153
|
options: (input, reference) =>
|
|
154
154
|
paying([
|
|
155
155
|
{
|
|
156
156
|
type: 'momo',
|
|
157
|
-
providers:
|
|
157
|
+
providers: ['m17'],
|
|
158
158
|
phoneNumber: input.phoneNumber || SAMPLE_PHONE_NUMBER,
|
|
159
159
|
},
|
|
160
|
-
{ type: 'link', providers:
|
|
160
|
+
{ type: 'link', providers: ['slb001'] },
|
|
161
161
|
])(input, reference),
|
|
162
162
|
},
|
|
163
163
|
],
|
|
@@ -399,16 +399,16 @@ export const GROUPS: CaseGroup[] = [
|
|
|
399
399
|
options: paying([{ type: 'card' }, { type: 'card' }]),
|
|
400
400
|
},
|
|
401
401
|
{
|
|
402
|
-
id: '
|
|
403
|
-
title: '
|
|
404
|
-
expect:
|
|
405
|
-
options: paying([{ type: 'link', providers:
|
|
402
|
+
id: 'providers-not-a-list',
|
|
403
|
+
title: 'Providers that are not a list',
|
|
404
|
+
expect: 'invalid: link\'s providers must be a list of provider IDs, such as ["m17"]',
|
|
405
|
+
options: paying([{ type: 'link', providers: 'm17' as unknown as string[] }]),
|
|
406
406
|
},
|
|
407
407
|
{
|
|
408
408
|
id: 'unknown-provider',
|
|
409
409
|
title: "A provider Monime doesn't know",
|
|
410
410
|
expect: 'invalid: "m99" isn\'t a provider Monime knows for momo',
|
|
411
|
-
options: paying([{ type: 'momo', providers:
|
|
411
|
+
options: paying([{ type: 'momo', providers: ['m99'] }]),
|
|
412
412
|
},
|
|
413
413
|
{
|
|
414
414
|
id: 'local-number',
|
|
@@ -24,6 +24,7 @@ export default definePage({
|
|
|
24
24
|
setFinancialAccountId: (_state, event: ValueEvent) => ({
|
|
25
25
|
financialAccountId: event.detail.value.trim(),
|
|
26
26
|
}),
|
|
27
|
+
clearError: () => ({ error: '' }),
|
|
27
28
|
},
|
|
28
29
|
actions: {
|
|
29
30
|
// data-case names the case to run, from cases.ts.
|
|
@@ -67,6 +68,7 @@ export default definePage({
|
|
|
67
68
|
this.setState(shownResult(result));
|
|
68
69
|
} catch (error) {
|
|
69
70
|
outcome = errorOutcome(error);
|
|
71
|
+
this.setState({ error: outcome });
|
|
70
72
|
}
|
|
71
73
|
// Another run may have started meanwhile, so this one names itself again.
|
|
72
74
|
this.setState((current) => ({
|
|
@@ -77,6 +79,9 @@ export default definePage({
|
|
|
77
79
|
async checkPayment(state) {
|
|
78
80
|
const title = 'Check the last payment';
|
|
79
81
|
const found = await lookedUp(this.dash.payments.get(state.reference));
|
|
82
|
+
if (found.failed) {
|
|
83
|
+
this.setState({ error: found.outcome });
|
|
84
|
+
}
|
|
80
85
|
this.setState((current) => ({
|
|
81
86
|
...found.shown,
|
|
82
87
|
last: { title, expect: '', outcome: found.outcome },
|
|
@@ -86,6 +91,9 @@ export default definePage({
|
|
|
86
91
|
async lookUpUnknown() {
|
|
87
92
|
const title = 'Look up an order that never was';
|
|
88
93
|
const found = await lookedUp(this.dash.payments.get('order-that-never-was'));
|
|
94
|
+
if (found.failed) {
|
|
95
|
+
this.setState({ error: found.outcome });
|
|
96
|
+
}
|
|
89
97
|
this.setState((current) => ({
|
|
90
98
|
last: {
|
|
91
99
|
title,
|
|
@@ -102,11 +110,15 @@ async function lookedUp(lookup: Promise<PaymentResult | undefined>) {
|
|
|
102
110
|
try {
|
|
103
111
|
const result = await lookup;
|
|
104
112
|
if (result === undefined) {
|
|
105
|
-
return {
|
|
113
|
+
return {
|
|
114
|
+
outcome: 'undefined: there is no payment for this reference',
|
|
115
|
+
shown: {},
|
|
116
|
+
failed: false,
|
|
117
|
+
};
|
|
106
118
|
}
|
|
107
|
-
return { outcome: resultOutcome(result), shown: shownResult(result) };
|
|
119
|
+
return { outcome: resultOutcome(result), shown: shownResult(result), failed: false };
|
|
108
120
|
} catch (error) {
|
|
109
|
-
return { outcome: errorOutcome(error), shown: {} };
|
|
121
|
+
return { outcome: errorOutcome(error), shown: {}, failed: true };
|
|
110
122
|
}
|
|
111
123
|
}
|
|
112
124
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monimesl/dot-cli",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"description": "The dotctl command: build mini apps and run them in the simulator",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"typescript": "^5.9.3",
|
|
26
26
|
"uqr": "^0.1.3",
|
|
27
|
-
"@monimesl/dot-compiler": "1.0.0-beta.
|
|
28
|
-
"@monimesl/dot-core": "1.0.0-beta.
|
|
29
|
-
"@monimesl/dot-dml-parser": "1.0.0-beta.
|
|
30
|
-
"@monimesl/dot-script-parser": "1.0.0-beta.
|
|
31
|
-
"@monimesl/dot-simulator": "1.0.0-beta.
|
|
27
|
+
"@monimesl/dot-compiler": "1.0.0-beta.2",
|
|
28
|
+
"@monimesl/dot-core": "1.0.0-beta.2",
|
|
29
|
+
"@monimesl/dot-dml-parser": "1.0.0-beta.2",
|
|
30
|
+
"@monimesl/dot-script-parser": "1.0.0-beta.2",
|
|
31
|
+
"@monimesl/dot-simulator": "1.0.0-beta.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^22.20.4",
|