@candesk/contracts 6.67.0 → 6.68.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.
Files changed (29) hide show
  1. package/dist/events/payment/index.d.ts +2 -0
  2. package/dist/events/payment/index.js +2 -0
  3. package/dist/events/payment/payment-refund-failed.interface.d.ts +6 -0
  4. package/dist/events/payment/payment-refund-failed.interface.js +2 -0
  5. package/dist/events/payment/payment-refunded.interface.d.ts +5 -0
  6. package/dist/events/payment/payment-refunded.interface.js +2 -0
  7. package/dist/events/payment/payment.events.d.ts +2 -0
  8. package/dist/events/payment/payment.events.js +3 -1
  9. package/dist/events/treatment/index.d.ts +3 -0
  10. package/dist/events/treatment/index.js +3 -0
  11. package/dist/events/treatment/treatment-request-refunded.interface.d.ts +6 -0
  12. package/dist/events/treatment/treatment-request-refunded.interface.js +2 -0
  13. package/dist/events/treatment/treatment.events.d.ts +3 -0
  14. package/dist/events/treatment/treatment.events.js +4 -1
  15. package/dist/events/treatment/withdrawal-received.interface.d.ts +7 -0
  16. package/dist/events/treatment/withdrawal-received.interface.js +2 -0
  17. package/dist/events/treatment/withdrawal-rejected.interface.d.ts +10 -0
  18. package/dist/events/treatment/withdrawal-rejected.interface.js +2 -0
  19. package/dist/gen/payment.d.ts +25 -0
  20. package/dist/gen/payment.js +11 -1
  21. package/dist/gen/treatment.d.ts +80 -0
  22. package/dist/gen/treatment.js +21 -1
  23. package/dist/nest/payment.d.ts +26 -0
  24. package/dist/nest/payment.js +12 -2
  25. package/dist/nest/treatment.d.ts +85 -0
  26. package/dist/nest/treatment.js +26 -1
  27. package/package.json +1 -1
  28. package/proto/payment.proto +28 -0
  29. package/proto/treatment.proto +91 -0
@@ -1,3 +1,5 @@
1
1
  export * from './payment.events';
2
2
  export * from './payment-failed.interface';
3
3
  export * from './payment-paid.interface';
4
+ export * from './payment-refund-failed.interface';
5
+ export * from './payment-refunded.interface';
@@ -17,3 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./payment.events"), exports);
18
18
  __exportStar(require("./payment-failed.interface"), exports);
19
19
  __exportStar(require("./payment-paid.interface"), exports);
