@jsm-mit/tigi-sharded-package 0.9.0 → 0.11.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/README.md CHANGED
@@ -44,6 +44,14 @@ const again = await request.searchAgainAsyncUnsafe(); // a new request, th
44
44
  const ride = await request.getRideAsyncUnsafe(); // from the driver canister, every RIDE_POLL_MS (2 s)
45
45
  await request.getRideRouteAsyncUnsafe(); // K-13: the ride's line while it is active (once; undefined after the end)
46
46
  await request.cancelRideAsyncUnsafe(); // before inProgress, once
47
+ // ZT-*: a ride at a chosen time (1 h … 7 days ahead; drivers asked by their base, 3 → 25 km by the workers themselves):
48
+ const later = await rides.requestScheduledAsyncUnsafe({ pickup, destination, pickupAtMs }); // keep later.token; rides.resumeScheduled(token)
49
+ const s = await later.getAsyncUnsafe(); // phase collecting | booking | booked | started | rescue | closed; offers cheapest first
50
+ await later.chooseAsyncUnsafe(s.offers[0].offerId); // a booking; read again for booked / lastOrderRefused
51
+ // started → rides.resumeRequest(s.rideToken) is the ride; rescue → requestRideAsyncUnsafe with the same A, B from T−10 min (RESCUE_BEFORE_MS)
52
+ // P-20: card straight to the driver (Stripe) — when ride.cardAccepted, during inProgress:
53
+ const card = await request.startCardPaymentAsyncUnsafe(returnUrl); // open → go to card.url; the same page again while it stands
54
+ await request.checkCardPaymentAsyncUnsafe(); // back from Stripe (card=paid|cancelled in the URL); ride.cardPayment shows it too
47
55
  await request.getLicenceAsyncUnsafe(); // from accepted to the end of the ride
48
56
  await request.rateDriverAsyncUnsafe(5); // after completed, once
49
57
 
@@ -65,6 +65,7 @@ type QuoteRequest = record {
65
65
  riderName : text;
66
66
  riderRating : opt nat16; // ×100, e.g. 487 = 4.87; none for a new rider
67
67
  deadlineNs : nat64; // 20 s for the driver's OK (U-42)
68
+ pickupAtNs : opt nat64; // P-21: a ride at this time (asked by the base); absent = as soon as possible
68
69
  };
69
70
 
