@candesk/contracts 6.12.0 → 6.13.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.
@@ -1,3 +1,4 @@
1
1
  export * from './auth';
2
2
  export * from './kyc';
3
+ export * from './payment';
3
4
  export * from './queues';
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./auth"), exports);
18
18
  __exportStar(require("./kyc"), exports);
19
+ __exportStar(require("./payment"), exports);
19
20
  __exportStar(require("./queues"), exports);
@@ -0,0 +1,3 @@
1
+ export * from './payment.events';
2
+ export * from './payment-failed.interface';
3
+ export * from './payment-paid.interface';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./payment.events"), exports);
18
+ __exportStar(require("./payment-failed.interface"), exports);
19
+ __exportStar(require("./payment-paid.interface"), exports);
@@ -0,0 +1,6 @@
1
+ export type PaymentFailureReason = 'CANCELED' | 'EXPIRED' | 'FAILED';
2
+ export interface PaymentFailedEvent {
3
+ paymentId: string;
4
+ referenceId: string;
5
+ reason: PaymentFailureReason;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export interface PaymentPaidEvent {
2
+ paymentId: string;
3
+ referenceId: string;
4
+ paidAt: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export declare const PAYMENT_EVENTS: {
2
+ readonly PAYMENT_PAID: 'payment.paid';
3
+ readonly PAYMENT_FAILED: 'payment.failed';
4
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PAYMENT_EVENTS = void 0;
4
+ exports.PAYMENT_EVENTS = {
5
+ PAYMENT_PAID: 'payment.paid',
6
+ PAYMENT_FAILED: 'payment.failed'
7
+ };
@@ -0,0 +1,66 @@
1
+ export declare const protobufPackage = "payment.v1";
2
+ export declare enum PaymentStatus {
3
+ PAYMENT_STATUS_UNSPECIFIED = 0,
4
+ PAYMENT_STATUS_OPEN = 1,
5
+ PAYMENT_STATUS_PENDING = 2,
6
+ PAYMENT_STATUS_PAID = 3,
7
+ PAYMENT_STATUS_CANCELED = 4,
8
+ PAYMENT_STATUS_EXPIRED = 5,
9
+ PAYMENT_STATUS_FAILED = 6,
10
+ UNRECOGNIZED = -1
11
+ }
12
+ export declare enum PaymentProvider {
13
+ PAYMENT_PROVIDER_UNSPECIFIED = 0,
14
+ PAYMENT_PROVIDER_MOLLIE = 1,
15
+ UNRECOGNIZED = -1
16
+ }
17
+ export interface PaymentAddress {
18
+ streetAndNumber: string;
19
+ postalCode: string;
20
+ city: string;
21
+ country: string;
22
+ }
23
+ export interface PaymentCustomer {
24
+ email?: string | undefined;
25
+ givenName: string;
26
+ familyName: string;
27
+ address?: PaymentAddress | undefined;
28
+ }
29
+ export interface Payment {
30
+ id: string;
31
+ status: PaymentStatus;
32
+ checkoutUrl?: string | undefined;
33
+ expiresAt?: string | undefined;
34
+ }
35
+ export interface CreatePaymentRequest {
36
+ referenceId: string;
37
+ userId: string;
38
+ amount: number;
39
+ currency: string;
40
+ description: string;
41
+ customer: PaymentCustomer | undefined;
42
+ language: string;
43
+ redirectUrl: string;
44
+ }
45
+ export interface CreatePaymentResponse {
46
+ payment: Payment | undefined;
47
+ }
48
+ export interface GetPaymentRequest {
49
+ id: string;
50
+ }
51
+ export interface GetPaymentResponse {
52
+ payment: Payment | undefined;
53
+ }
54
+ export interface HandleWebhookRequest {
55
+ provider: PaymentProvider;
56
+ payload: string;
57
+ signature?: string | undefined;
58
+ }
59
+ export interface HandleWebhookResponse {
60
+ ok: boolean;
61
+ }
62
+ export interface PaymentService {
63
+ createPayment(request: CreatePaymentRequest): Promise<CreatePaymentResponse>;
64
+ getPayment(request: GetPaymentRequest): Promise<GetPaymentResponse>;
65
+ handleWebhook(request: HandleWebhookRequest): Promise<HandleWebhookResponse>;
66
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.15.3
5
+ // protoc v3.21.12
6
+ // source: payment.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.PaymentProvider = exports.PaymentStatus = exports.protobufPackage = void 0;
9
+ /* eslint-disable */
10
+ exports.protobufPackage = "payment.v1";
11
+ var PaymentStatus;
12
+ (function (PaymentStatus) {
13
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_UNSPECIFIED"] = 0] = "PAYMENT_STATUS_UNSPECIFIED";
14
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_OPEN"] = 1] = "PAYMENT_STATUS_OPEN";
15
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_PENDING"] = 2] = "PAYMENT_STATUS_PENDING";
16
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_PAID"] = 3] = "PAYMENT_STATUS_PAID";
17
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_CANCELED"] = 4] = "PAYMENT_STATUS_CANCELED";
18
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_EXPIRED"] = 5] = "PAYMENT_STATUS_EXPIRED";
19
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_FAILED"] = 6] = "PAYMENT_STATUS_FAILED";
20
+ PaymentStatus[PaymentStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
21
+ })(PaymentStatus || (exports.PaymentStatus = PaymentStatus = {}));
22
+ var PaymentProvider;
23
+ (function (PaymentProvider) {
24
+ PaymentProvider[PaymentProvider["PAYMENT_PROVIDER_UNSPECIFIED"] = 0] = "PAYMENT_PROVIDER_UNSPECIFIED";
25
+ PaymentProvider[PaymentProvider["PAYMENT_PROVIDER_MOLLIE"] = 1] = "PAYMENT_PROVIDER_MOLLIE";
26
+ PaymentProvider[PaymentProvider["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
27
+ })(PaymentProvider || (exports.PaymentProvider = PaymentProvider = {}));
@@ -41,6 +41,8 @@ export declare enum TreatmentType {
41
41
  export declare enum TreatmentRequestStatus {
42
42
  TREATMENT_REQUEST_STATUS_UNSPECIFIED = 0,
43
43
  TREATMENT_REQUEST_STATUS_UNPAID = 1,
44
+ TREATMENT_REQUEST_STATUS_PAYMENT_PENDING = 2,
45
+ TREATMENT_REQUEST_STATUS_PAID = 3,
44
46
  UNRECOGNIZED = -1
45
47
  }
46
48
  export interface QuestionnaireAnswers {
@@ -87,6 +89,7 @@ export interface TreatmentRequest {
87
89
  expiresAt?: string | undefined;
88
90
  createdAt: string;
89
91
  medicationWish: string;
92
+ paidAt?: string | undefined;
90
93
  }
91
94
  export interface GetQuestionnaireRequest {
92
95
  userId: string;
@@ -145,6 +148,14 @@ export interface DeleteTreatmentRequestRequest {
145
148
  }
146
149
  export interface DeleteTreatmentRequestResponse {
147
150
  }
151
+ export interface StartPaymentRequest {
152
+ userId: string;
153
+ id: string;
154
+ language: string;
155
+ }
156
+ export interface StartPaymentResponse {
157
+ checkoutUrl: string;
158
+ }
148
159
  export interface TreatmentService {
149
160
  getQuestionnaire(request: GetQuestionnaireRequest): Promise<GetQuestionnaireResponse>;
150
161
  saveQuestionnaire(request: SaveQuestionnaireRequest): Promise<SaveQuestionnaireResponse>;
@@ -154,4 +165,5 @@ export interface TreatmentService {
154
165
  listTreatmentRequests(request: ListTreatmentRequestsRequest): Promise<ListTreatmentRequestsResponse>;
155
166
  updateTreatmentRequest(request: UpdateTreatmentRequestRequest): Promise<UpdateTreatmentRequestResponse>;
156
167
  deleteTreatmentRequest(request: DeleteTreatmentRequestRequest): Promise<DeleteTreatmentRequestResponse>;
168
+ startPayment(request: StartPaymentRequest): Promise<StartPaymentResponse>;
157
169
  }
@@ -56,5 +56,7 @@ var TreatmentRequestStatus;
56
56
  (function (TreatmentRequestStatus) {
57
57
  TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_UNSPECIFIED"] = 0] = "TREATMENT_REQUEST_STATUS_UNSPECIFIED";
58
58
  TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_UNPAID"] = 1] = "TREATMENT_REQUEST_STATUS_UNPAID";
59
+ TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_PAYMENT_PENDING"] = 2] = "TREATMENT_REQUEST_STATUS_PAYMENT_PENDING";
60
+ TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_PAID"] = 3] = "TREATMENT_REQUEST_STATUS_PAID";
59
61
  TreatmentRequestStatus[TreatmentRequestStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
60
62
  })(TreatmentRequestStatus || (exports.TreatmentRequestStatus = TreatmentRequestStatus = {}));
@@ -0,0 +1,75 @@
1
+ import { Observable } from "rxjs";
2
+ export declare const protobufPackage = "payment.v1";
3
+ export declare enum PaymentStatus {
4
+ PAYMENT_STATUS_UNSPECIFIED = 0,
5
+ PAYMENT_STATUS_OPEN = 1,
6
+ PAYMENT_STATUS_PENDING = 2,
7
+ PAYMENT_STATUS_PAID = 3,
8
+ PAYMENT_STATUS_CANCELED = 4,
9
+ PAYMENT_STATUS_EXPIRED = 5,
10
+ PAYMENT_STATUS_FAILED = 6,
11
+ UNRECOGNIZED = -1
12
+ }
13
+ export declare enum PaymentProvider {
14
+ PAYMENT_PROVIDER_UNSPECIFIED = 0,
15
+ PAYMENT_PROVIDER_MOLLIE = 1,
16
+ UNRECOGNIZED = -1
17
+ }
18
+ export interface PaymentAddress {
19
+ streetAndNumber: string;
20
+ postalCode: string;
21
+ city: string;
22
+ country: string;
23
+ }
24
+ export interface PaymentCustomer {
25
+ email?: string | undefined;
26
+ givenName: string;
27
+ familyName: string;
28
+ address?: PaymentAddress | undefined;
29
+ }
30
+ export interface Payment {
31
+ id: string;
32
+ status: PaymentStatus;
33
+ checkoutUrl?: string | undefined;
34
+ expiresAt?: string | undefined;
35
+ }
36
+ export interface CreatePaymentRequest {
37
+ referenceId: string;
38
+ userId: string;
39
+ amount: number;
40
+ currency: string;
41
+ description: string;
42
+ customer: PaymentCustomer | undefined;
43
+ language: string;
44
+ redirectUrl: string;
45
+ }
46
+ export interface CreatePaymentResponse {
47
+ payment: Payment | undefined;
48
+ }
49
+ export interface GetPaymentRequest {
50
+ id: string;
51
+ }
52
+ export interface GetPaymentResponse {
53
+ payment: Payment | undefined;
54
+ }
55
+ export interface HandleWebhookRequest {
56
+ provider: PaymentProvider;
57
+ payload: string;
58
+ signature?: string | undefined;
59
+ }
60
+ export interface HandleWebhookResponse {
61
+ ok: boolean;
62
+ }
63
+ export declare const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
64
+ export interface PaymentServiceClient {
65
+ createPayment(request: CreatePaymentRequest): Observable<CreatePaymentResponse>;
66
+ getPayment(request: GetPaymentRequest): Observable<GetPaymentResponse>;
67
+ handleWebhook(request: HandleWebhookRequest): Observable<HandleWebhookResponse>;
68
+ }
69
+ export interface PaymentServiceController {
70
+ createPayment(request: CreatePaymentRequest): Promise<CreatePaymentResponse> | Observable<CreatePaymentResponse> | CreatePaymentResponse;
71
+ getPayment(request: GetPaymentRequest): Promise<GetPaymentResponse> | Observable<GetPaymentResponse> | GetPaymentResponse;
72
+ handleWebhook(request: HandleWebhookRequest): Promise<HandleWebhookResponse> | Observable<HandleWebhookResponse> | HandleWebhookResponse;
73
+ }
74
+ export declare function PaymentServiceControllerMethods(): (constructor: Function) => void;
75
+ export declare const PAYMENT_SERVICE_NAME = "PaymentService";
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.15.3
5
+ // protoc v3.21.12
6
+ // source: payment.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.PAYMENT_SERVICE_NAME = exports.PAYMENT_V1_PACKAGE_NAME = exports.PaymentProvider = exports.PaymentStatus = exports.protobufPackage = void 0;
9
+ exports.PaymentServiceControllerMethods = PaymentServiceControllerMethods;
10
+ /* eslint-disable */
11
+ const microservices_1 = require("@nestjs/microservices");
12
+ exports.protobufPackage = "payment.v1";
13
+ var PaymentStatus;
14
+ (function (PaymentStatus) {
15
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_UNSPECIFIED"] = 0] = "PAYMENT_STATUS_UNSPECIFIED";
16
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_OPEN"] = 1] = "PAYMENT_STATUS_OPEN";
17
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_PENDING"] = 2] = "PAYMENT_STATUS_PENDING";
18
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_PAID"] = 3] = "PAYMENT_STATUS_PAID";
19
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_CANCELED"] = 4] = "PAYMENT_STATUS_CANCELED";
20
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_EXPIRED"] = 5] = "PAYMENT_STATUS_EXPIRED";
21
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_FAILED"] = 6] = "PAYMENT_STATUS_FAILED";
22
+ PaymentStatus[PaymentStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
23
+ })(PaymentStatus || (exports.PaymentStatus = PaymentStatus = {}));
24
+ var PaymentProvider;
25
+ (function (PaymentProvider) {
26
+ PaymentProvider[PaymentProvider["PAYMENT_PROVIDER_UNSPECIFIED"] = 0] = "PAYMENT_PROVIDER_UNSPECIFIED";
27
+ PaymentProvider[PaymentProvider["PAYMENT_PROVIDER_MOLLIE"] = 1] = "PAYMENT_PROVIDER_MOLLIE";
28
+ PaymentProvider[PaymentProvider["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
29
+ })(PaymentProvider || (exports.PaymentProvider = PaymentProvider = {}));
30
+ exports.PAYMENT_V1_PACKAGE_NAME = "payment.v1";
31
+ function PaymentServiceControllerMethods() {
32
+ return function (constructor) {
33
+ const grpcMethods = ["createPayment", "getPayment", "handleWebhook"];
34
+ for (const method of grpcMethods) {
35
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
36
+ (0, microservices_1.GrpcMethod)("PaymentService", method)(constructor.prototype[method], method, descriptor);
37
+ Object.defineProperty(constructor.prototype, method, descriptor);
38
+ }
39
+ const grpcStreamMethods = [];
40
+ for (const method of grpcStreamMethods) {
41
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
42
+ (0, microservices_1.GrpcStreamMethod)("PaymentService", method)(constructor.prototype[method], method, descriptor);
43
+ Object.defineProperty(constructor.prototype, method, descriptor);
44
+ }
45
+ };
46
+ }
47
+ exports.PAYMENT_SERVICE_NAME = "PaymentService";
@@ -42,6 +42,8 @@ export declare enum TreatmentType {
42
42
  export declare enum TreatmentRequestStatus {
43
43
  TREATMENT_REQUEST_STATUS_UNSPECIFIED = 0,
44
44
  TREATMENT_REQUEST_STATUS_UNPAID = 1,
45
+ TREATMENT_REQUEST_STATUS_PAYMENT_PENDING = 2,
46
+ TREATMENT_REQUEST_STATUS_PAID = 3,
45
47
  UNRECOGNIZED = -1
46
48
  }
47
49
  export interface QuestionnaireAnswers {
@@ -88,6 +90,7 @@ export interface TreatmentRequest {
88
90
  expiresAt?: string | undefined;
89
91
  createdAt: string;
90
92
  medicationWish: string;
93
+ paidAt?: string | undefined;
91
94
  }
92
95
  export interface GetQuestionnaireRequest {
93
96
  userId: string;
@@ -146,6 +149,14 @@ export interface DeleteTreatmentRequestRequest {
146
149
  }
147
150
  export interface DeleteTreatmentRequestResponse {
148
151
  }
152
+ export interface StartPaymentRequest {
153
+ userId: string;
154
+ id: string;
155
+ language: string;
156
+ }
157
+ export interface StartPaymentResponse {
158
+ checkoutUrl: string;
159
+ }
149
160
  export declare const TREATMENT_V1_PACKAGE_NAME = "treatment.v1";
150
161
  export interface TreatmentServiceClient {
151
162
  getQuestionnaire(request: GetQuestionnaireRequest): Observable<GetQuestionnaireResponse>;
@@ -156,6 +167,7 @@ export interface TreatmentServiceClient {
156
167
  listTreatmentRequests(request: ListTreatmentRequestsRequest): Observable<ListTreatmentRequestsResponse>;
157
168
  updateTreatmentRequest(request: UpdateTreatmentRequestRequest): Observable<UpdateTreatmentRequestResponse>;
158
169
  deleteTreatmentRequest(request: DeleteTreatmentRequestRequest): Observable<DeleteTreatmentRequestResponse>;
170
+ startPayment(request: StartPaymentRequest): Observable<StartPaymentResponse>;
159
171
  }
160
172
  export interface TreatmentServiceController {
161
173
  getQuestionnaire(request: GetQuestionnaireRequest): Promise<GetQuestionnaireResponse> | Observable<GetQuestionnaireResponse> | GetQuestionnaireResponse;
@@ -166,6 +178,7 @@ export interface TreatmentServiceController {
166
178
  listTreatmentRequests(request: ListTreatmentRequestsRequest): Promise<ListTreatmentRequestsResponse> | Observable<ListTreatmentRequestsResponse> | ListTreatmentRequestsResponse;
167
179
  updateTreatmentRequest(request: UpdateTreatmentRequestRequest): Promise<UpdateTreatmentRequestResponse> | Observable<UpdateTreatmentRequestResponse> | UpdateTreatmentRequestResponse;
168
180
  deleteTreatmentRequest(request: DeleteTreatmentRequestRequest): Promise<DeleteTreatmentRequestResponse> | Observable<DeleteTreatmentRequestResponse> | DeleteTreatmentRequestResponse;
181
+ startPayment(request: StartPaymentRequest): Promise<StartPaymentResponse> | Observable<StartPaymentResponse> | StartPaymentResponse;
169
182
  }
170
183
  export declare function TreatmentServiceControllerMethods(): (constructor: Function) => void;
171
184
  export declare const TREATMENT_SERVICE_NAME = "TreatmentService";
@@ -58,6 +58,8 @@ var TreatmentRequestStatus;
58
58
  (function (TreatmentRequestStatus) {
59
59
  TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_UNSPECIFIED"] = 0] = "TREATMENT_REQUEST_STATUS_UNSPECIFIED";
60
60
  TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_UNPAID"] = 1] = "TREATMENT_REQUEST_STATUS_UNPAID";
61
+ TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_PAYMENT_PENDING"] = 2] = "TREATMENT_REQUEST_STATUS_PAYMENT_PENDING";
62
+ TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_PAID"] = 3] = "TREATMENT_REQUEST_STATUS_PAID";
61
63
  TreatmentRequestStatus[TreatmentRequestStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
62
64
  })(TreatmentRequestStatus || (exports.TreatmentRequestStatus = TreatmentRequestStatus = {}));
63
65
  exports.TREATMENT_V1_PACKAGE_NAME = "treatment.v1";
@@ -72,6 +74,7 @@ function TreatmentServiceControllerMethods() {
72
74
  "listTreatmentRequests",
73
75
  "updateTreatmentRequest",
74
76
  "deleteTreatmentRequest",
77
+ "startPayment",
75
78
  ];
76
79
  for (const method of grpcMethods) {
77
80
  const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
@@ -5,4 +5,5 @@ export declare const PROTO_PATHS: {
5
5
  readonly MEDIA: string;
6
6
  readonly KYC: string;
7
7
  readonly TREATMENT: string;
8
+ readonly PAYMENT: string;
8
9
  };
@@ -8,5 +8,6 @@ exports.PROTO_PATHS = {
8
8
  USER: (0, path_1.join)(__dirname, '../../proto/user.proto'),
9
9
  MEDIA: (0, path_1.join)(__dirname, '../../proto/media.proto'),
10
10
  KYC: (0, path_1.join)(__dirname, '../../proto/kyc.proto'),
11
- TREATMENT: (0, path_1.join)(__dirname, '../../proto/treatment.proto')
11
+ TREATMENT: (0, path_1.join)(__dirname, '../../proto/treatment.proto'),
12
+ PAYMENT: (0, path_1.join)(__dirname, '../../proto/payment.proto')
12
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@candesk/contracts",
3
- "version": "6.12.0",
3
+ "version": "6.13.0",
4
4
  "description": "Protobuf contracts for CanDesk microservices",
5
5
  "author": {
6
6
  "name": "Alexander Schulz",
@@ -0,0 +1,78 @@
1
+ syntax = "proto3";
2
+
3
+ package payment.v1;
4
+
5
+ service PaymentService {
6
+ rpc CreatePayment (CreatePaymentRequest) returns (CreatePaymentResponse);
7
+ rpc GetPayment (GetPaymentRequest) returns (GetPaymentResponse);
8
+ rpc HandleWebhook (HandleWebhookRequest) returns (HandleWebhookResponse);
9
+ }
10
+
11
+ enum PaymentStatus {
12
+ PAYMENT_STATUS_UNSPECIFIED = 0;
13
+ PAYMENT_STATUS_OPEN = 1;
14
+ PAYMENT_STATUS_PENDING = 2;
15
+ PAYMENT_STATUS_PAID = 3;
16
+ PAYMENT_STATUS_CANCELED = 4;
17
+ PAYMENT_STATUS_EXPIRED = 5;
18
+ PAYMENT_STATUS_FAILED = 6;
19
+ }
20
+
21
+ enum PaymentProvider {
22
+ PAYMENT_PROVIDER_UNSPECIFIED = 0;
23
+ PAYMENT_PROVIDER_MOLLIE = 1;
24
+ }
25
+
26
+ message PaymentAddress {
27
+ string street_and_number = 1;
28
+ string postal_code = 2;
29
+ string city = 3;
30
+ string country = 4;
31
+ }
32
+
33
+ message PaymentCustomer {
34
+ optional string email = 1;
35
+ string given_name = 2;
36
+ string family_name = 3;
37
+ optional PaymentAddress address = 4;
38
+ }
39
+
40
+ message Payment {
41
+ string id = 1;
42
+ PaymentStatus status = 2;
43
+ optional string checkout_url = 3;
44
+ optional string expires_at = 4;
45
+ }
46
+
47
+ message CreatePaymentRequest {
48
+ string reference_id = 1;
49
+ string user_id = 2;
50
+ int32 amount = 3;
51
+ string currency = 4;
52
+ string description = 5;
53
+ PaymentCustomer customer = 6;
54
+ string language = 7;
55
+ string redirect_url = 8;
56
+ }
57
+
58
+ message CreatePaymentResponse {
59
+ Payment payment = 1;
60
+ }
61
+
62
+ message GetPaymentRequest {
63
+ string id = 1;
64
+ }
65
+
66
+ message GetPaymentResponse {
67
+ Payment payment = 1;
68
+ }
69
+
70
+ message HandleWebhookRequest {
71
+ PaymentProvider provider = 1;
72
+ string payload = 2;
73
+ optional string signature = 3;
74
+ }
75
+
76
+ message HandleWebhookResponse {
77
+ bool ok = 1;
78
+ }
@@ -11,6 +11,7 @@ service TreatmentService {
11
11
  rpc ListTreatmentRequests (ListTreatmentRequestsRequest) returns (ListTreatmentRequestsResponse);
12
12
  rpc UpdateTreatmentRequest (UpdateTreatmentRequestRequest) returns (UpdateTreatmentRequestResponse);
13
13
  rpc DeleteTreatmentRequest (DeleteTreatmentRequestRequest) returns (DeleteTreatmentRequestResponse);
14
+ rpc StartPayment (StartPaymentRequest) returns (StartPaymentResponse);
14
15
  }
15
16
 
16
17
  enum QuestionnaireStatus {
@@ -55,6 +56,8 @@ enum TreatmentType {
55
56
  enum TreatmentRequestStatus {
56
57
  TREATMENT_REQUEST_STATUS_UNSPECIFIED = 0;
57
58
  TREATMENT_REQUEST_STATUS_UNPAID = 1;
59
+ TREATMENT_REQUEST_STATUS_PAYMENT_PENDING = 2;
60
+ TREATMENT_REQUEST_STATUS_PAID = 3;
58
61
  }
59
62
 
60
63
  message QuestionnaireAnswers {
@@ -104,6 +107,7 @@ message TreatmentRequest {
104
107
  optional string expires_at = 7;
105
108
  string created_at = 8;
106
109
  string medication_wish = 9;
110
+ optional string paid_at = 10;
107
111
  }
108
112
 
109
113
  message GetQuestionnaireRequest {
@@ -176,3 +180,13 @@ message DeleteTreatmentRequestRequest {
176
180
  }
177
181
 
178
182
  message DeleteTreatmentRequestResponse {}
183
+
184
+ message StartPaymentRequest {
185
+ string user_id = 1;
186
+ string id = 2;
187
+ string language = 3;
188
+ }
189
+
190
+ message StartPaymentResponse {
191
+ string checkout_url = 1;
192
+ }