@vulog/aima-payment 1.1.84 → 1.1.86

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/index.d.mts CHANGED
@@ -39,6 +39,81 @@ type PaymentDetail = {
39
39
  type SynchronizeResponse = {
40
40
  status: 'SUCCEEDED' | 'REQUIRES_CAPTURE' | 'FAILED';
41
41
  };
42
+ type TripPayment = {
43
+ paymentIntents: [
44
+ {
45
+ id: string;
46
+ pspName: 'STRIPE' | 'ADYEN';
47
+ pspReference: string;
48
+ pspPublishableKey: string;
49
+ amount: number;
50
+ currency: string;
51
+ date: string;
52
+ status: string;
53
+ paymentMethodType: string;
54
+ paymentMethodPspReference: string;
55
+ paymentIntentPspReference: string;
56
+ number: number;
57
+ code: string;
58
+ declineCode: string;
59
+ pspClientSecret: string;
60
+ reason: string;
61
+ note: string;
62
+ nextAction: {
63
+ nextActionRedirectUrl: {
64
+ url: string;
65
+ method: string;
66
+ data: {
67
+ [key: string]: any;
68
+ };
69
+ };
70
+ type: string;
71
+ };
72
+ metadatas: {
73
+ [key: string]: any;
74
+ };
75
+ }
76
+ ];
77
+ paymentReceipts: [
78
+ {
79
+ id: string;
80
+ pspName: string;
81
+ pspReference: string;
82
+ pspPublishableKey: string;
83
+ amount: number;
84
+ currency: string;
85
+ date: string;
86
+ status: string;
87
+ paymentMethodType: string;
88
+ paymentMethodPspReference: string;
89
+ paymentIntentPspReference: string;
90
+ number: number;
91
+ code: string;
92
+ declineCode: string;
93
+ pspClientSecret: string;
94
+ reason: string;
95
+ note: string;
96
+ nextAction: {
97
+ nextActionRedirectUrl: {
98
+ url: string;
99
+ method: string;
100
+ data: {
101
+ [key: string]: any;
102
+ };
103
+ };
104
+ type: string;
105
+ };
106
+ metadatas: {
107
+ [key: string]: any;
108
+ };
109
+ }
110
+ ];
111
+ id: string;
112
+ fleetId: string;
113
+ profileId: string;
114
+ vehicleId: string;
115
+ serviceId: string;
116
+ };
42
117
 
43
118
  declare const getPaymentMethodDetailsForUser: (client: Client, id: string) => Promise<PaymentDetail | undefined>;
44
119
 
@@ -94,6 +169,6 @@ declare const schema: z.ZodObject<{
94
169
  useSystemCredit?: boolean | undefined;
95
170
  };
96
171
  }>;
97
- declare const payATrip: (client: Client, tripId: string, body: z.infer<typeof schema>["body"]) => Promise<void>;
172
+ declare const payATrip: (client: Client, tripId: string, body: z.infer<typeof schema>["body"]) => Promise<TripPayment>;
98
173
 
99
- export { type BrowserInfos, type PaymentDetail, type SetupIntent, type SynchronizeResponse, getPaymentMethodDetailsForUser, getSetupIntent, getSynchronize, payATrip };
174
+ export { type BrowserInfos, type PaymentDetail, type SetupIntent, type SynchronizeResponse, type TripPayment, getPaymentMethodDetailsForUser, getSetupIntent, getSynchronize, payATrip };
package/dist/index.d.ts CHANGED
@@ -39,6 +39,81 @@ type PaymentDetail = {
39
39
  type SynchronizeResponse = {
40
40
  status: 'SUCCEEDED' | 'REQUIRES_CAPTURE' | 'FAILED';
41
41
  };
42
+ type TripPayment = {
43
+ paymentIntents: [
44
+ {
45
+ id: string;
46
+ pspName: 'STRIPE' | 'ADYEN';
47
+ pspReference: string;
48
+ pspPublishableKey: string;
49
+ amount: number;
50
+ currency: string;
51
+ date: string;
52
+ status: string;
53
+ paymentMethodType: string;
54
+ paymentMethodPspReference: string;
55
+ paymentIntentPspReference: string;
56
+ number: number;
57
+ code: string;
58
+ declineCode: string;
59
+ pspClientSecret: string;
60
+ reason: string;
61
+ note: string;
62
+ nextAction: {
63
+ nextActionRedirectUrl: {
64
+ url: string;
65
+ method: string;
66
+ data: {
67
+ [key: string]: any;
68
+ };
69
+ };
70
+ type: string;
71
+ };
72
+ metadatas: {
73
+ [key: string]: any;
74
+ };
75
+ }
76
+ ];
77
+ paymentReceipts: [
78
+ {
79
+ id: string;
80
+ pspName: string;
81
+ pspReference: string;
82
+ pspPublishableKey: string;
83
+ amount: number;
84
+ currency: string;
85
+ date: string;
86
+ status: string;
87
+ paymentMethodType: string;
88
+ paymentMethodPspReference: string;
89
+ paymentIntentPspReference: string;
90
+ number: number;
91
+ code: string;
92
+ declineCode: string;
93
+ pspClientSecret: string;
94
+ reason: string;
95
+ note: string;
96
+ nextAction: {
97
+ nextActionRedirectUrl: {
98
+ url: string;
99
+ method: string;
100
+ data: {
101
+ [key: string]: any;
102
+ };
103
+ };
104
+ type: string;
105
+ };
106
+ metadatas: {
107
+ [key: string]: any;
108
+ };
109
+ }
110
+ ];
111
+ id: string;
112
+ fleetId: string;
113
+ profileId: string;
114
+ vehicleId: string;
115
+ serviceId: string;
116
+ };
42
117
 
43
118
  declare const getPaymentMethodDetailsForUser: (client: Client, id: string) => Promise<PaymentDetail | undefined>;
44
119
 
@@ -94,6 +169,6 @@ declare const schema: z.ZodObject<{
94
169
  useSystemCredit?: boolean | undefined;
95
170
  };
96
171
  }>;