70
71
  type RideOrder = record {
@@ -77,8 +78,12 @@ type RideOrder = record {
77
78
  destination : Geo;
78
79
  price : Money; // the price of the accepted offer
79
80
  answerByNs : nat64; // safety window: our driver canister accepts at once (U-42)
81
+ pickupAtNs : opt nat64; // P-22: a booking for this time — no ride until the driver's "Jadę"
80
82
  };
81
83
 
84
+ // P-22: a booking of a ride at a chosen time (the driver's "Jadę" / giving it up).
85
+ type BookingRef = record { requestId : RequestId; driverKey : DriverKey };
86
+
82
87
  type CloseReason = variant {
83
88
  offerRejected; // the rider tapped ✕ on this driver's offer (U-39)
84
89
  otherOfferChosen;
@@ -94,6 +99,15 @@ type RequestClosed = record {
94
99
 
95
100
  // ---------------------------------------------------------------- driver → worker
96
101
 
102
+ // P-21: where the driver parks the car after work — for rides at a chosen time. Kept whether
103
+ // the driver works or not; renewed daily, gone after 7 days without a renewal.
104
+ type RegisterBase = record {
105
+ driverKey : DriverKey;
106
+ geohash : Geohash; // geohash6 of the base (~1.2 × 0.6 km), never the exact point
107
+ card : DriverCard;
108
+ cardVersion : nat32;
109
+ };
110
+
97
111
  type RegisterDriver = record {
98
112
  driverKey : DriverKey;
99
113
  geohash : Geohash; // geohash7 of the driver: area by its geohash6 prefix,
@@ -167,6 +181,30 @@ type RideView = record {
167
181
  positionAtNs : opt nat64;
168
182
  etaToPickupSec : opt nat32;
169
183
  price : Money;
184
+ cardAccepted : opt bool; // P-20: the driver takes cards; absent = no
185
+ cardPayment : opt CardPaymentView; // P-20: once the rider started one
186
+ };
187
+
188
+ // P-20: the rider's card payment of a ride — Stripe Checkout on the driver's own account.
189
+ type CardPaymentState = variant {
190
+ creating; // the session is being made
191
+ open; // waits for the rider at `url`
192
+ paid;
193
+ expired; // ran out unpaid; a new one may be started
194
+ failed : text; // could not be made; a new try may be started
195
+ };
196
+
197
+ type CardPaymentView = record {
198
+ state : CardPaymentState;
199
+ amount : Money;
200
+ url : opt text; // the Stripe Checkout page, while `open`
201
+ updatedAtNs : nat64;
202
+ };
203
+
204
+ type CardPaymentArgs = record {
205
+ requestId : RequestId;
206
+ driverKey : DriverKey;
207
+ returnUrl : text; // https; Stripe sends the rider back with `card=paid|cancelled`
170
208
  };
171
209
 
172
210
  type Licence = record {
@@ -196,6 +234,10 @@ service : {
196
234
  // line or after the end); an old canister has no such method — the rider draws none.
197
235
  getRideRoute : (RideRef) -> (variant { ok : RouteLine; err : ProtocolError }) query;
198
236
  cancelRide : (RideRef) -> (variant { ok; err : ProtocolError });
237
+ // P-20: pay by card during the ride (`inProgress`); the same page while it stands. A
238
+ // driver without cards answers `invalidData`; an old canister has no such methods.
239
+ startCardPayment : (CardPaymentArgs) -> (variant { ok : CardPaymentView; err : ProtocolError });
240
+ checkCardPayment : (RideRef) -> (variant { ok : CardPaymentView; err : ProtocolError });
199
241
  }
200
242
 
201
243
  // What a driver canister may call on a worker (part of the worker's interface).
@@ -204,6 +246,10 @@ service : {
204
246
  //
205
247
  // service WorkerForDrivers : {
206
248
  // registerDriver : (RegisterDriver) -> (variant { ok; err : ProtocolError });
249
+ // registerBase : (RegisterBase) -> (variant { ok; err : ProtocolError }); // P-21
250
+ // unregisterBase : (DriverKey) -> (); // P-21
251
+ // bookingStarted : (BookingRef) -> (variant { ok; err : ProtocolError }); // P-22
252
+ // bookingDropped : (BookingRef) -> (); // P-22
207
253
  // unregisterDriver : (DriverKey) -> ();
208
254
  // submitQuote : (Quote) -> (variant { ok; err : ProtocolError });
209
255
  // declineQuote : (QuoteDecline) -> ();
@@ -2,6 +2,29 @@ import type { Principal } from '@icp-sdk/core/principal';
2
2
  import type { ActorMethod } from '@icp-sdk/core/agent';
3
3
  import type { IDL } from '@icp-sdk/core/candid';
4
4
 
5
+ /**
6
+ * P-22: a booking of a ride at a chosen time (the driver's "Jadę" / giving it up).
7
+ */
8
+ export interface BookingRef { 'requestId' : RequestId, 'driverKey' : DriverKey }
9
+ export interface CardPaymentArgs {
10
+ 'returnUrl' : string,
11
+ 'requestId' : RequestId,
12
+ 'driverKey' : DriverKey,
13
+ }
14
+ /**
15
+ * P-20: the rider's card payment of a ride — Stripe Checkout on the driver's own account.
16
+ */
17
+ export type CardPaymentState = { 'expired' : null } |
18
+ { 'creating' : null } |
19
+ { 'open' : null } |
20
+ { 'paid' : null } |
21
+ { 'failed' : string };
22
+ export interface CardPaymentView {
23
+ 'url' : [] | [string],
24
+ 'updatedAtNs' : bigint,
25
+ 'state' : CardPaymentState,
26
+ 'amount' : Money,
27
+ }
5
28
  export type CarrierKind = { 'other' : string } |
6
29
  { 'taxi' : null } |
7
30
  { 'rideHailing' : null } |
@@ -66,9 +89,20 @@ export interface QuoteRequest {
66
89
  'deadlineNs' : bigint,
67
90
  'pickup' : Geo,
68
91
  'driverKey' : DriverKey,
92
+ 'pickupAtNs' : [] | [bigint],
69
93
  'riderRating' : [] | [number],
70
94
  'riderName' : string,
71
95
  }
96
+ /**
97
+ * P-21: where the driver parks the car after work — for rides at a chosen time. Kept whether
98
+ * the driver works or not; renewed daily, gone after 7 days without a renewal.
99
+ */
100
+ export interface RegisterBase {
101
+ 'card' : DriverCard,
102
+ 'cardVersion' : number,
103
+ 'geohash' : Geohash,
104
+ 'driverKey' : DriverKey,
105
+ }
72
106
  export interface RegisterDriver {
73
107
  'card' : DriverCard,
74
108
  'cardVersion' : number,
@@ -91,6 +125,7 @@ export interface RideOrder {
91
125
  'requestId' : RequestId,
92
126
  'pickup' : Geo,
93
127
  'driverKey' : DriverKey,
128
+ 'pickupAtNs' : [] | [bigint],
94
129
  'riderRating' : [] | [number],
95
130
  'answerByNs' : bigint,
96
131
  'price' : Money,
@@ -114,9 +149,11 @@ export interface RideView {
114
149
  'status' : RideStatus,
115
150
  'requestId' : RequestId,
116
151
  'positionAtNs' : [] | [bigint],
152
+ 'cardPayment' : [] | [CardPaymentView],
117
153
  'price' : Money,
118
154
  'etaToPickupSec' : [] | [number],
119
155
  'driver' : DriverCard,
156
+ 'cardAccepted' : [] | [boolean],
120
157
  'driverPosition' : [] | [Geo],
121
158
  }
122
159
  export interface RiderRating {
@@ -141,6 +178,11 @@ export interface _SERVICE {
141
178
  { 'ok' : null } |
142
179
  { 'err' : ProtocolError }
143
180
  >,
181
+ 'checkCardPayment' : ActorMethod<
182
+ [RideRef],
183
+ { 'ok' : CardPaymentView } |
184
+ { 'err' : ProtocolError }
185
+ >,
144
186
  'getLicence' : ActorMethod<
145
187
  [RideRef],
146
188
  { 'ok' : Licence } |
@@ -179,6 +221,15 @@ export interface _SERVICE {
179
221
  { 'ok' : null } |
180
222
  { 'err' : ProtocolError }
181
223
  >,
224
+ /**
225
+ * P-20: pay by card during the ride (`inProgress`); the same page while it stands. A
226
+ * driver without cards answers `invalidData`; an old canister has no such methods.
227
+ */
228
+ 'startCardPayment' : ActorMethod<
229
+ [CardPaymentArgs],
230
+ { 'ok' : CardPaymentView } |
231
+ { 'err' : ProtocolError }
232
+ >,
182
233
  }
183
234
  export declare const idlFactory: IDL.InterfaceFactory;
184
235
  export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
@@ -15,12 +15,25 @@ export const idlFactory = ({ IDL }) => {
15
15
  'unsupportedVersion' : IDL.Nat32,
16
16
  'notMyArea' : IDL.Null,
17
17
  });
18
+ const CardPaymentState = IDL.Variant({
19
+ 'expired' : IDL.Null,
20
+ 'creating' : IDL.Null,
21
+ 'open' : IDL.Null,
22
+ 'paid' : IDL.Null,
23
+ 'failed' : IDL.Text,
24
+ });
25
+ const Money = IDL.Record({ 'currency' : IDL.Text, 'amount' : IDL.Nat64 });
26
+ const CardPaymentView = IDL.Record({
27
+ 'url' : IDL.Opt(IDL.Text),
28
+ 'updatedAtNs' : IDL.Nat64,
29
+ 'state' : CardPaymentState,
30
+ 'amount' : Money,
31
+ });
18
32
  const Licence = IDL.Record({
19
33
  'mimeType' : IDL.Text,
20
34
  'image' : IDL.Vec(IDL.Nat8),
21
35
  'documentNumber' : IDL.Text,
22
36
  });
23
- const Money = IDL.Record({ 'currency' : IDL.Text, 'amount' : IDL.Nat64 });
24
37
  const RideStatus = IDL.Variant({
25
38
  'completed' : IDL.Record({ 'price' : Money }),
26
39
  'cancelledByRider' : IDL.Null,
@@ -48,9 +61,11 @@ export const idlFactory = ({ IDL }) => {
48
61
  'status' : RideStatus,
49
62
  'requestId' : RequestId,
50
63
  'positionAtNs' : IDL.Opt(IDL.Nat64),
64
+ 'cardPayment' : IDL.Opt(CardPaymentView),
51
65
  'price' : Money,
52
66
  'etaToPickupSec' : IDL.Opt(IDL.Nat32),
53
67
  'driver' : DriverCard,
68
+ 'cardAccepted' : IDL.Opt(IDL.Bool),
54
69
  'driverPosition' : IDL.Opt(Geo),
55
70
  });
56
71
  const RouteLine = IDL.Record({ 'ride' : IDL.Text, 'toPickup' : IDL.Text });
@@ -60,6 +75,7 @@ export const idlFactory = ({ IDL }) => {
60
75
  'deadlineNs' : IDL.Nat64,
61
76
  'pickup' : Geo,
62
77
  'driverKey' : DriverKey,
78
+ 'pickupAtNs' : IDL.Opt(IDL.Nat64),
63
79
  'riderRating' : IDL.Opt(IDL.Nat16),
64
80
  'riderName' : IDL.Text,
65
81
  });
@@ -79,18 +95,29 @@ export const idlFactory = ({ IDL }) => {
79
95
  'requestId' : RequestId,
80
96
  'pickup' : Geo,
81
97
  'driverKey' : DriverKey,
98
+ 'pickupAtNs' : IDL.Opt(IDL.Nat64),
82
99
  'riderRating' : IDL.Opt(IDL.Nat16),
83
100
  'answerByNs' : IDL.Nat64,
84
101
  'price' : Money,
85
102
  'riderName' : IDL.Text,
86
103
  'rider' : IDL.Principal,
87
104
  });
105
+ const CardPaymentArgs = IDL.Record({
106
+ 'returnUrl' : IDL.Text,
107
+ 'requestId' : RequestId,
108
+ 'driverKey' : DriverKey,
109
+ });
88
110
  return IDL.Service({
89
111
  'cancelRide' : IDL.Func(
90
112
  [RideRef],
91
113
  [IDL.Variant({ 'ok' : IDL.Null, 'err' : ProtocolError })],
92
114
  [],
93
115
  ),
116
+ 'checkCardPayment' : IDL.Func(
117
+ [RideRef],
118
+ [IDL.Variant({ 'ok' : CardPaymentView, 'err' : ProtocolError })],
119
+ [],
120
+ ),
94
121
  'getLicence' : IDL.Func(
95
122
  [RideRef],
96
123
  [IDL.Variant({ 'ok' : Licence, 'err' : ProtocolError })],
@@ -118,6 +145,11 @@ export const idlFactory = ({ IDL }) => {
118
145
  [IDL.Variant({ 'ok' : IDL.Null, 'err' : ProtocolError })],
119
146
  [],
120
147
  ),
148
+ 'startCardPayment' : IDL.Func(
149
+ [CardPaymentArgs],
150
+ [IDL.Variant({ 'ok' : CardPaymentView, 'err' : ProtocolError })],
151
+ [],
152
+ ),
121
153
  });
122
154
  };
123
155
  export const init = ({ IDL }) => { return []; };
@@ -1,4 +1,31 @@
1
1
  type CancelledByDriverStatus = record { reason : text };
2
+ // `variant { ok : CardPaymentView; err : ProtocolError }`.
3
+ type CardPaymentAnswer = variant { ok : CardPaymentView; err : ProtocolError };
4
+ // P-20: `startCardPayment` — the rider's front gives the page Stripe sends the rider back to.
5
+ type CardPaymentArgs = record {
6
+ returnUrl : text;
7
+ requestId : text;
8
+ driverKey : text;
9
+ };
10
+ // P-20: where the rider's card payment of a ride stands.
11
+ type CardPaymentState = variant {
12
+ // The session ran out unpaid; a new one may be started.
13
+ expired;
14
+ // The driver canister is making the Stripe Checkout session.
15
+ creating;
16
+ // The session waits for the rider at `url`.
17
+ open;
18
+ paid;
19
+ // The session could not be made (the reason, for the fronts); a new try may be started.
20
+ failed : text;
21
+ };
22
+ type CardPaymentView = record {
23
+ // The Stripe Checkout page, while `open`.
24
+ url : opt text;
25
+ updatedAtNs : nat64;
26
+ state : CardPaymentState;
27
+ amount : Money;
28
+ };
2
29
  type CarrierKind = variant {
3
30
  other : text;
4
31
  taxi;
@@ -197,6 +224,9 @@ type QuoteRequest = record {
197
224
  deadlineNs : nat64;
198
225
  pickup : Geo;
199
226
  driverKey : text;
227
+ // P-21: a ride at this time — asked by the driver's base, answered until `deadlineNs`
228
+ // (T−30 min). Absent = as soon as possible.
229
+ pickupAtNs : opt nat64;
200
230
  // ×100, e.g. 487 = 4.87; none for a new rider.
201
231
  riderRating : opt nat16;
202
232
  riderName : text;
@@ -217,6 +247,9 @@ type RideOrder = record {
217
247
  requestId : text;
218
248
  pickup : Geo;
219
249
  driverKey : text;
250
+ // P-22: a booking for this time — accepted as usual, but no ride until the driver's
251
+ // "Jadę" (`bookingStarted`).
252
+ pickupAtNs : opt nat64;
220
253
  riderRating : opt nat16;
221
254
  // 20 s for the driver to accept (U-39).
222
255
  answerByNs : nat64;
@@ -239,9 +272,13 @@ type RideView = record {
239
272
  status : RideStatus;
240
273
  requestId : text;
241
274
  positionAtNs : opt nat64;
275
+ // P-20: the rider's card payment of this ride, once started.
276
+ cardPayment : opt CardPaymentView;
242
277
  price : Money;
243
278
  etaToPickupSec : opt nat32;
244
279
  driver : DriverCard;
280
+ // P-20: the driver takes cards (Stripe on the driver's own account); absent = no.
281
+ cardAccepted : opt bool;
245
282
  // Exact, for the rider of this ride only.
246
283
  driverPosition : opt Geo;
247
284
  };
@@ -313,8 +350,8 @@ type SpeedUpArgs = record {
313
350
  factor : nat8;
314
351
  };
315
352
  service : (InitArgs) -> {
316
- // S-14 (KK-33): the rider cancels before `inProgress`, once.
317
353
  cancelRide : (RideRef) -> (ProtocolAnswer);
354
+ checkCardPayment : (RideRef) -> (CardPaymentAnswer);
318
355
  // S-N15: where testers last asked for drivers — the router moves the automat driver
319
356
  // canister near it (TIGI-DRIVER-MODES). None until the first search after an install or
320
357
  // an upgrade.
@@ -343,6 +380,9 @@ service : (InitArgs) -> {
343
380
  // S-2, S-3: virtual drivers around a point, each registered in the worker of its cell
344
381
  // with `validUntilNs` (30 min) instead of a pulse.
345
382
  spawnDrivers : (SpawnArgs) -> (Result_3);
383
+ // S-14 (KK-33): the rider cancels before `inProgress`, once.
384
+ // P-20: simulated drivers take no cards (`cardAccepted` is absent in their `getRide`).
385
+ startCardPayment : (CardPaymentArgs) -> (CardPaymentAnswer);
346
386
  // S-N13: the router's route for one virtual driver — metres, seconds, the line. The quote
347
387
  // goes with it at its moment (S-8), or at once when that moment has passed.
348
388
  submitRoute : (SimRouteResult) -> (Result_2);
@@ -3,6 +3,56 @@ import type { ActorMethod } from '@icp-sdk/core/agent';
3
3
  import type { IDL } from '@icp-sdk/core/candid';
4
4
 
5
5
  export interface CancelledByDriverStatus { 'reason' : string }
6
+ /**
7
+ * `variant { ok : CardPaymentView; err : ProtocolError }`.
8
+ */
9
+ export type CardPaymentAnswer = { 'ok' : CardPaymentView } |
10
+ { 'err' : ProtocolError };
11
+ /**
12
+ * P-20: `startCardPayment` — the rider's front gives the page Stripe sends the rider back to.
13
+ */
14
+ export interface CardPaymentArgs {
15
+ 'returnUrl' : string,
16
+ 'requestId' : string,
17
+ 'driverKey' : string,
18
+ }
19
+ /**
20
+ * P-20: where the rider's card payment of a ride stands.
21
+ */
22
+ export type CardPaymentState = {
23
+ /**
24
+ * The session ran out unpaid; a new one may be started.
25
+ */
26
+ 'expired' : null
27
+ } |
28
+ {
29
+ /**
30
+ * The driver canister is making the Stripe Checkout session.
31
+ */
32
+ 'creating' : null
33
+ } |
34
+ {
35
+ /**
36
+ * The session waits for the rider at `url`.
37
+ */
38
+ 'open' : null
39
+ } |
40
+ { 'paid' : null } |
41
+ {
42
+ /**
43
+ * The session could not be made (the reason, for the fronts); a new try may be started.
44
+ */
45
+ 'failed' : string
46
+ };
47
+ export interface CardPaymentView {
48
+ /**
49
+ * The Stripe Checkout page, while `open`.
50
+ */
51
+ 'url' : [] | [string],
52
+ 'updatedAtNs' : bigint,
53
+ 'state' : CardPaymentState,
54
+ 'amount' : Money,
55
+ }
6
56
  export type CarrierKind = { 'other' : string } |
7
57
  { 'taxi' : null } |
8
58
  {
@@ -277,6 +327,11 @@ export interface QuoteRequest {
277
327
  'deadlineNs' : bigint,
278
328
  'pickup' : Geo,
279
329
  'driverKey' : string,
330
+ /**
331
+ * P-21: a ride at this time — asked by the driver's base, answered until `deadlineNs`
332
+ * (T−30 min). Absent = as soon as possible.
333
+ */
334
+ 'pickupAtNs' : [] | [bigint],
280
335
  /**
281
336
  * ×100, e.g. 487 = 4.87; none for a new rider.
282
337
  */
@@ -306,6 +361,11 @@ export interface RideOrder {
306
361
  'requestId' : string,
307
362
  'pickup' : Geo,
308
363
  'driverKey' : string,
364
+ /**
365
+ * P-22: a booking for this time — accepted as usual, but no ride until the driver's
366
+ * "Jadę" (`bookingStarted`).
367
+ */
368
+ 'pickupAtNs' : [] | [bigint],
309
369
  'riderRating' : [] | [number],
310
370
  /**
311
371
  * 20 s for the driver to accept (U-39).
@@ -332,9 +392,17 @@ export interface RideView {
332
392
  'status' : RideStatus,
333
393
  'requestId' : string,
334
394
  'positionAtNs' : [] | [bigint],
395
+ /**
396
+ * P-20: the rider's card payment of this ride, once started.
397
+ */
398
+ 'cardPayment' : [] | [CardPaymentView],
335
399
  'price' : Money,
336
400
  'etaToPickupSec' : [] | [number],
337
401
  'driver' : DriverCard,
402
+ /**
403
+ * P-20: the driver takes cards (Stripe on the driver's own account); absent = no.
404
+ */
405
+ 'cardAccepted' : [] | [boolean],
338
406
  /**
339
407
  * Exact, for the rider of this ride only.
340
408
  */
@@ -435,10 +503,8 @@ export interface SpeedUpArgs {
435
503
  'factor' : number,
436
504
  }
437
505
  export interface _SERVICE {
438
- /**
439
- * S-14 (KK-33): the rider cancels before `inProgress`, once.
440
- */
441
506
  'cancelRide' : ActorMethod<[RideRef], ProtocolAnswer>,
507
+ 'checkCardPayment' : ActorMethod<[RideRef], CardPaymentAnswer>,
442
508
  /**
443
509
  * S-N15: where testers last asked for drivers — the router moves the automat driver
444
510
  * canister near it (TIGI-DRIVER-MODES). None until the first search after an install or
@@ -485,6 +551,11 @@ export interface _SERVICE {
485
551
  * with `validUntilNs` (30 min) instead of a pulse.
486
552
  */
487
553
  'spawnDrivers' : ActorMethod<[SpawnArgs], Result_3>,
554
+ /**
555
+ * S-14 (KK-33): the rider cancels before `inProgress`, once.
556
+ * P-20: simulated drivers take no cards (`cardAccepted` is absent in their `getRide`).
557
+ */
558
+ 'startCardPayment' : ActorMethod<[CardPaymentArgs], CardPaymentAnswer>,
488
559
  /**
489
560
  * S-N13: the router's route for one virtual driver — metres, seconds, the line. The quote
490
561
  * goes with it at its moment (S-8), or at once when that moment has passed.
@@ -28,6 +28,24 @@ export const idlFactory = ({ IDL }) => {
28
28
  'ok' : IDL.Null,
29
29
  'err' : ProtocolError,
30
30
  });
31
+ const CardPaymentState = IDL.Variant({
32
+ 'expired' : IDL.Null,
33
+ 'creating' : IDL.Null,
34
+ 'open' : IDL.Null,
35
+ 'paid' : IDL.Null,
36
+ 'failed' : IDL.Text,
37
+ });
38
+ const Money = IDL.Record({ 'currency' : IDL.Text, 'amount' : IDL.Nat64 });
39
+ const CardPaymentView = IDL.Record({
40
+ 'url' : IDL.Opt(IDL.Text),
41
+ 'updatedAtNs' : IDL.Nat64,
42
+ 'state' : CardPaymentState,
43
+ 'amount' : Money,
44
+ });
45
+ const CardPaymentAnswer = IDL.Variant({
46
+ 'ok' : CardPaymentView,
47
+ 'err' : ProtocolError,
48
+ });
31
49
  const Geo = IDL.Record({ 'lat' : IDL.Float64, 'lng' : IDL.Float64 });
32
50
  const SpawnPlace = IDL.Record({ 'center' : Geo, 'atNs' : IDL.Nat64 });
33
51
  const SimulatorError = IDL.Variant({
@@ -46,7 +64,6 @@ export const idlFactory = ({ IDL }) => {
46
64
  'documentNumber' : IDL.Text,
47
65
  });
48
66
  const LicenceAnswer = IDL.Variant({ 'ok' : Licence, 'err' : ProtocolError });
49
- const Money = IDL.Record({ 'currency' : IDL.Text, 'amount' : IDL.Nat64 });
50
67
  const CompletedStatus = IDL.Record({ 'price' : Money });
51
68
  const CancelledByDriverStatus = IDL.Record({ 'reason' : IDL.Text });
52
69
  const RideStatus = IDL.Variant({
@@ -75,9 +92,11 @@ export const idlFactory = ({ IDL }) => {
75
92
  'status' : RideStatus,
76
93
  'requestId' : IDL.Text,
77
94
  'positionAtNs' : IDL.Opt(IDL.Nat64),
95
+ 'cardPayment' : IDL.Opt(CardPaymentView),
78
96
  'price' : Money,
79
97
  'etaToPickupSec' : IDL.Opt(IDL.Nat32),
80
98
  'driver' : DriverCard,
99
+ 'cardAccepted' : IDL.Opt(IDL.Bool),
81
100
  'driverPosition' : IDL.Opt(Geo),
82
101
  });
83
102
  const RideAnswer = IDL.Variant({ 'ok' : RideView, 'err' : ProtocolError });
@@ -129,6 +148,7 @@ export const idlFactory = ({ IDL }) => {
129
148
  'deadlineNs' : IDL.Nat64,
130
149
  'pickup' : Geo,
131
150
  'driverKey' : IDL.Text,
151
+ 'pickupAtNs' : IDL.Opt(IDL.Nat64),
132
152
  'riderRating' : IDL.Opt(IDL.Nat16),
133
153
  'riderName' : IDL.Text,
134
154
  });
@@ -148,6 +168,7 @@ export const idlFactory = ({ IDL }) => {
148
168
  'requestId' : IDL.Text,
149
169
  'pickup' : Geo,
150
170
  'driverKey' : IDL.Text,
171
+ 'pickupAtNs' : IDL.Opt(IDL.Nat64),
151
172
  'riderRating' : IDL.Opt(IDL.Nat16),
152
173
  'answerByNs' : IDL.Nat64,
153
174
  'price' : Money,
@@ -168,6 +189,11 @@ export const idlFactory = ({ IDL }) => {
168
189
  'validUntilNs' : IDL.Nat64,
169
190
  });
170
191
  const Result_3 = IDL.Variant({ 'Ok' : SpawnResult, 'Err' : SimulatorError });
192
+ const CardPaymentArgs = IDL.Record({
193
+ 'returnUrl' : IDL.Text,
194
+ 'requestId' : IDL.Text,
195
+ 'driverKey' : IDL.Text,
196
+ });
171
197
  const SimRouteResult = IDL.Record({
172
198
  'requestId' : IDL.Text,
173
199
  'rideMeters' : IDL.Nat32,
@@ -179,6 +205,7 @@ export const idlFactory = ({ IDL }) => {
179
205
  });
180
206
  return IDL.Service({
181
207
  'cancelRide' : IDL.Func([RideRef], [ProtocolAnswer], []),
208
+ 'checkCardPayment' : IDL.Func([RideRef], [CardPaymentAnswer], []),
182
209
  'getLastSpawn' : IDL.Func([], [Result], ['query']),
183
210
  'getLicence' : IDL.Func([RideRef], [LicenceAnswer], ['query']),
184
211
  'getRide' : IDL.Func([RideRef], [RideAnswer], ['query']),
@@ -193,6 +220,7 @@ export const idlFactory = ({ IDL }) => {
193
220
  'setRouter' : IDL.Func([SetRouterArgs], [Result_2], []),
194
221
  'setSpeedUp' : IDL.Func([SpeedUpArgs], [Result_2], []),
195
222
  'spawnDrivers' : IDL.Func([SpawnArgs], [Result_3], []),
223
+ 'startCardPayment' : IDL.Func([CardPaymentArgs], [CardPaymentAnswer], []),
196
224
  'submitRoute' : IDL.Func([SimRouteResult], [Result_2], []),
197
225
  });
198
226
  };