20
+ __exportStar(require("./payment-refund-failed.interface"), exports);
21
+ __exportStar(require("./payment-refunded.interface"), exports);
@@ -0,0 +1,6 @@
1
+ export type PaymentRefundFailureReason = 'CANCELED' | 'FAILED';
2
+ export interface PaymentRefundFailedEvent {
3
+ paymentId: string;
4
+ referenceId: string;
5
+ reason: PaymentRefundFailureReason;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export interface PaymentRefundedEvent {
2
+ paymentId: string;
3
+ referenceId: string;
4
+ refundedAt: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,6 @@
1
1
  export declare const PAYMENT_EVENTS: {
2
2
  readonly PAYMENT_PAID: 'payment.paid';
3
3
  readonly PAYMENT_FAILED: 'payment.failed';
4
+ readonly PAYMENT_REFUNDED: 'payment.refunded';
5
+ readonly PAYMENT_REFUND_FAILED: 'payment.refund.failed';
4
6
  };
@@ -3,5 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PAYMENT_EVENTS = void 0;
4
4
  exports.PAYMENT_EVENTS = {
5
5
  PAYMENT_PAID: 'payment.paid',
6
- PAYMENT_FAILED: 'payment.failed'
6
+ PAYMENT_FAILED: 'payment.failed',
7
+ PAYMENT_REFUNDED: 'payment.refunded',
8
+ PAYMENT_REFUND_FAILED: 'payment.refund.failed'
7
9
  };
@@ -2,3 +2,6 @@ export * from './medication-wish-changed.interface';
2
2
  export * from './treatment.events';
3
3
  export * from './treatment-request-expired.interface';
4
4
  export * from './treatment-request-paid.interface';
5
+ export * from './treatment-request-refunded.interface';
6
+ export * from './withdrawal-received.interface';
7
+ export * from './withdrawal-rejected.interface';
@@ -18,3 +18,6 @@ __exportStar(require("./medication-wish-changed.interface"), exports);
18
18
  __exportStar(require("./treatment.events"), exports);
19
19
  __exportStar(require("./treatment-request-expired.interface"), exports);
20
20
  __exportStar(require("./treatment-request-paid.interface"), exports);
21
+ __exportStar(require("./treatment-request-refunded.interface"), exports);
22
+ __exportStar(require("./withdrawal-received.interface"), exports);
23
+ __exportStar(require("./withdrawal-rejected.interface"), exports);
@@ -0,0 +1,6 @@
1
+ export interface TreatmentRequestRefundedEvent {
2
+ email: string;
3
+ number: string;
4
+ amount: number;
5
+ currency: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,4 +2,7 @@ export declare const TREATMENT_EVENTS: {
2
2
  readonly REQUEST_PAID: 'treatment.request.paid';
3
3
  readonly REQUEST_EXPIRED: 'treatment.request.expired';
4
4
  readonly MEDICATION_WISH_CHANGED: 'treatment.medication-wish.changed';
5
+ readonly WITHDRAWAL_RECEIVED: 'treatment.withdrawal.received';
6
+ readonly WITHDRAWAL_REJECTED: 'treatment.withdrawal.rejected';
7
+ readonly REQUEST_REFUNDED: 'treatment.request.refunded';
5
8
  };
@@ -4,5 +4,8 @@ exports.TREATMENT_EVENTS = void 0;
4
4
  exports.TREATMENT_EVENTS = {
5
5
  REQUEST_PAID: 'treatment.request.paid',
6
6
  REQUEST_EXPIRED: 'treatment.request.expired',
7
- MEDICATION_WISH_CHANGED: 'treatment.medication-wish.changed'
7
+ MEDICATION_WISH_CHANGED: 'treatment.medication-wish.changed',
8
+ WITHDRAWAL_RECEIVED: 'treatment.withdrawal.received',
9
+ WITHDRAWAL_REJECTED: 'treatment.withdrawal.rejected',
10
+ REQUEST_REFUNDED: 'treatment.request.refunded'
8
11
  };
@@ -0,0 +1,7 @@
1
+ export interface WithdrawalReceivedEvent {
2
+ email: string;
3
+ firstName: string;
4
+ lastName: string;
5
+ number: string;
6
+ receivedAt: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ export type WithdrawalRejectionReasonName = 'DEADLINE_PASSED' | 'SERVICE_COMPLETED' | 'OTHER';
2
+ export interface WithdrawalRejectedEvent {
3
+ email: string;
4
+ firstName: string;
5
+ number: string;
6
+ reason: WithdrawalRejectionReasonName;
7
+ text?: string;
8
+ receivedAt: string;
9
+ deadlineAt: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -15,6 +15,15 @@ export declare enum PaymentProvider {
15
15
  PAYMENT_PROVIDER_MOLLIE = 1,
16
16
  UNRECOGNIZED = -1
17
17
  }
18
+ export declare enum RefundStatus {
19
+ REFUND_STATUS_UNSPECIFIED = 0,
20
+ REFUND_STATUS_QUEUED = 1,
21
+ REFUND_STATUS_PENDING = 2,
22
+ REFUND_STATUS_REFUNDED = 3,
23
+ REFUND_STATUS_FAILED = 4,
24
+ REFUND_STATUS_CANCELED = 5,
25
+ UNRECOGNIZED = -1
26
+ }
18
27
  export interface PaymentAddress {
19
28
  streetAndNumber: string;
20
29
  postalCode: string;
@@ -27,6 +36,14 @@ export interface PaymentCustomer {
27
36
  familyName: string;
28
37
  address?: PaymentAddress | undefined;
29
38
  }
39
+ export interface Refund {
40
+ id: string;
41
+ status: RefundStatus;
42
+ amount: number;
43
+ currency: string;
44
+ createdAt: string;
45
+ refundedAt?: string | undefined;
46
+ }
30
47
  export interface Payment {
31
48
  id: string;
32
49
  status: PaymentStatus;
@@ -38,6 +55,7 @@ export interface Payment {
38
55
  currency: string;
39
56
  createdAt: string;
40
57
  paidAt?: string | undefined;
58
+ refunds: Refund[];
41
59
  }
42
60
  export interface CreatePaymentRequest {
43
61
  referenceId: string;
@@ -72,9 +90,16 @@ export interface HandleWebhookRequest {
72
90
  export interface HandleWebhookResponse {
73
91
  ok: boolean;
74
92
  }
93
+ export interface RefundPaymentRequest {
94
+ id: string;
95
+ }
96
+ export interface RefundPaymentResponse {
97
+ refund: Refund | undefined;
98
+ }
75
99
  export interface PaymentService {
76
100
  createPayment(request: CreatePaymentRequest): Promise<CreatePaymentResponse>;
77
101
  getPayment(request: GetPaymentRequest): Promise<GetPaymentResponse>;
78
102
  listPayments(request: ListPaymentsRequest): Promise<ListPaymentsResponse>;
79
103
  handleWebhook(request: HandleWebhookRequest): Promise<HandleWebhookResponse>;
104
+ refundPayment(request: RefundPaymentRequest): Promise<RefundPaymentResponse>;
80
105
  }
@@ -5,7 +5,7 @@
5
5
  // protoc v3.21.12
6
6
  // source: payment.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.PaymentProvider = exports.PaymentStatus = exports.protobufFileName = exports.protobufPackage = void 0;
8
+ exports.RefundStatus = exports.PaymentProvider = exports.PaymentStatus = exports.protobufFileName = exports.protobufPackage = void 0;
9
9
  /* eslint-disable */
10
10
  exports.protobufPackage = "payment.v1";
11
11
  exports.protobufFileName = "payment.proto";
@@ -26,3 +26,13 @@ var PaymentProvider;
26
26
  PaymentProvider[PaymentProvider["PAYMENT_PROVIDER_MOLLIE"] = 1] = "PAYMENT_PROVIDER_MOLLIE";
27
27
  PaymentProvider[PaymentProvider["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
28
28
  })(PaymentProvider || (exports.PaymentProvider = PaymentProvider = {}));
29
+ var RefundStatus;
30
+ (function (RefundStatus) {
31
+ RefundStatus[RefundStatus["REFUND_STATUS_UNSPECIFIED"] = 0] = "REFUND_STATUS_UNSPECIFIED";
32
+ RefundStatus[RefundStatus["REFUND_STATUS_QUEUED"] = 1] = "REFUND_STATUS_QUEUED";
33
+ RefundStatus[RefundStatus["REFUND_STATUS_PENDING"] = 2] = "REFUND_STATUS_PENDING";
34
+ RefundStatus[RefundStatus["REFUND_STATUS_REFUNDED"] = 3] = "REFUND_STATUS_REFUNDED";
35
+ RefundStatus[RefundStatus["REFUND_STATUS_FAILED"] = 4] = "REFUND_STATUS_FAILED";
36
+ RefundStatus[RefundStatus["REFUND_STATUS_CANCELED"] = 5] = "REFUND_STATUS_CANCELED";
37
+ RefundStatus[RefundStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
38
+ })(RefundStatus || (exports.RefundStatus = RefundStatus = {}));
@@ -50,6 +50,24 @@ export declare enum TreatmentRequestStatus {
50
50
  TREATMENT_REQUEST_STATUS_UNPAID = 1,
51
51
  TREATMENT_REQUEST_STATUS_PAYMENT_PENDING = 2,
52
52
  TREATMENT_REQUEST_STATUS_PAID = 3,
53
+ TREATMENT_REQUEST_STATUS_WITHDRAWN = 4,
54
+ TREATMENT_REQUEST_STATUS_REFUND_PENDING = 5,
55
+ TREATMENT_REQUEST_STATUS_REFUND_FAILED = 6,
56
+ TREATMENT_REQUEST_STATUS_REFUNDED = 7,
57
+ UNRECOGNIZED = -1
58
+ }
59
+ export declare enum WithdrawalStatus {
60
+ WITHDRAWAL_STATUS_UNSPECIFIED = 0,
61
+ WITHDRAWAL_STATUS_OPEN = 1,
62
+ WITHDRAWAL_STATUS_APPROVED = 2,
63
+ WITHDRAWAL_STATUS_REJECTED = 3,
64
+ UNRECOGNIZED = -1
65
+ }
66
+ export declare enum WithdrawalRejectionReason {
67
+ WITHDRAWAL_REJECTION_REASON_UNSPECIFIED = 0,
68
+ WITHDRAWAL_REJECTION_REASON_DEADLINE_PASSED = 1,
69
+ WITHDRAWAL_REJECTION_REASON_SERVICE_COMPLETED = 2,
70
+ WITHDRAWAL_REJECTION_REASON_OTHER = 3,
53
71
  UNRECOGNIZED = -1
54
72
  }
55
73
  export interface MedicationProduct {
@@ -94,6 +112,19 @@ export interface TreatmentTypeOption {
94
112
  currency: string;
95
113
  available: boolean;
96
114
  }
115
+ export interface Withdrawal {
116
+ id: string;
117
+ requestId: string;
118
+ firstName: string;
119
+ lastName: string;
120
+ email: string;
121
+ isLate: boolean;
122
+ status: WithdrawalStatus;
123
+ rejectionReason?: WithdrawalRejectionReason | undefined;
124
+ rejectionText?: string | undefined;
125
+ receivedAt: string;
126
+ decidedAt?: string | undefined;
127
+ }
97
128
  export interface TreatmentRequest {
98
129
  id: string;
99
130
  number: string;
@@ -109,6 +140,8 @@ export interface TreatmentRequest {
109
140
  withdrawalWaiverAt?: string | undefined;
110
141
  medicationProducts: MedicationProduct[];
111
142
  intakeMethods: IntakeMethod[];
143
+ refundedAt?: string | undefined;
144
+ withdrawal?: Withdrawal | undefined;
112
145
  }
113
146
  export interface GetQuestionnaireRequest {
114
147
  userId: string;
@@ -211,6 +244,48 @@ export interface ListProductRequestersRequest {
211
244
  export interface ListProductRequestersResponse {
212
245
  userIds: string[];
213
246
  }
247
+ export interface SubmitWithdrawalRequest {
248
+ firstName: string;
249
+ lastName: string;
250
+ email: string;
251
+ number: string;
252
+ }
253
+ export interface SubmitWithdrawalResponse {
254
+ receivedAt: string;
255
+ }
256
+ export interface WithdrawalItem {
257
+ withdrawal: Withdrawal | undefined;
258
+ request: TreatmentRequest | undefined;
259
+ }
260
+ export interface ListWithdrawalsRequest {
261
+ pending: boolean;
262
+ cursor?: string | undefined;
263
+ limit: number;
264
+ }
265
+ export interface ListWithdrawalsResponse {
266
+ items: WithdrawalItem[];
267
+ nextCursor?: string | undefined;
268
+ total: number;
269
+ }
270
+ export interface CountPendingWithdrawalsRequest {
271
+ }
272
+ export interface CountPendingWithdrawalsResponse {
273
+ count: number;
274
+ }
275
+ export interface RefundWithdrawalRequest {
276
+ id: string;
277
+ }
278
+ export interface RefundWithdrawalResponse {
279
+ item: WithdrawalItem | undefined;
280
+ }
281
+ export interface RejectWithdrawalRequest {
282
+ id: string;
283
+ reason: WithdrawalRejectionReason;
284
+ text?: string | undefined;
285
+ }
286
+ export interface RejectWithdrawalResponse {
287
+ item: WithdrawalItem | undefined;
288
+ }
214
289
  export interface TreatmentService {
215
290
  getQuestionnaire(request: GetQuestionnaireRequest): Promise<GetQuestionnaireResponse>;
216
291
  saveQuestionnaire(request: SaveQuestionnaireRequest): Promise<SaveQuestionnaireResponse>;
@@ -225,4 +300,9 @@ export interface TreatmentService {
225
300
  deleteTreatmentRequest(request: DeleteTreatmentRequestRequest): Promise<DeleteTreatmentRequestResponse>;
226
301
  startPayment(request: StartPaymentRequest): Promise<StartPaymentResponse>;
227
302
  listProductRequesters(request: ListProductRequestersRequest): Promise<ListProductRequestersResponse>;
303
+ submitWithdrawal(request: SubmitWithdrawalRequest): Promise<SubmitWithdrawalResponse>;
304
+ listWithdrawals(request: ListWithdrawalsRequest): Promise<ListWithdrawalsResponse>;
305
+ countPendingWithdrawals(request: CountPendingWithdrawalsRequest): Promise<CountPendingWithdrawalsResponse>;
306
+ refundWithdrawal(request: RefundWithdrawalRequest): Promise<RefundWithdrawalResponse>;
307
+ rejectWithdrawal(request: RejectWithdrawalRequest): Promise<RejectWithdrawalResponse>;
228
308
  }
@@ -5,7 +5,7 @@
5
5
  // protoc v3.21.12
6
6
  // source: treatment.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.TreatmentRequestStatus = exports.TreatmentType = exports.ProductType = exports.IntakeMethod = exports.SymptomDuration = exports.Symptom = exports.QuestionnaireStatus = exports.protobufFileName = exports.protobufPackage = void 0;
8
+ exports.WithdrawalRejectionReason = exports.WithdrawalStatus = exports.TreatmentRequestStatus = exports.TreatmentType = exports.ProductType = exports.IntakeMethod = exports.SymptomDuration = exports.Symptom = exports.QuestionnaireStatus = exports.protobufFileName = exports.protobufPackage = void 0;
9
9
  /* eslint-disable */
10
10
  exports.protobufPackage = "treatment.v1";
11
11
  exports.protobufFileName = "treatment.proto";
@@ -66,5 +66,25 @@ var TreatmentRequestStatus;
66
66
  TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_UNPAID"] = 1] = "TREATMENT_REQUEST_STATUS_UNPAID";
67
67
  TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_PAYMENT_PENDING"] = 2] = "TREATMENT_REQUEST_STATUS_PAYMENT_PENDING";
68
68
  TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_PAID"] = 3] = "TREATMENT_REQUEST_STATUS_PAID";
69
+ TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_WITHDRAWN"] = 4] = "TREATMENT_REQUEST_STATUS_WITHDRAWN";
70
+ TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_REFUND_PENDING"] = 5] = "TREATMENT_REQUEST_STATUS_REFUND_PENDING";
71
+ TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_REFUND_FAILED"] = 6] = "TREATMENT_REQUEST_STATUS_REFUND_FAILED";
72
+ TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_REFUNDED"] = 7] = "TREATMENT_REQUEST_STATUS_REFUNDED";
69
73
  TreatmentRequestStatus[TreatmentRequestStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
70
74
  })(TreatmentRequestStatus || (exports.TreatmentRequestStatus = TreatmentRequestStatus = {}));
75
+ var WithdrawalStatus;
76
+ (function (WithdrawalStatus) {
77
+ WithdrawalStatus[WithdrawalStatus["WITHDRAWAL_STATUS_UNSPECIFIED"] = 0] = "WITHDRAWAL_STATUS_UNSPECIFIED";
78
+ WithdrawalStatus[WithdrawalStatus["WITHDRAWAL_STATUS_OPEN"] = 1] = "WITHDRAWAL_STATUS_OPEN";
79
+ WithdrawalStatus[WithdrawalStatus["WITHDRAWAL_STATUS_APPROVED"] = 2] = "WITHDRAWAL_STATUS_APPROVED";
80
+ WithdrawalStatus[WithdrawalStatus["WITHDRAWAL_STATUS_REJECTED"] = 3] = "WITHDRAWAL_STATUS_REJECTED";
81
+ WithdrawalStatus[WithdrawalStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
82
+ })(WithdrawalStatus || (exports.WithdrawalStatus = WithdrawalStatus = {}));
83
+ var WithdrawalRejectionReason;
84
+ (function (WithdrawalRejectionReason) {
85
+ WithdrawalRejectionReason[WithdrawalRejectionReason["WITHDRAWAL_REJECTION_REASON_UNSPECIFIED"] = 0] = "WITHDRAWAL_REJECTION_REASON_UNSPECIFIED";
86
+ WithdrawalRejectionReason[WithdrawalRejectionReason["WITHDRAWAL_REJECTION_REASON_DEADLINE_PASSED"] = 1] = "WITHDRAWAL_REJECTION_REASON_DEADLINE_PASSED";
87
+ WithdrawalRejectionReason[WithdrawalRejectionReason["WITHDRAWAL_REJECTION_REASON_SERVICE_COMPLETED"] = 2] = "WITHDRAWAL_REJECTION_REASON_SERVICE_COMPLETED";
88
+ WithdrawalRejectionReason[WithdrawalRejectionReason["WITHDRAWAL_REJECTION_REASON_OTHER"] = 3] = "WITHDRAWAL_REJECTION_REASON_OTHER";
89
+ WithdrawalRejectionReason[WithdrawalRejectionReason["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
90
+ })(WithdrawalRejectionReason || (exports.WithdrawalRejectionReason = WithdrawalRejectionReason = {}));
@@ -16,6 +16,15 @@ export declare enum PaymentProvider {
16
16
  PAYMENT_PROVIDER_MOLLIE = 1,
17
17
  UNRECOGNIZED = -1
18
18
  }
19
+ export declare enum RefundStatus {
20
+ REFUND_STATUS_UNSPECIFIED = 0,
21
+ REFUND_STATUS_QUEUED = 1,
22
+ REFUND_STATUS_PENDING = 2,
23
+ REFUND_STATUS_REFUNDED = 3,
24
+ REFUND_STATUS_FAILED = 4,
25
+ REFUND_STATUS_CANCELED = 5,
26
+ UNRECOGNIZED = -1
27
+ }
19
28
  export interface PaymentAddress {
20
29
  streetAndNumber: string;
21
30
  postalCode: string;
@@ -28,6 +37,14 @@ export interface PaymentCustomer {
28
37
  familyName: string;
29
38
  address?: PaymentAddress | undefined;
30
39
  }
40
+ export interface Refund {
41
+ id: string;
42
+ status: RefundStatus;
43
+ amount: number;
44
+ currency: string;
45
+ createdAt: string;
46
+ refundedAt?: string | undefined;
47
+ }
31
48
  export interface Payment {
32
49
  id: string;
33
50
  status: PaymentStatus;
@@ -39,6 +56,7 @@ export interface Payment {
39
56
  currency: string;
40
57
  createdAt: string;
41
58
  paidAt?: string | undefined;
59
+ refunds: Refund[];
42
60
  }
43
61
  export interface CreatePaymentRequest {
44
62
  referenceId: string;
@@ -73,18 +91,26 @@ export interface HandleWebhookRequest {
73
91
  export interface HandleWebhookResponse {
74
92
  ok: boolean;
75
93
  }
94
+ export interface RefundPaymentRequest {
95
+ id: string;
96
+ }
97
+ export interface RefundPaymentResponse {
98
+ refund: Refund | undefined;
99
+ }
76
100
  export declare const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
77
101
  export interface PaymentServiceClient {
78
102
  createPayment(request: CreatePaymentRequest): Observable<CreatePaymentResponse>;
79
103
  getPayment(request: GetPaymentRequest): Observable<GetPaymentResponse>;
80
104
  listPayments(request: ListPaymentsRequest): Observable<ListPaymentsResponse>;
81
105
  handleWebhook(request: HandleWebhookRequest): Observable<HandleWebhookResponse>;
106
+ refundPayment(request: RefundPaymentRequest): Observable<RefundPaymentResponse>;
82
107
  }
83
108
  export interface PaymentServiceController {
84
109
  createPayment(request: CreatePaymentRequest): Promise<CreatePaymentResponse> | Observable<CreatePaymentResponse> | CreatePaymentResponse;
85
110
  getPayment(request: GetPaymentRequest): Promise<GetPaymentResponse> | Observable<GetPaymentResponse> | GetPaymentResponse;
86
111
  listPayments(request: ListPaymentsRequest): Promise<ListPaymentsResponse> | Observable<ListPaymentsResponse> | ListPaymentsResponse;
87
112
  handleWebhook(request: HandleWebhookRequest): Promise<HandleWebhookResponse> | Observable<HandleWebhookResponse> | HandleWebhookResponse;
113
+ refundPayment(request: RefundPaymentRequest): Promise<RefundPaymentResponse> | Observable<RefundPaymentResponse> | RefundPaymentResponse;
88
114
  }
89
115
  export declare function PaymentServiceControllerMethods(): (constructor: Function) => void;
90
116
  export declare const PAYMENT_SERVICE_NAME = "PaymentService";
@@ -5,7 +5,7 @@
5
5
  // protoc v3.21.12
6
6
  // source: payment.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.PAYMENT_SERVICE_NAME = exports.PAYMENT_V1_PACKAGE_NAME = exports.PaymentProvider = exports.PaymentStatus = exports.protobufFileName = exports.protobufPackage = void 0;
8
+ exports.PAYMENT_SERVICE_NAME = exports.PAYMENT_V1_PACKAGE_NAME = exports.RefundStatus = exports.PaymentProvider = exports.PaymentStatus = exports.protobufFileName = exports.protobufPackage = void 0;
9
9
  exports.PaymentServiceControllerMethods = PaymentServiceControllerMethods;
10
10
  /* eslint-disable */
11
11
  const microservices_1 = require("@nestjs/microservices");
@@ -28,10 +28,20 @@ var PaymentProvider;
28
28
  PaymentProvider[PaymentProvider["PAYMENT_PROVIDER_MOLLIE"] = 1] = "PAYMENT_PROVIDER_MOLLIE";
29
29
  PaymentProvider[PaymentProvider["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
30
30
  })(PaymentProvider || (exports.PaymentProvider = PaymentProvider = {}));
31
+ var RefundStatus;
32
+ (function (RefundStatus) {
33
+ RefundStatus[RefundStatus["REFUND_STATUS_UNSPECIFIED"] = 0] = "REFUND_STATUS_UNSPECIFIED";
34
+ RefundStatus[RefundStatus["REFUND_STATUS_QUEUED"] = 1] = "REFUND_STATUS_QUEUED";
35
+ RefundStatus[RefundStatus["REFUND_STATUS_PENDING"] = 2] = "REFUND_STATUS_PENDING";
36
+ RefundStatus[RefundStatus["REFUND_STATUS_REFUNDED"] = 3] = "REFUND_STATUS_REFUNDED";
37
+ RefundStatus[RefundStatus["REFUND_STATUS_FAILED"] = 4] = "REFUND_STATUS_FAILED";
38
+ RefundStatus[RefundStatus["REFUND_STATUS_CANCELED"] = 5] = "REFUND_STATUS_CANCELED";
39
+ RefundStatus[RefundStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
40
+ })(RefundStatus || (exports.RefundStatus = RefundStatus = {}));
31
41
  exports.PAYMENT_V1_PACKAGE_NAME = "payment.v1";
32
42
  function PaymentServiceControllerMethods() {
33
43
  return function (constructor) {
34
- const grpcMethods = ["createPayment", "getPayment", "listPayments", "handleWebhook"];
44
+ const grpcMethods = ["createPayment", "getPayment", "listPayments", "handleWebhook", "refundPayment"];
35
45
  for (const method of grpcMethods) {
36
46
  const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
37
47
  (0, microservices_1.GrpcMethod)("PaymentService", method)(constructor.prototype[method], method, descriptor);
@@ -51,6 +51,24 @@ export declare enum TreatmentRequestStatus {
51
51
  TREATMENT_REQUEST_STATUS_UNPAID = 1,
52
52
  TREATMENT_REQUEST_STATUS_PAYMENT_PENDING = 2,
53
53
  TREATMENT_REQUEST_STATUS_PAID = 3,
54
+ TREATMENT_REQUEST_STATUS_WITHDRAWN = 4,
55
+ TREATMENT_REQUEST_STATUS_REFUND_PENDING = 5,
56
+ TREATMENT_REQUEST_STATUS_REFUND_FAILED = 6,
57
+ TREATMENT_REQUEST_STATUS_REFUNDED = 7,
58
+ UNRECOGNIZED = -1
59
+ }
60
+ export declare enum WithdrawalStatus {
61
+ WITHDRAWAL_STATUS_UNSPECIFIED = 0,
62
+ WITHDRAWAL_STATUS_OPEN = 1,
63
+ WITHDRAWAL_STATUS_APPROVED = 2,
64
+ WITHDRAWAL_STATUS_REJECTED = 3,
65
+ UNRECOGNIZED = -1
66
+ }
67
+ export declare enum WithdrawalRejectionReason {
68
+ WITHDRAWAL_REJECTION_REASON_UNSPECIFIED = 0,
69
+ WITHDRAWAL_REJECTION_REASON_DEADLINE_PASSED = 1,
70
+ WITHDRAWAL_REJECTION_REASON_SERVICE_COMPLETED = 2,
71
+ WITHDRAWAL_REJECTION_REASON_OTHER = 3,
54
72
  UNRECOGNIZED = -1
55
73
  }
56
74
  export interface MedicationProduct {
@@ -95,6 +113,19 @@ export interface TreatmentTypeOption {
95
113
  currency: string;
96
114
  available: boolean;
97
115
  }
116
+ export interface Withdrawal {
117
+ id: string;
118
+ requestId: string;
119
+ firstName: string;
120
+ lastName: string;
121
+ email: string;
122
+ isLate: boolean;
123
+ status: WithdrawalStatus;
124
+ rejectionReason?: WithdrawalRejectionReason | undefined;
125
+ rejectionText?: string | undefined;
126
+ receivedAt: string;
127
+ decidedAt?: string | undefined;
128
+ }
98
129
  export interface TreatmentRequest {
99
130
  id: string;
100
131
  number: string;
@@ -110,6 +141,8 @@ export interface TreatmentRequest {
110
141
  withdrawalWaiverAt?: string | undefined;
111
142
  medicationProducts: MedicationProduct[];
112
143
  intakeMethods: IntakeMethod[];
144
+ refundedAt?: string | undefined;
145
+ withdrawal?: Withdrawal | undefined;
113
146
  }
114
147
  export interface GetQuestionnaireRequest {
115
148
  userId: string;
@@ -212,6 +245,48 @@ export interface ListProductRequestersRequest {
212
245
  export interface ListProductRequestersResponse {
213
246
  userIds: string[];
214
247
  }
248
+ export interface SubmitWithdrawalRequest {
249
+ firstName: string;
250
+ lastName: string;
251
+ email: string;
252
+ number: string;
253
+ }
254
+ export interface SubmitWithdrawalResponse {
255
+ receivedAt: string;
256
+ }
257
+ export interface WithdrawalItem {
258
+ withdrawal: Withdrawal | undefined;
259
+ request: TreatmentRequest | undefined;
260
+ }
261
+ export interface ListWithdrawalsRequest {
262
+ pending: boolean;
263
+ cursor?: string | undefined;
264
+ limit: number;
265
+ }
266
+ export interface ListWithdrawalsResponse {
267
+ items: WithdrawalItem[];
268
+ nextCursor?: string | undefined;
269
+ total: number;
270
+ }
271
+ export interface CountPendingWithdrawalsRequest {
272
+ }
273
+ export interface CountPendingWithdrawalsResponse {
274
+ count: number;
275
+ }
276
+ export interface RefundWithdrawalRequest {
277
+ id: string;
278
+ }
279
+ export interface RefundWithdrawalResponse {
280
+ item: WithdrawalItem | undefined;
281
+ }
282
+ export interface RejectWithdrawalRequest {
283
+ id: string;
284
+ reason: WithdrawalRejectionReason;
285
+ text?: string | undefined;
286
+ }
287
+ export interface RejectWithdrawalResponse {
288
+ item: WithdrawalItem | undefined;
289
+ }
215
290
  export declare const TREATMENT_V1_PACKAGE_NAME = "treatment.v1";
216
291
  export interface TreatmentServiceClient {
217
292
  getQuestionnaire(request: GetQuestionnaireRequest): Observable<GetQuestionnaireResponse>;
@@ -227,6 +302,11 @@ export interface TreatmentServiceClient {
227
302
  deleteTreatmentRequest(request: DeleteTreatmentRequestRequest): Observable<DeleteTreatmentRequestResponse>;
228
303
  startPayment(request: StartPaymentRequest): Observable<StartPaymentResponse>;
229
304
  listProductRequesters(request: ListProductRequestersRequest): Observable<ListProductRequestersResponse>;
305
+ submitWithdrawal(request: SubmitWithdrawalRequest): Observable<SubmitWithdrawalResponse>;
306
+ listWithdrawals(request: ListWithdrawalsRequest): Observable<ListWithdrawalsResponse>;
307
+ countPendingWithdrawals(request: CountPendingWithdrawalsRequest): Observable<CountPendingWithdrawalsResponse>;
308
+ refundWithdrawal(request: RefundWithdrawalRequest): Observable<RefundWithdrawalResponse>;
309
+ rejectWithdrawal(request: RejectWithdrawalRequest): Observable<RejectWithdrawalResponse>;
230
310
  }
231
311
  export interface TreatmentServiceController {
232
312
  getQuestionnaire(request: GetQuestionnaireRequest): Promise<GetQuestionnaireResponse> | Observable<GetQuestionnaireResponse> | GetQuestionnaireResponse;
@@ -242,6 +322,11 @@ export interface TreatmentServiceController {
242
322
  deleteTreatmentRequest(request: DeleteTreatmentRequestRequest): Promise<DeleteTreatmentRequestResponse> | Observable<DeleteTreatmentRequestResponse> | DeleteTreatmentRequestResponse;
243
323
  startPayment(request: StartPaymentRequest): Promise<StartPaymentResponse> | Observable<StartPaymentResponse> | StartPaymentResponse;
244
324
  listProductRequesters(request: ListProductRequestersRequest): Promise<ListProductRequestersResponse> | Observable<ListProductRequestersResponse> | ListProductRequestersResponse;
325
+ submitWithdrawal(request: SubmitWithdrawalRequest): Promise<SubmitWithdrawalResponse> | Observable<SubmitWithdrawalResponse> | SubmitWithdrawalResponse;
326
+ listWithdrawals(request: ListWithdrawalsRequest): Promise<ListWithdrawalsResponse> | Observable<ListWithdrawalsResponse> | ListWithdrawalsResponse;
327
+ countPendingWithdrawals(request: CountPendingWithdrawalsRequest): Promise<CountPendingWithdrawalsResponse> | Observable<CountPendingWithdrawalsResponse> | CountPendingWithdrawalsResponse;
328
+ refundWithdrawal(request: RefundWithdrawalRequest): Promise<RefundWithdrawalResponse> | Observable<RefundWithdrawalResponse> | RefundWithdrawalResponse;
329
+ rejectWithdrawal(request: RejectWithdrawalRequest): Promise<RejectWithdrawalResponse> | Observable<RejectWithdrawalResponse> | RejectWithdrawalResponse;
245
330
  }
246
331
  export declare function TreatmentServiceControllerMethods(): (constructor: Function) => void;
247
332
  export declare const TREATMENT_SERVICE_NAME = "TreatmentService";
@@ -5,7 +5,7 @@
5
5
  // protoc v3.21.12
6
6
  // source: treatment.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.TREATMENT_SERVICE_NAME = exports.TREATMENT_V1_PACKAGE_NAME = exports.TreatmentRequestStatus = exports.TreatmentType = exports.ProductType = exports.IntakeMethod = exports.SymptomDuration = exports.Symptom = exports.QuestionnaireStatus = exports.protobufFileName = exports.protobufPackage = void 0;
8
+ exports.TREATMENT_SERVICE_NAME = exports.TREATMENT_V1_PACKAGE_NAME = exports.WithdrawalRejectionReason = exports.WithdrawalStatus = exports.TreatmentRequestStatus = exports.TreatmentType = exports.ProductType = exports.IntakeMethod = exports.SymptomDuration = exports.Symptom = exports.QuestionnaireStatus = exports.protobufFileName = exports.protobufPackage = void 0;
9
9
  exports.TreatmentServiceControllerMethods = TreatmentServiceControllerMethods;
10
10
  /* eslint-disable */
11
11
  const microservices_1 = require("@nestjs/microservices");
@@ -68,8 +68,28 @@ var TreatmentRequestStatus;
68
68
  TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_UNPAID"] = 1] = "TREATMENT_REQUEST_STATUS_UNPAID";
69
69
  TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_PAYMENT_PENDING"] = 2] = "TREATMENT_REQUEST_STATUS_PAYMENT_PENDING";
70
70
  TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_PAID"] = 3] = "TREATMENT_REQUEST_STATUS_PAID";
71
+ TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_WITHDRAWN"] = 4] = "TREATMENT_REQUEST_STATUS_WITHDRAWN";
72
+ TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_REFUND_PENDING"] = 5] = "TREATMENT_REQUEST_STATUS_REFUND_PENDING";
73
+ TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_REFUND_FAILED"] = 6] = "TREATMENT_REQUEST_STATUS_REFUND_FAILED";
74
+ TreatmentRequestStatus[TreatmentRequestStatus["TREATMENT_REQUEST_STATUS_REFUNDED"] = 7] = "TREATMENT_REQUEST_STATUS_REFUNDED";
71
75
  TreatmentRequestStatus[TreatmentRequestStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
72
76
  })(TreatmentRequestStatus || (exports.TreatmentRequestStatus = TreatmentRequestStatus = {}));
77
+ var WithdrawalStatus;
78
+ (function (WithdrawalStatus) {
79
+ WithdrawalStatus[WithdrawalStatus["WITHDRAWAL_STATUS_UNSPECIFIED"] = 0] = "WITHDRAWAL_STATUS_UNSPECIFIED";
80
+ WithdrawalStatus[WithdrawalStatus["WITHDRAWAL_STATUS_OPEN"] = 1] = "WITHDRAWAL_STATUS_OPEN";
81
+ WithdrawalStatus[WithdrawalStatus["WITHDRAWAL_STATUS_APPROVED"] = 2] = "WITHDRAWAL_STATUS_APPROVED";
82
+ WithdrawalStatus[WithdrawalStatus["WITHDRAWAL_STATUS_REJECTED"] = 3] = "WITHDRAWAL_STATUS_REJECTED";
83
+ WithdrawalStatus[WithdrawalStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
84
+ })(WithdrawalStatus || (exports.WithdrawalStatus = WithdrawalStatus = {}));
85
+ var WithdrawalRejectionReason;
86
+ (function (WithdrawalRejectionReason) {
87
+ WithdrawalRejectionReason[WithdrawalRejectionReason["WITHDRAWAL_REJECTION_REASON_UNSPECIFIED"] = 0] = "WITHDRAWAL_REJECTION_REASON_UNSPECIFIED";
88
+ WithdrawalRejectionReason[WithdrawalRejectionReason["WITHDRAWAL_REJECTION_REASON_DEADLINE_PASSED"] = 1] = "WITHDRAWAL_REJECTION_REASON_DEADLINE_PASSED";
89
+ WithdrawalRejectionReason[WithdrawalRejectionReason["WITHDRAWAL_REJECTION_REASON_SERVICE_COMPLETED"] = 2] = "WITHDRAWAL_REJECTION_REASON_SERVICE_COMPLETED";
90
+ WithdrawalRejectionReason[WithdrawalRejectionReason["WITHDRAWAL_REJECTION_REASON_OTHER"] = 3] = "WITHDRAWAL_REJECTION_REASON_OTHER";
91
+ WithdrawalRejectionReason[WithdrawalRejectionReason["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
92
+ })(WithdrawalRejectionReason || (exports.WithdrawalRejectionReason = WithdrawalRejectionReason = {}));
73
93
  exports.TREATMENT_V1_PACKAGE_NAME = "treatment.v1";
74
94
  function TreatmentServiceControllerMethods() {
75
95
  return function (constructor) {
@@ -87,6 +107,11 @@ function TreatmentServiceControllerMethods() {
87
107
  "deleteTreatmentRequest",
88
108
  "startPayment",
89
109
  "listProductRequesters",
110
+ "submitWithdrawal",
111
+ "listWithdrawals",
112
+ "countPendingWithdrawals",
113
+ "refundWithdrawal",
114
+ "rejectWithdrawal",
90
115
  ];
91
116
  for (const method of grpcMethods) {
92
117
  const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@candesk/contracts",
3
- "version": "6.67.0",
3
+ "version": "6.68.0",
4
4
  "description": "Protobuf contracts for CanDesk microservices",
5
5
  "author": {
6
6
  "name": "Alexander Schulz",
@@ -7,6 +7,7 @@ service PaymentService {
7
7
  rpc GetPayment (GetPaymentRequest) returns (GetPaymentResponse);
8
8
  rpc ListPayments (ListPaymentsRequest) returns (ListPaymentsResponse);
9
9
  rpc HandleWebhook (HandleWebhookRequest) returns (HandleWebhookResponse);
10
+ rpc RefundPayment (RefundPaymentRequest) returns (RefundPaymentResponse);
10
11
  }
11
12
 
12
13
  enum PaymentStatus {
@@ -24,6 +25,15 @@ enum PaymentProvider {
24
25
  PAYMENT_PROVIDER_MOLLIE = 1;
25
26
  }
26
27
 
28
+ enum RefundStatus {
29
+ REFUND_STATUS_UNSPECIFIED = 0;
30
+ REFUND_STATUS_QUEUED = 1;
31
+ REFUND_STATUS_PENDING = 2;
32
+ REFUND_STATUS_REFUNDED = 3;
33
+ REFUND_STATUS_FAILED = 4;
34
+ REFUND_STATUS_CANCELED = 5;
35
+ }
36
+
27
37
  message PaymentAddress {
28
38
  string street_and_number = 1;
29
39
  string postal_code = 2;
@@ -38,6 +48,15 @@ message PaymentCustomer {
38
48
  optional PaymentAddress address = 4;
39
49
  }
40
50
 
51
+ message Refund {
52
+ string id = 1;
53
+ RefundStatus status = 2;
54
+ int32 amount = 3;
55
+ string currency = 4;
56
+ string created_at = 5;
57
+ optional string refunded_at = 6;
58
+ }
59
+
41
60
  message Payment {
42
61
  string id = 1;
43
62
  PaymentStatus status = 2;
@@ -49,6 +68,7 @@ message Payment {
49
68
  string currency = 8;
50
69
  string created_at = 9;
51
70
  optional string paid_at = 10;
71
+ repeated Refund refunds = 11;
52
72
  }
53
73
 
54
74
  message CreatePaymentRequest {
@@ -91,3 +111,11 @@ message HandleWebhookRequest {
91
111
  message HandleWebhookResponse {
92
112
  bool ok = 1;
93
113
  }
114
+
115
+ message RefundPaymentRequest {
116
+ string id = 1;
117
+ }
118
+
119
+ message RefundPaymentResponse {
120
+ Refund refund = 1;
121
+ }
@@ -16,6 +16,11 @@ service TreatmentService {
16
16
  rpc DeleteTreatmentRequest (DeleteTreatmentRequestRequest) returns (DeleteTreatmentRequestResponse);
17
17
  rpc StartPayment (StartPaymentRequest) returns (StartPaymentResponse);
18
18
  rpc ListProductRequesters (ListProductRequestersRequest) returns (ListProductRequestersResponse);
19
+ rpc SubmitWithdrawal (SubmitWithdrawalRequest) returns (SubmitWithdrawalResponse);
20
+ rpc ListWithdrawals (ListWithdrawalsRequest) returns (ListWithdrawalsResponse);
21
+ rpc CountPendingWithdrawals (CountPendingWithdrawalsRequest) returns (CountPendingWithdrawalsResponse);
22
+ rpc RefundWithdrawal (RefundWithdrawalRequest) returns (RefundWithdrawalResponse);
23
+ rpc RejectWithdrawal (RejectWithdrawalRequest) returns (RejectWithdrawalResponse);
19
24
  }
20
25
 
21
26
  enum QuestionnaireStatus {
@@ -68,6 +73,24 @@ enum TreatmentRequestStatus {
68
73
  TREATMENT_REQUEST_STATUS_UNPAID = 1;
69
74
  TREATMENT_REQUEST_STATUS_PAYMENT_PENDING = 2;
70
75
  TREATMENT_REQUEST_STATUS_PAID = 3;
76
+ TREATMENT_REQUEST_STATUS_WITHDRAWN = 4;
77
+ TREATMENT_REQUEST_STATUS_REFUND_PENDING = 5;
78
+ TREATMENT_REQUEST_STATUS_REFUND_FAILED = 6;
79
+ TREATMENT_REQUEST_STATUS_REFUNDED = 7;
80
+ }
81
+
82
+ enum WithdrawalStatus {
83
+ WITHDRAWAL_STATUS_UNSPECIFIED = 0;
84
+ WITHDRAWAL_STATUS_OPEN = 1;
85
+ WITHDRAWAL_STATUS_APPROVED = 2;
86
+ WITHDRAWAL_STATUS_REJECTED = 3;
87
+ }
88
+
89
+ enum WithdrawalRejectionReason {
90
+ WITHDRAWAL_REJECTION_REASON_UNSPECIFIED = 0;
91
+ WITHDRAWAL_REJECTION_REASON_DEADLINE_PASSED = 1;
92
+ WITHDRAWAL_REJECTION_REASON_SERVICE_COMPLETED = 2;
93
+ WITHDRAWAL_REJECTION_REASON_OTHER = 3;
71
94
  }
72
95
 
73
96
  message MedicationProduct {
@@ -116,6 +139,20 @@ message TreatmentTypeOption {
116
139
  bool available = 4;
117
140
  }
118
141
 
142
+ message Withdrawal {
143
+ string id = 1;
144
+ string request_id = 2;
145
+ string first_name = 3;
146
+ string last_name = 4;
147
+ string email = 5;
148
+ bool is_late = 6;
149
+ WithdrawalStatus status = 7;
150
+ optional WithdrawalRejectionReason rejection_reason = 8;
151
+ optional string rejection_text = 9;
152
+ string received_at = 10;
153
+ optional string decided_at = 11;
154
+ }
155
+
119
156
  message TreatmentRequest {
120
157
  string id = 1;
121
158
  string number = 2;
@@ -131,6 +168,8 @@ message TreatmentRequest {
131
168
  optional string withdrawal_waiver_at = 12;
132
169
  repeated MedicationProduct medication_products = 13;
133
170
  repeated IntakeMethod intake_methods = 14;
171
+ optional string refunded_at = 15;
172
+ optional Withdrawal withdrawal = 16;
134
173
  }
135
174
 
136
175
  message GetQuestionnaireRequest {
@@ -259,3 +298,55 @@ message ListProductRequestersRequest {
259
298
  message ListProductRequestersResponse {
260
299
  repeated string user_ids = 1;
261
300
  }
301
+
302
+ message SubmitWithdrawalRequest {
303
+ string first_name = 1;
304
+ string last_name = 2;
305
+ string email = 3;
306
+ string number = 4;
307
+ }
308
+
309
+ message SubmitWithdrawalResponse {
310
+ string received_at = 1;
311
+ }
312
+
313
+ message WithdrawalItem {
314
+ Withdrawal withdrawal = 1;
315
+ TreatmentRequest request = 2;
316
+ }
317
+
318
+ message ListWithdrawalsRequest {
319
+ bool pending = 1;
320
+ optional string cursor = 2;
321
+ int32 limit = 3;
322
+ }
323
+
324
+ message ListWithdrawalsResponse {
325
+ repeated WithdrawalItem items = 1;
326
+ optional string next_cursor = 2;
327
+ int32 total = 3;
328
+ }
329
+
330
+ message CountPendingWithdrawalsRequest {}
331
+
332
+ message CountPendingWithdrawalsResponse {
333
+ int32 count = 1;
334
+ }
335
+
336
+ message RefundWithdrawalRequest {
337
+ string id = 1;
338
+ }
339
+
340
+ message RefundWithdrawalResponse {
341
+ WithdrawalItem item = 1;
342
+ }
343
+
344
+ message RejectWithdrawalRequest {
345
+ string id = 1;
346
+ WithdrawalRejectionReason reason = 2;
347
+ optional string text = 3;
348
+ }
349
+
350
+ message RejectWithdrawalResponse {
351
+ WithdrawalItem item = 1;
352
+ }