97
- declare const payATrip: (client: Client, tripId: string, body: z.infer<typeof schema>["body"]) => Promise<void>;
172
+ declare const payATrip: (client: Client, tripId: string, body: z.infer<typeof schema>["body"]) => Promise<TripPayment>;
98
173
 
99
- export { type BrowserInfos, type PaymentDetail, type SetupIntent, type SynchronizeResponse, getPaymentMethodDetailsForUser, getSetupIntent, getSynchronize, payATrip };
174
+ export { type BrowserInfos, type PaymentDetail, type SetupIntent, type SynchronizeResponse, type TripPayment, getPaymentMethodDetailsForUser, getSetupIntent, getSynchronize, payATrip };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulog/aima-payment",
3
- "version": "1.1.84",
3
+ "version": "1.1.86",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -19,8 +19,8 @@
19
19
  "author": "Vulog",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@vulog/aima-client": "1.1.84",
23
- "@vulog/aima-core": "1.1.84"
22
+ "@vulog/aima-client": "1.1.86",
23
+ "@vulog/aima-core": "1.1.86"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "zod": "^3.25.76"
package/src/payATrip.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { Client } from '@vulog/aima-client';
2
2
  import { z } from 'zod';
3
3
 
4
+ import { TripPayment } from './types';
5
+
4
6
  /**
5
7
  * Pay for a trip by its ID.
6
8
  *
@@ -21,7 +23,11 @@ const schema = z.object({
21
23
  }),
22
24
  });
23
25
 
24
- export const payATrip = async (client: Client, tripId: string, body: z.infer<typeof schema>['body']): Promise<void> => {
26
+ export const payATrip = async (
27
+ client: Client,
28
+ tripId: string,
29
+ body: z.infer<typeof schema>['body']
30
+ ): Promise<TripPayment> => {
25
31
  const validated = schema.safeParse({ tripId, body });
26
32
  if (!validated.success) {
27
33
  throw new TypeError('Invalid parameters', {
@@ -30,7 +36,7 @@ export const payATrip = async (client: Client, tripId: string, body: z.infer<typ
30
36
  }
31
37
 
32
38
  return client
33
- .post<void>(`/boapi/proxy/trip/fleets/${client.clientOptions.fleetId}/trips/${tripId}/pay`, {
39
+ .post<TripPayment>(`/boapi/proxy/trip/fleets/${client.clientOptions.fleetId}/trips/${tripId}/pay`, {
34
40
  online: body.online ?? false,
35
41
  scope: body.scope ?? 'RENTAL',
36
42
  amountType: body.amountType ?? 'FIXED',
package/src/types.ts CHANGED
@@ -45,3 +45,73 @@ export type PaymentDetail = {
45
45
  export type SynchronizeResponse = {
46
46
  status: 'SUCCEEDED' | 'REQUIRES_CAPTURE' | 'FAILED';
47
47
  };
48
+
49
+ export type TripPayment = {
50
+ paymentIntents: [
51
+ {
52
+ id: string;
53
+ pspName: 'STRIPE' | 'ADYEN';
54
+ pspReference: string;
55
+ pspPublishableKey: string;
56
+ amount: number;
57
+ currency: string;
58
+ date: string;
59
+ status: string;
60
+ paymentMethodType: string;
61
+ paymentMethodPspReference: string;
62
+ paymentIntentPspReference: string;
63
+ number: number;
64
+ code: string;
65
+ declineCode: string;
66
+ pspClientSecret: string;
67
+ reason: string;
68
+ note: string;
69
+ nextAction: {
70
+ nextActionRedirectUrl: {
71
+ url: string;
72
+ method: string;
73
+ data: { [key: string]: any };
74
+ };
75
+ type: string;
76
+ };
77
+ metadatas: { [key: string]: any };
78
+ },
79
+ ];
80
+ paymentReceipts: [
81
+ {
82
+ id: string;
83
+ pspName: string;
84
+ pspReference: string;
85
+ pspPublishableKey: string;
86
+ amount: number;
87
+ currency: string;
88
+ date: string;
89
+ status: string;
90
+ paymentMethodType: string;
91
+ paymentMethodPspReference: string;
92
+ paymentIntentPspReference: string;
93
+ number: number;
94
+ code: string;
95
+ declineCode: string;
96
+ pspClientSecret: string;
97
+ reason: string;
98
+ note: string;
99
+ nextAction: {
100
+ nextActionRedirectUrl: {
101
+ url: string;
102
+ method: string;
103
+ data: {
104
+ [key: string]: any;
105
+ };
106
+ };
107
+ type: string;
108
+ };
109
+ metadatas: { [key: string]: any };
110
+ },
111
+ ];
112
+ id: string;
113
+ fleetId: string;
114
+ profileId: string;
115
+ vehicleId: string;
116
+ serviceId: string;
117
+ };