@prodoctors/contracts 1.14.0 → 1.15.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.
@@ -11,4 +11,5 @@ export declare const PROTO_PATHS: {
11
11
  readonly RESERVATION: string;
12
12
  readonly ANALYTICS: string;
13
13
  readonly PRESCRIPTION: string;
14
+ readonly PAYMENT: string;
14
15
  };
@@ -15,4 +15,5 @@ exports.PROTO_PATHS = {
15
15
  RESERVATION: (0, path_1.join)(__dirname, "../../proto/reservation.proto"),
16
16
  ANALYTICS: (0, path_1.join)(__dirname, "../../proto/analytics.proto"),
17
17
  PRESCRIPTION: (0, path_1.join)(__dirname, "../../proto/prescription.proto"),
18
+ PAYMENT: (0, path_1.join)(__dirname, "../../proto/payment.proto"),
18
19
  };
package/gen/inventory.ts CHANGED
@@ -113,7 +113,13 @@ export interface Product {
113
113
  | number
114
114
  | undefined;
115
115
  /** Barcha dorixonalar bo'yicha jami mavjud miqdor (remaining - reserved). */
116
- availableQuantity?: number | undefined;
116
+ availableQuantity?:
117
+ | number
118
+ | undefined;
119
+ /** Fiskal chek (OFD) uchun soliq atributlari. */
120
+ taxUnitsCode?: number | undefined;
121
+ taxLgotaId?: number | undefined;
122
+ vatPercent?: string | undefined;
117
123
  }
118
124
 
119
125
  export interface ProductBarcode {
@@ -188,6 +194,9 @@ export interface CreateProductRequest {
188
194
  allowFractionalSale?: boolean | undefined;
189
195
  taxMxikCode?: string | undefined;
190
196
  taxPackageCode?: string | undefined;
197
+ taxUnitsCode?: number | undefined;
198
+ taxLgotaId?: number | undefined;
199
+ vatPercent?: string | undefined;
191
200
  }
192
201
 
193
202
  export interface UpdateProductRequest {
@@ -214,6 +223,9 @@ export interface UpdateProductRequest {
214
223
  allowFractionalSale?: boolean | undefined;
215
224
  taxMxikCode?: string | undefined;
216
225
  taxPackageCode?: string | undefined;
226
+ taxUnitsCode?: number | undefined;
227
+ taxLgotaId?: number | undefined;
228
+ vatPercent?: string | undefined;
217
229
  }
218
230
 
219
231
  export interface ListProductsRequest {
package/gen/payment.ts ADDED
@@ -0,0 +1,208 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.5
4
+ // protoc v7.34.0
5
+ // source: payment.proto
6
+
7
+ /* eslint-disable */
8
+ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
+ import { Observable } from "rxjs";
10
+ import { IdRequest } from "./common";
11
+ import { Timestamp } from "./google/protobuf/timestamp";
12
+
13
+ export const protobufPackage = "payment.v1";
14
+
15
+ /** Onlayn to'lov provayderi. */
16
+ export enum PaymentProvider {
17
+ PAYMENT_PROVIDER_UNSPECIFIED = 0,
18
+ PAYMENT_PROVIDER_VIA = 1,
19
+ UNRECOGNIZED = -1,
20
+ }
21
+
22
+ /** To'lov oqimi. */
23
+ export enum PaymentFlow {
24
+ PAYMENT_FLOW_UNSPECIFIED = 0,
25
+ /** PAYMENT_FLOW_INVOICE - Hisob-faktura: mijoz provayder tomonida to'laydi (karta bizdan o'tmaydi). */
26
+ PAYMENT_FLOW_INVOICE = 1,
27
+ /** PAYMENT_FLOW_HOLD - Karta tokeni bilan ushlab turish, olib ketishda yechish. */
28
+ PAYMENT_FLOW_HOLD = 2,
29
+ UNRECOGNIZED = -1,
30
+ }
31
+
32
+ /** To'lov holati. */
33
+ export enum PaymentStatus {
34
+ PAYMENT_STATUS_UNSPECIFIED = 0,
35
+ PAYMENT_STATUS_PENDING = 1,
36
+ PAYMENT_STATUS_HELD = 2,
37
+ PAYMENT_STATUS_PAID = 3,
38
+ PAYMENT_STATUS_CANCELLED = 4,
39
+ PAYMENT_STATUS_FAILED = 5,
40
+ PAYMENT_STATUS_REFUNDED = 6,
41
+ UNRECOGNIZED = -1,
42
+ }
43
+
44
+ export interface Payment {
45
+ id: string;
46
+ webOrderId: string;
47
+ provider: PaymentProvider;
48
+ flow: PaymentFlow;
49
+ status: PaymentStatus;
50
+ amount: string;
51
+ currency: string;
52
+ /** Bizning idempotentlik kalitimiz. */
53
+ externalId: string;
54
+ /** Provayder hisob-fakturasi (`inv_...`). */
55
+ invoiceId?:
56
+ | string
57
+ | undefined;
58
+ /** Provayder tranzaksiyasi (`trx_...`). */
59
+ transactionId?:
60
+ | string
61
+ | undefined;
62
+ /** Mijozni yo'naltirish uchun to'lov sahifasi (bo'lsa). */
63
+ paymentUrl?:
64
+ | string
65
+ | undefined;
66
+ /** Karta niqobi (oxirgi raqamlar). To'liq PAN saqlanmaydi. */
67
+ cardMask?: string | undefined;
68
+ paidAt?: Timestamp | undefined;
69
+ failureReason?: string | undefined;
70
+ createdAt: Timestamp | undefined;
71
+ updatedAt: Timestamp | undefined;
72
+ }
73
+
74
+ export interface StartPaymentRequest {
75
+ webOrderId: string;
76
+ /** Ko'rsatilmasa INVOICE ishlatiladi. */
77
+ flow: PaymentFlow;
78
+ /** HOLD oqimi uchun majburiy. */
79
+ cardToken?: string | undefined;
80
+ receiverPhone?: string | undefined;
81
+ receiverEmail?: string | undefined;
82
+ }
83
+
84
+ export interface GetPaymentByOrderRequest {
85
+ webOrderId: string;
86
+ }
87
+
88
+ /** Provayder callback'i yoki UI polling — holatni provayderdan tortadi. */
89
+ export interface SyncPaymentRequest {
90
+ /** Ikkalasidan biri: bizning to'lov id yoki provayder tranzaksiya/invoice id. */
91
+ paymentId?: string | undefined;
92
+ externalId?: string | undefined;
93
+ providerReference?: string | undefined;
94
+ }
95
+
96
+ /** HOLD → yechish (dori berilganda). */
97
+ export interface ConfirmPaymentRequest {
98
+ paymentId: string;
99
+ }
100
+
101
+ /** HOLD → qaytarish (bron bekor/muddati o'tganda). */
102
+ export interface CancelPaymentRequest {
103
+ paymentId: string;
104
+ reason?: string | undefined;
105
+ }
106
+
107
+ export interface RegisterCardRequest {
108
+ webOrderId: string;
109
+ /** Karta raqami — faqat provayderga uzatiladi, saqlanmaydi. */
110
+ pan: string;
111
+ expMonth: string;
112
+ expYear: string;
113
+ phone: string;
114
+ }
115
+
116
+ export interface RegisterCardResponse {
117
+ paymentId: string;
118
+ verifyId: string;
119
+ /** SMS yuborilgan raqam niqobi (mijozga ko'rsatish uchun). */
120
+ phoneMask: string;
121
+ }
122
+
123
+ export interface ConfirmCardRequest {
124
+ paymentId: string;
125
+ verifyCode: string;
126
+ }
127
+
128
+ export interface ResendCardCodeRequest {
129
+ paymentId: string;
130
+ }
131
+
132
+ export interface ResendCardCodeResponse {
133
+ verifyId: string;
134
+ phoneMask: string;
135
+ }
136
+
137
+ export const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
138
+
139
+ export interface PaymentServiceClient {
140
+ startPayment(request: StartPaymentRequest): Observable<Payment>;
141
+
142
+ getPayment(request: IdRequest): Observable<Payment>;
143
+
144
+ getPaymentByOrder(request: GetPaymentByOrderRequest): Observable<Payment>;
145
+
146
+ syncPayment(request: SyncPaymentRequest): Observable<Payment>;
147
+
148
+ confirmPayment(request: ConfirmPaymentRequest): Observable<Payment>;
149
+
150
+ cancelPayment(request: CancelPaymentRequest): Observable<Payment>;
151
+
152
+ registerCard(request: RegisterCardRequest): Observable<RegisterCardResponse>;
153
+
154
+ confirmCard(request: ConfirmCardRequest): Observable<Payment>;
155
+
156
+ resendCardCode(request: ResendCardCodeRequest): Observable<ResendCardCodeResponse>;
157
+ }
158
+
159
+ export interface PaymentServiceController {
160
+ startPayment(request: StartPaymentRequest): Promise<Payment> | Observable<Payment> | Payment;
161
+
162
+ getPayment(request: IdRequest): Promise<Payment> | Observable<Payment> | Payment;
163
+
164
+ getPaymentByOrder(request: GetPaymentByOrderRequest): Promise<Payment> | Observable<Payment> | Payment;
165
+
166
+ syncPayment(request: SyncPaymentRequest): Promise<Payment> | Observable<Payment> | Payment;
167
+
168
+ confirmPayment(request: ConfirmPaymentRequest): Promise<Payment> | Observable<Payment> | Payment;
169
+
170
+ cancelPayment(request: CancelPaymentRequest): Promise<Payment> | Observable<Payment> | Payment;
171
+
172
+ registerCard(
173
+ request: RegisterCardRequest,
174
+ ): Promise<RegisterCardResponse> | Observable<RegisterCardResponse> | RegisterCardResponse;
175
+
176
+ confirmCard(request: ConfirmCardRequest): Promise<Payment> | Observable<Payment> | Payment;
177
+
178
+ resendCardCode(
179
+ request: ResendCardCodeRequest,
180
+ ): Promise<ResendCardCodeResponse> | Observable<ResendCardCodeResponse> | ResendCardCodeResponse;
181
+ }
182
+
183
+ export function PaymentServiceControllerMethods() {
184
+ return function (constructor: Function) {
185
+ const grpcMethods: string[] = [
186
+ "startPayment",
187
+ "getPayment",
188
+ "getPaymentByOrder",
189
+ "syncPayment",
190
+ "confirmPayment",
191
+ "cancelPayment",
192
+ "registerCard",
193
+ "confirmCard",
194
+ "resendCardCode",
195
+ ];
196
+ for (const method of grpcMethods) {
197
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
198
+ GrpcMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
199
+ }
200
+ const grpcStreamMethods: string[] = [];
201
+ for (const method of grpcStreamMethods) {
202
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
203
+ GrpcStreamMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
204
+ }
205
+ };
206
+ }
207
+
208
+ export const PAYMENT_SERVICE_NAME = "PaymentService";
@@ -28,7 +28,14 @@ export interface SearchPrescriptionRequest {
28
28
  | boolean
29
29
  | undefined;
30
30
  /** "prescription-{patient_id}-{safe_code}" — parse qilinadi */
31
- qr?: string | undefined;
31
+ qr?:
32
+ | string
33
+ | undefined;
34
+ /**
35
+ * Retseptni ochayotgan farmatsevt. DMED tokeni har bir shaxsga alohida
36
+ * bog'langani uchun (retsept berish DMED'da shaxsga yoziladi) majburiy.
37
+ */
38
+ accountId: string;
32
39
  }
33
40
 
34
41
  /** Bizning katalogdagi mos mahsulot (filialda mavjud stock bilan). */
@@ -85,6 +92,8 @@ export interface DispenseRequest {
85
92
  markingCode?: string | undefined;
86
93
  drugAmount: number;
87
94
  price: number;
95
+ /** Dorini beruvchi farmatsevt — DMED tokeni shu shaxsniki. */
96
+ accountId: string;
88
97
  }
89
98
 
90
99
  export interface CheckIssueResponse {
@@ -98,9 +107,50 @@ export interface IssueResponse {
98
107
  message: string;
99
108
  }
100
109
 
110
+ export interface DmedAccountRequest {
111
+ accountId: string;
112
+ }
113
+
114
+ export interface DmedAuthorizeUrlResponse {
115
+ /** Farmatsevt shu manzilga yo'naltiriladi (DMED login sahifasi). */
116
+ authorizeUrl: string;
117
+ /** CSRF himoyasi uchun; callback'da qaytib keladi. */
118
+ state: string;
119
+ }
120
+
121
+ export interface CompleteDmedConnectionRequest {
122
+ accountId: string;
123
+ code: string;
124
+ }
125
+
126
+ export interface DmedConnectionStatus {
127
+ connected: boolean;
128
+ dmedEmail?:
129
+ | string
130
+ | undefined;
131
+ /** Access token qachon tugashi (ISO 8601). */
132
+ expiresAt?: string | undefined;
133
+ }
134
+
101
135
  export const PRESCRIPTION_V1_PACKAGE_NAME = "prescription.v1";
102
136
 
103
137
  export interface PrescriptionServiceClient {
138
+ /** DMED hisobini ulash: login manzilini beradi. */
139
+
140
+ connectDmed(request: DmedAccountRequest): Observable<DmedAuthorizeUrlResponse>;
141
+
142
+ /** Callback'dan kelgan `code` ni tokenga almashtirib saqlaydi. */
143
+
144
+ completeDmedConnection(request: CompleteDmedConnectionRequest): Observable<DmedConnectionStatus>;
145
+
146
+ /** Ulanish holati (POS "ulangan/ulanmagan" ko'rsatishi uchun). */
147
+
148
+ getDmedStatus(request: DmedAccountRequest): Observable<DmedConnectionStatus>;
149
+
150
+ /** Ulanishni uzish. */
151
+
152
+ disconnectDmed(request: DmedAccountRequest): Observable<DmedConnectionStatus>;
153
+
104
154
  /** Retsept qidirish + bizdagi mos stockni topish. */
105
155
 
106
156
  searchPrescription(request: SearchPrescriptionRequest): Observable<SearchPrescriptionResponse>;
@@ -115,6 +165,30 @@ export interface PrescriptionServiceClient {
115
165
  }
116
166
 
117
167
  export interface PrescriptionServiceController {
168
+ /** DMED hisobini ulash: login manzilini beradi. */
169
+
170
+ connectDmed(
171
+ request: DmedAccountRequest,
172
+ ): Promise<DmedAuthorizeUrlResponse> | Observable<DmedAuthorizeUrlResponse> | DmedAuthorizeUrlResponse;
173
+
174
+ /** Callback'dan kelgan `code` ni tokenga almashtirib saqlaydi. */
175
+
176
+ completeDmedConnection(
177
+ request: CompleteDmedConnectionRequest,
178
+ ): Promise<DmedConnectionStatus> | Observable<DmedConnectionStatus> | DmedConnectionStatus;
179
+
180
+ /** Ulanish holati (POS "ulangan/ulanmagan" ko'rsatishi uchun). */
181
+
182
+ getDmedStatus(
183
+ request: DmedAccountRequest,
184
+ ): Promise<DmedConnectionStatus> | Observable<DmedConnectionStatus> | DmedConnectionStatus;
185
+
186
+ /** Ulanishni uzish. */
187
+
188
+ disconnectDmed(
189
+ request: DmedAccountRequest,
190
+ ): Promise<DmedConnectionStatus> | Observable<DmedConnectionStatus> | DmedConnectionStatus;
191
+
118
192
  /** Retsept qidirish + bizdagi mos stockni topish. */
119
193
 
120
194
  searchPrescription(
@@ -134,7 +208,15 @@ export interface PrescriptionServiceController {
134
208
 
135
209
  export function PrescriptionServiceControllerMethods() {
136
210
  return function (constructor: Function) {
137
- const grpcMethods: string[] = ["searchPrescription", "checkPrescriptionIssue", "issuePrescription"];
211
+ const grpcMethods: string[] = [
212
+ "connectDmed",
213
+ "completeDmedConnection",
214
+ "getDmedStatus",
215
+ "disconnectDmed",
216
+ "searchPrescription",
217
+ "checkPrescriptionIssue",
218
+ "issuePrescription",
219
+ ];
138
220
  for (const method of grpcMethods) {
139
221
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
140
222
  GrpcMethod("PrescriptionService", method)(constructor.prototype[method], method, descriptor);
@@ -125,7 +125,29 @@ export interface WebOrder {
125
125
  items: WebOrderItem[];
126
126
  /** Buyurtma bajariladigan dorixona (bitta order = bitta filial). */
127
127
  branchId?: string | undefined;
128
- pharmacyName?: string | undefined;
128
+ pharmacyName?:
129
+ | string
130
+ | undefined;
131
+ /** Onlayn to'lov. Bo'lmasa — dorixonada naqd/karta bilan to'lanadi. */
132
+ payment?: WebOrderPayment | undefined;
133
+ }
134
+
135
+ /**
136
+ * Buyurtmaning onlayn to'lovi (bo'lsa). To'liq tafsilot payment.v1 da —
137
+ * bu yerda ro'yxat/kartochkada ko'rsatish uchun zarur minimum.
138
+ */
139
+ export interface WebOrderPayment {
140
+ id: string;
141
+ /** PENDING | HELD | PAID | CANCELLED | FAILED | REFUNDED */
142
+ status: string;
143
+ amount: string;
144
+ cardMask?: string | undefined;
145
+ paidAt?:
146
+ | Timestamp
147
+ | undefined;
148
+ /** Fiskal chek yuborilganmi (yuborilmagan bo'lsa — sabab `receipt_error`). */
149
+ receiptSentAt?: Timestamp | undefined;
150
+ receiptError?: string | undefined;
129
151
  }
130
152
 
131
153
  export interface GetWebOrderByNumberRequest {
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "@prodoctors/contracts",
3
- "version": "1.14.0",
4
- "description": "Protobuf definitions and generated Typescript types for ProDoctors",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
7
- "scripts": {
8
- "build": "tsc -p tsconfig.build.json",
9
- "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
10
- },
11
- "files": [
12
- "proto",
13
- "gen",
14
- "dist"
15
- ],
16
- "publishConfig": {
17
- "access": "public"
18
- },
19
- "dependencies": {
20
- "@nestjs/microservices": "^11.1.15",
21
- "rxjs": "^7.8.2",
22
- "ts-proto": "^2.11.4"
23
- },
24
- "devDependencies": {
25
- "@types/node": "^25.3.5",
26
- "typescript": "^5.9.3"
27
- }
28
- }
1
+ {
2
+ "name": "@prodoctors/contracts",
3
+ "version": "1.15.0",
4
+ "description": "Protobuf definitions and generated Typescript types for ProDoctors",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc -p tsconfig.build.json",
9
+ "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
10
+ },
11
+ "files": [
12
+ "proto",
13
+ "gen",
14
+ "dist"
15
+ ],
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "dependencies": {
20
+ "@nestjs/microservices": "^11.1.15",
21
+ "rxjs": "^7.8.2",
22
+ "ts-proto": "^2.11.4"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^25.3.5",
26
+ "typescript": "^5.9.3"
27
+ }
28
+ }
@@ -1,84 +1,84 @@
1
- syntax = "proto3";
2
-
3
- package branch.v1;
4
-
5
- import "google/protobuf/timestamp.proto";
6
- import "common.proto";
7
-
8
- message BranchBankDetails {
9
- optional string legal_name = 1;
10
- optional string legal_address = 2;
11
- optional string account_number = 3;
12
- optional string bank_name = 4;
13
- optional string bank_branch = 5;
14
- optional string mfo = 6;
15
- optional string inn = 7;
16
- optional string okonx = 8;
17
- }
18
-
19
- message Branch {
20
- string id = 1;
21
- string name = 2;
22
- optional string code = 3;
23
- optional string address = 4;
24
- optional string phone = 5;
25
- bool is_active = 6;
26
- optional string work_time = 7;
27
- optional string lat = 8;
28
- optional string lng = 9;
29
- optional string parent_branch_id = 10;
30
- google.protobuf.Timestamp created_at = 11;
31
- google.protobuf.Timestamp updated_at = 12;
32
- optional string region_id = 13;
33
- optional BranchBankDetails bank_details = 14;
34
- optional string cover_image_url = 15;
35
- }
36
-
37
- message CreateBranchRequest {
38
- string name = 1;
39
- optional string code = 2;
40
- optional string address = 3;
41
- optional string phone = 4;
42
- optional bool is_active = 5;
43
- optional string work_time = 6;
44
- optional string lat = 7;
45
- optional string lng = 8;
46
- optional string parent_branch_id = 9;
47
- optional string region_id = 10;
48
- optional BranchBankDetails bank_details = 11;
49
- optional string cover_image_url = 12;
50
- }
51
-
52
- message UpdateBranchRequest {
53
- string id = 1;
54
- optional string name = 2;
55
- optional string code = 3;
56
- optional string address = 4;
57
- optional string phone = 5;
58
- optional bool is_active = 6;
59
- optional string work_time = 7;
60
- optional string lat = 8;
61
- optional string lng = 9;
62
- optional string parent_branch_id = 10;
63
- optional string region_id = 11;
64
- optional BranchBankDetails bank_details = 12;
65
- optional string cover_image_url = 13;
66
- }
67
-
68
- message ListBranchesRequest {
69
- optional bool is_active = 1;
70
- optional string parent_branch_id = 2;
71
- optional string search = 3;
72
- }
73
-
74
- message ListBranchesResponse {
75
- repeated Branch items = 1;
76
- }
77
-
78
- service BranchService {
79
- rpc CreateBranch(CreateBranchRequest) returns (Branch);
80
- rpc UpdateBranch(UpdateBranchRequest) returns (Branch);
81
- rpc GetBranch(common.v1.IdRequest) returns (Branch);
82
- rpc ListBranches(ListBranchesRequest) returns (ListBranchesResponse);
83
- rpc DeleteBranch(common.v1.IdRequest) returns (common.v1.BoolResponse);
84
- }
1
+ syntax = "proto3";
2
+
3
+ package branch.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+ import "common.proto";
7
+
8
+ message BranchBankDetails {
9
+ optional string legal_name = 1;
10
+ optional string legal_address = 2;
11
+ optional string account_number = 3;
12
+ optional string bank_name = 4;
13
+ optional string bank_branch = 5;
14
+ optional string mfo = 6;
15
+ optional string inn = 7;
16
+ optional string okonx = 8;
17
+ }
18
+
19
+ message Branch {
20
+ string id = 1;
21
+ string name = 2;
22
+ optional string code = 3;
23
+ optional string address = 4;
24
+ optional string phone = 5;
25
+ bool is_active = 6;
26
+ optional string work_time = 7;
27
+ optional string lat = 8;
28
+ optional string lng = 9;
29
+ optional string parent_branch_id = 10;
30
+ google.protobuf.Timestamp created_at = 11;
31
+ google.protobuf.Timestamp updated_at = 12;
32
+ optional string region_id = 13;
33
+ optional BranchBankDetails bank_details = 14;
34
+ optional string cover_image_url = 15;
35
+ }
36
+
37
+ message CreateBranchRequest {
38
+ string name = 1;
39
+ optional string code = 2;
40
+ optional string address = 3;
41
+ optional string phone = 4;
42
+ optional bool is_active = 5;
43
+ optional string work_time = 6;
44
+ optional string lat = 7;
45
+ optional string lng = 8;
46
+ optional string parent_branch_id = 9;
47
+ optional string region_id = 10;
48
+ optional BranchBankDetails bank_details = 11;
49
+ optional string cover_image_url = 12;
50
+ }
51
+
52
+ message UpdateBranchRequest {
53
+ string id = 1;
54
+ optional string name = 2;
55
+ optional string code = 3;
56
+ optional string address = 4;
57
+ optional string phone = 5;
58
+ optional bool is_active = 6;
59
+ optional string work_time = 7;
60
+ optional string lat = 8;
61
+ optional string lng = 9;
62
+ optional string parent_branch_id = 10;
63
+ optional string region_id = 11;
64
+ optional BranchBankDetails bank_details = 12;
65
+ optional string cover_image_url = 13;
66
+ }
67
+
68
+ message ListBranchesRequest {
69
+ optional bool is_active = 1;
70
+ optional string parent_branch_id = 2;
71
+ optional string search = 3;
72
+ }
73
+
74
+ message ListBranchesResponse {
75
+ repeated Branch items = 1;
76
+ }
77
+
78
+ service BranchService {
79
+ rpc CreateBranch(CreateBranchRequest) returns (Branch);
80
+ rpc UpdateBranch(UpdateBranchRequest) returns (Branch);
81
+ rpc GetBranch(common.v1.IdRequest) returns (Branch);
82
+ rpc ListBranches(ListBranchesRequest) returns (ListBranchesResponse);
83
+ rpc DeleteBranch(common.v1.IdRequest) returns (common.v1.BoolResponse);
84
+ }
@@ -97,6 +97,11 @@ message Product {
97
97
  optional int32 offers_count = 30;
98
98
  // Barcha dorixonalar bo'yicha jami mavjud miqdor (remaining - reserved).
99
99
  optional int32 available_quantity = 31;
100
+
101
+ // Fiskal chek (OFD) uchun soliq atributlari.
102
+ optional int32 tax_units_code = 32;
103
+ optional int32 tax_lgota_id = 33;
104
+ optional string vat_percent = 34;
100
105
  }
101
106
 
102
107
  message ProductBarcode {
@@ -171,6 +176,9 @@ message CreateProductRequest {
171
176
  optional bool allow_fractional_sale = 20;
172
177
  optional string tax_mxik_code = 21;
173
178
  optional string tax_package_code = 22;
179
+ optional int32 tax_units_code = 23;
180
+ optional int32 tax_lgota_id = 24;
181
+ optional string vat_percent = 25;
174
182
  }
175
183
 
176
184
  message UpdateProductRequest {
@@ -197,6 +205,9 @@ message UpdateProductRequest {
197
205
  optional bool allow_fractional_sale = 21;
198
206
  optional string tax_mxik_code = 22;
199
207
  optional string tax_package_code = 23;
208
+ optional int32 tax_units_code = 24;
209
+ optional int32 tax_lgota_id = 25;
210
+ optional string vat_percent = 26;
200
211
  }
201
212
 
202
213
  message ListProductsRequest {
@@ -0,0 +1,145 @@
1
+ syntax = "proto3";
2
+
3
+ package payment.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+ import "common.proto";
7
+
8
+ // Onlayn to'lov provayderi.
9
+ enum PaymentProvider {
10
+ PAYMENT_PROVIDER_UNSPECIFIED = 0;
11
+ PAYMENT_PROVIDER_VIA = 1;
12
+ }
13
+
14
+ // To'lov oqimi.
15
+ enum PaymentFlow {
16
+ PAYMENT_FLOW_UNSPECIFIED = 0;
17
+ // Hisob-faktura: mijoz provayder tomonida to'laydi (karta bizdan o'tmaydi).
18
+ PAYMENT_FLOW_INVOICE = 1;
19
+ // Karta tokeni bilan ushlab turish, olib ketishda yechish.
20
+ PAYMENT_FLOW_HOLD = 2;
21
+ }
22
+
23
+ // To'lov holati.
24
+ enum PaymentStatus {
25
+ PAYMENT_STATUS_UNSPECIFIED = 0;
26
+ PAYMENT_STATUS_PENDING = 1;
27
+ PAYMENT_STATUS_HELD = 2;
28
+ PAYMENT_STATUS_PAID = 3;
29
+ PAYMENT_STATUS_CANCELLED = 4;
30
+ PAYMENT_STATUS_FAILED = 5;
31
+ PAYMENT_STATUS_REFUNDED = 6;
32
+ }
33
+
34
+ message Payment {
35
+ string id = 1;
36
+ string web_order_id = 2;
37
+
38
+ PaymentProvider provider = 3;
39
+ PaymentFlow flow = 4;
40
+ PaymentStatus status = 5;
41
+
42
+ string amount = 6;
43
+ string currency = 7;
44
+
45
+ // Bizning idempotentlik kalitimiz.
46
+ string external_id = 8;
47
+ // Provayder hisob-fakturasi (`inv_...`).
48
+ optional string invoice_id = 9;
49
+ // Provayder tranzaksiyasi (`trx_...`).
50
+ optional string transaction_id = 10;
51
+ // Mijozni yo'naltirish uchun to'lov sahifasi (bo'lsa).
52
+ optional string payment_url = 11;
53
+ // Karta niqobi (oxirgi raqamlar). To'liq PAN saqlanmaydi.
54
+ optional string card_mask = 12;
55
+
56
+ optional google.protobuf.Timestamp paid_at = 13;
57
+ optional string failure_reason = 14;
58
+
59
+ google.protobuf.Timestamp created_at = 15;
60
+ google.protobuf.Timestamp updated_at = 16;
61
+ }
62
+
63
+ message StartPaymentRequest {
64
+ string web_order_id = 1;
65
+ // Ko'rsatilmasa INVOICE ishlatiladi.
66
+ PaymentFlow flow = 2;
67
+
68
+ // HOLD oqimi uchun majburiy.
69
+ optional string card_token = 3;
70
+
71
+ optional string receiver_phone = 4;
72
+ optional string receiver_email = 5;
73
+ }
74
+
75
+ message GetPaymentByOrderRequest {
76
+ string web_order_id = 1;
77
+ }
78
+
79
+ // Provayder callback'i yoki UI polling — holatni provayderdan tortadi.
80
+ message SyncPaymentRequest {
81
+ // Ikkalasidan biri: bizning to'lov id yoki provayder tranzaksiya/invoice id.
82
+ optional string payment_id = 1;
83
+ optional string external_id = 2;
84
+ optional string provider_reference = 3;
85
+ }
86
+
87
+ // HOLD → yechish (dori berilganda).
88
+ message ConfirmPaymentRequest {
89
+ string payment_id = 1;
90
+ }
91
+
92
+ // HOLD → qaytarish (bron bekor/muddati o'tganda).
93
+ message CancelPaymentRequest {
94
+ string payment_id = 1;
95
+ optional string reason = 2;
96
+ }
97
+
98
+ // --- Karta kiritish (karta SAQLANMAYDI) ---
99
+ //
100
+ // Oqim: RegisterCard (karta ma'lumoti) -> mijozga SMS -> ConfirmCard (kod)
101
+ // -> olingan token DARHOL hold yaratishga ishlatiladi va tashlab yuboriladi.
102
+ // PAN hech qayerda saqlanmaydi va loglanmaydi.
103
+
104
+ message RegisterCardRequest {
105
+ string web_order_id = 1;
106
+ // Karta raqami — faqat provayderga uzatiladi, saqlanmaydi.
107
+ string pan = 2;
108
+ string exp_month = 3;
109
+ string exp_year = 4;
110
+ string phone = 5;
111
+ }
112
+
113
+ message RegisterCardResponse {
114
+ string payment_id = 1;
115
+ string verify_id = 2;
116
+ // SMS yuborilgan raqam niqobi (mijozga ko'rsatish uchun).
117
+ string phone_mask = 3;
118
+ }
119
+
120
+ message ConfirmCardRequest {
121
+ string payment_id = 1;
122
+ string verify_code = 2;
123
+ }
124
+
125
+ message ResendCardCodeRequest {
126
+ string payment_id = 1;
127
+ }
128
+
129
+ message ResendCardCodeResponse {
130
+ string verify_id = 1;
131
+ string phone_mask = 2;
132
+ }
133
+
134
+ service PaymentService {
135
+ rpc StartPayment(StartPaymentRequest) returns (Payment);
136
+ rpc GetPayment(common.v1.IdRequest) returns (Payment);
137
+ rpc GetPaymentByOrder(GetPaymentByOrderRequest) returns (Payment);
138
+ rpc SyncPayment(SyncPaymentRequest) returns (Payment);
139
+ rpc ConfirmPayment(ConfirmPaymentRequest) returns (Payment);
140
+ rpc CancelPayment(CancelPaymentRequest) returns (Payment);
141
+
142
+ rpc RegisterCard(RegisterCardRequest) returns (RegisterCardResponse);
143
+ rpc ConfirmCard(ConfirmCardRequest) returns (Payment);
144
+ rpc ResendCardCode(ResendCardCodeRequest) returns (ResendCardCodeResponse);
145
+ }
@@ -17,6 +17,9 @@ message SearchPrescriptionRequest {
17
17
  optional string birth_date = 6; // YYYY-MM-DD
18
18
  optional bool is_confidant = 7;
19
19
  optional string qr = 8; // "prescription-{patient_id}-{safe_code}" — parse qilinadi
20
+ // Retseptni ochayotgan farmatsevt. DMED tokeni har bir shaxsga alohida
21
+ // bog'langani uchun (retsept berish DMED'da shaxsga yoziladi) majburiy.
22
+ string account_id = 9;
20
23
  }
21
24
 
22
25
  // Bizning katalogdagi mos mahsulot (filialda mavjud stock bilan).
@@ -73,6 +76,8 @@ message DispenseRequest {
73
76
  optional string marking_code = 5;
74
77
  int32 drug_amount = 6;
75
78
  int64 price = 7;
79
+ // Dorini beruvchi farmatsevt — DMED tokeni shu shaxsniki.
80
+ string account_id = 8;
76
81
  }
77
82
 
78
83
  message CheckIssueResponse {
@@ -86,7 +91,42 @@ message IssueResponse {
86
91
  string message = 3;
87
92
  }
88
93
 
94
+ // --- DMED hisobini ulash (OAuth2 Authorization Code) ---
95
+ // Token har bir farmatsevtga alohida saqlanadi.
96
+
97
+ message DmedAccountRequest {
98
+ string account_id = 1;
99
+ }
100
+
101
+ message DmedAuthorizeUrlResponse {
102
+ // Farmatsevt shu manzilga yo'naltiriladi (DMED login sahifasi).
103
+ string authorize_url = 1;
104
+ // CSRF himoyasi uchun; callback'da qaytib keladi.
105
+ string state = 2;
106
+ }
107
+
108
+ message CompleteDmedConnectionRequest {
109
+ string account_id = 1;
110
+ string code = 2;
111
+ }
112
+
113
+ message DmedConnectionStatus {
114
+ bool connected = 1;
115
+ optional string dmed_email = 2;
116
+ // Access token qachon tugashi (ISO 8601).
117
+ optional string expires_at = 3;
118
+ }
119
+
89
120
  service PrescriptionService {
121
+ // DMED hisobini ulash: login manzilini beradi.
122
+ rpc ConnectDmed(DmedAccountRequest) returns (DmedAuthorizeUrlResponse);
123
+ // Callback'dan kelgan `code` ni tokenga almashtirib saqlaydi.
124
+ rpc CompleteDmedConnection(CompleteDmedConnectionRequest) returns (DmedConnectionStatus);
125
+ // Ulanish holati (POS "ulangan/ulanmagan" ko'rsatishi uchun).
126
+ rpc GetDmedStatus(DmedAccountRequest) returns (DmedConnectionStatus);
127
+ // Ulanishni uzish.
128
+ rpc DisconnectDmed(DmedAccountRequest) returns (DmedConnectionStatus);
129
+
90
130
  // Retsept qidirish + bizdagi mos stockni topish.
91
131
  rpc SearchPrescription(SearchPrescriptionRequest) returns (SearchPrescriptionResponse);
92
132
  // Berishdan oldin DMED'da tekshirish.
@@ -136,6 +136,23 @@ message WebOrder {
136
136
  // Buyurtma bajariladigan dorixona (bitta order = bitta filial).
137
137
  optional string branch_id = 15;
138
138
  optional string pharmacy_name = 16;
139
+
140
+ // Onlayn to'lov. Bo'lmasa — dorixonada naqd/karta bilan to'lanadi.
141
+ optional WebOrderPayment payment = 17;
142
+ }
143
+
144
+ // Buyurtmaning onlayn to'lovi (bo'lsa). To'liq tafsilot payment.v1 da —
145
+ // bu yerda ro'yxat/kartochkada ko'rsatish uchun zarur minimum.
146
+ message WebOrderPayment {
147
+ string id = 1;
148
+ // PENDING | HELD | PAID | CANCELLED | FAILED | REFUNDED
149
+ string status = 2;
150
+ string amount = 3;
151
+ optional string card_mask = 4;
152
+ optional google.protobuf.Timestamp paid_at = 5;
153
+ // Fiskal chek yuborilganmi (yuborilmagan bo'lsa — sabab `receipt_error`).
154
+ optional google.protobuf.Timestamp receipt_sent_at = 6;
155
+ optional string receipt_error = 7;
139
156
  }
140
157
 
141
158
  message GetWebOrderByNumberRequest {
package/proto/shift.proto CHANGED
@@ -1,144 +1,144 @@
1
- syntax = "proto3";
2
-
3
- package shift.v1;
4
-
5
- import "google/protobuf/timestamp.proto";
6
- import "common.proto";
7
-
8
- enum ShiftStatus {
9
- SHIFT_STATUS_UNSPECIFIED = 0;
10
- SHIFT_STATUS_OPEN = 1;
11
- SHIFT_STATUS_CLOSED = 2;
12
- SHIFT_STATUS_FAILED = 3;
13
- }
14
-
15
- enum ExternalTerminalStatus {
16
- EXTERNAL_TERMINAL_STATUS_UNSPECIFIED = 0;
17
- EXTERNAL_TERMINAL_STATUS_UNKNOWN = 1;
18
- EXTERNAL_TERMINAL_STATUS_OPEN = 2;
19
- EXTERNAL_TERMINAL_STATUS_CLOSED = 3;
20
- EXTERNAL_TERMINAL_STATUS_ERROR = 4;
21
- }
22
-
23
- message PosTerminal {
24
- string id = 1;
25
- string branch_id = 2;
26
- string name = 3;
27
- string base_url = 4;
28
- string token = 5;
29
- string port = 6;
30
- bool is_active = 7;
31
- ExternalTerminalStatus last_known_status = 8;
32
- optional google.protobuf.Timestamp last_status_checked_at = 9;
33
- optional string last_status_message = 10;
34
- google.protobuf.Timestamp created_at = 11;
35
- google.protobuf.Timestamp updated_at = 12;
36
- }
37
-
38
- message CashierShift {
39
- string id = 1;
40
- string branch_id = 2;
41
- string cashier_id = 3;
42
- string terminal_id = 4;
43
- ShiftStatus status = 5;
44
- google.protobuf.Timestamp opened_at = 6;
45
- optional google.protobuf.Timestamp closed_at = 7;
46
- optional string open_message = 8;
47
- optional string close_message = 9;
48
- optional int32 left_zreport_count_at_open = 10;
49
- optional int32 left_zreport_count_at_close = 11;
50
- optional string external_error_message = 12;
51
- google.protobuf.Timestamp created_at = 13;
52
- google.protobuf.Timestamp updated_at = 14;
53
- optional PosTerminal terminal = 15;
54
- }
55
-
56
- message CreateTerminalRequest {
57
- string branch_id = 1;
58
- string name = 2;
59
- string base_url = 3;
60
- string token = 4;
61
- string port = 5;
62
- optional bool is_active = 6;
63
- }
64
-
65
- message UpdateTerminalRequest {
66
- string id = 1;
67
- optional string name = 2;
68
- optional string base_url = 3;
69
- optional string token = 4;
70
- optional string port = 5;
71
- optional bool is_active = 6;
72
- }
73
-
74
- message ListTerminalsRequest {
75
- common.v1.PaginationRequest pagination = 1;
76
- optional string branch_id = 2;
77
- optional bool is_active = 3;
78
- optional string search = 4;
79
- }
80
-
81
- message ListTerminalsResponse {
82
- repeated PosTerminal items = 1;
83
- common.v1.PaginationMeta meta = 2;
84
- }
85
-
86
- message TerminalStatusResponse {
87
- string terminal_id = 1;
88
- bool is_open = 2;
89
- ExternalTerminalStatus status = 3;
90
- optional string message = 4;
91
- optional int32 left_zreport_count = 5;
92
- optional google.protobuf.Timestamp checked_at = 6;
93
- }
94
-
95
- message OpenShiftRequest {
96
- string cashier_id = 1;
97
- string terminal_id = 2;
98
- }
99
-
100
- message CloseShiftRequest {
101
- string shift_id = 1;
102
- string cashier_id = 2;
103
- optional string note = 3;
104
- }
105
-
106
- message GetCurrentShiftRequest {
107
- string cashier_id = 1;
108
- }
109
-
110
- message GetShiftByIdRequest {
111
- string shift_id = 1;
112
- }
113
-
114
- message ListShiftsRequest {
115
- common.v1.PaginationRequest pagination = 1;
116
- optional string branch_id = 2;
117
- optional string cashier_id = 3;
118
- optional string terminal_id = 4;
119
- optional ShiftStatus status = 5;
120
- optional string date_from = 6;
121
- optional string date_to = 7;
122
- }
123
-
124
- message ListShiftsResponse {
125
- repeated CashierShift items = 1;
126
- common.v1.PaginationMeta meta = 2;
127
- }
128
-
129
- service TerminalService {
130
- rpc CreateTerminal(CreateTerminalRequest) returns (PosTerminal);
131
- rpc UpdateTerminal(UpdateTerminalRequest) returns (PosTerminal);
132
- rpc GetTerminalById(common.v1.IdRequest) returns (PosTerminal);
133
- rpc ListTerminals(ListTerminalsRequest) returns (ListTerminalsResponse);
134
- rpc DeleteTerminal(common.v1.IdRequest) returns (common.v1.BoolResponse);
135
- rpc GetTerminalStatus(common.v1.IdRequest) returns (TerminalStatusResponse);
136
- }
137
-
138
- service ShiftService {
139
- rpc OpenShift(OpenShiftRequest) returns (CashierShift);
140
- rpc CloseShift(CloseShiftRequest) returns (CashierShift);
141
- rpc GetCurrentShift(GetCurrentShiftRequest) returns (CashierShift);
142
- rpc GetShiftById(GetShiftByIdRequest) returns (CashierShift);
143
- rpc ListShifts(ListShiftsRequest) returns (ListShiftsResponse);
1
+ syntax = "proto3";
2
+
3
+ package shift.v1;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+ import "common.proto";
7
+
8
+ enum ShiftStatus {
9
+ SHIFT_STATUS_UNSPECIFIED = 0;
10
+ SHIFT_STATUS_OPEN = 1;
11
+ SHIFT_STATUS_CLOSED = 2;
12
+ SHIFT_STATUS_FAILED = 3;
13
+ }
14
+
15
+ enum ExternalTerminalStatus {
16
+ EXTERNAL_TERMINAL_STATUS_UNSPECIFIED = 0;
17
+ EXTERNAL_TERMINAL_STATUS_UNKNOWN = 1;
18
+ EXTERNAL_TERMINAL_STATUS_OPEN = 2;
19
+ EXTERNAL_TERMINAL_STATUS_CLOSED = 3;
20
+ EXTERNAL_TERMINAL_STATUS_ERROR = 4;
21
+ }
22
+
23
+ message PosTerminal {
24
+ string id = 1;
25
+ string branch_id = 2;
26
+ string name = 3;
27
+ string base_url = 4;
28
+ string token = 5;
29
+ string port = 6;
30
+ bool is_active = 7;
31
+ ExternalTerminalStatus last_known_status = 8;
32
+ optional google.protobuf.Timestamp last_status_checked_at = 9;
33
+ optional string last_status_message = 10;
34
+ google.protobuf.Timestamp created_at = 11;
35
+ google.protobuf.Timestamp updated_at = 12;
36
+ }
37
+
38
+ message CashierShift {
39
+ string id = 1;
40
+ string branch_id = 2;
41
+ string cashier_id = 3;
42
+ string terminal_id = 4;
43
+ ShiftStatus status = 5;
44
+ google.protobuf.Timestamp opened_at = 6;
45
+ optional google.protobuf.Timestamp closed_at = 7;
46
+ optional string open_message = 8;
47
+ optional string close_message = 9;
48
+ optional int32 left_zreport_count_at_open = 10;
49
+ optional int32 left_zreport_count_at_close = 11;
50
+ optional string external_error_message = 12;
51
+ google.protobuf.Timestamp created_at = 13;
52
+ google.protobuf.Timestamp updated_at = 14;
53
+ optional PosTerminal terminal = 15;
54
+ }
55
+
56
+ message CreateTerminalRequest {
57
+ string branch_id = 1;
58
+ string name = 2;
59
+ string base_url = 3;
60
+ string token = 4;
61
+ string port = 5;
62
+ optional bool is_active = 6;
63
+ }
64
+
65
+ message UpdateTerminalRequest {
66
+ string id = 1;
67
+ optional string name = 2;
68
+ optional string base_url = 3;
69
+ optional string token = 4;
70
+ optional string port = 5;
71
+ optional bool is_active = 6;
72
+ }
73
+
74
+ message ListTerminalsRequest {
75
+ common.v1.PaginationRequest pagination = 1;
76
+ optional string branch_id = 2;
77
+ optional bool is_active = 3;
78
+ optional string search = 4;
79
+ }
80
+
81
+ message ListTerminalsResponse {
82
+ repeated PosTerminal items = 1;
83
+ common.v1.PaginationMeta meta = 2;
84
+ }
85
+
86
+ message TerminalStatusResponse {
87
+ string terminal_id = 1;
88
+ bool is_open = 2;
89
+ ExternalTerminalStatus status = 3;
90
+ optional string message = 4;
91
+ optional int32 left_zreport_count = 5;
92
+ optional google.protobuf.Timestamp checked_at = 6;
93
+ }
94
+
95
+ message OpenShiftRequest {
96
+ string cashier_id = 1;
97
+ string terminal_id = 2;
98
+ }
99
+
100
+ message CloseShiftRequest {
101
+ string shift_id = 1;
102
+ string cashier_id = 2;
103
+ optional string note = 3;
104
+ }
105
+
106
+ message GetCurrentShiftRequest {
107
+ string cashier_id = 1;
108
+ }
109
+
110
+ message GetShiftByIdRequest {
111
+ string shift_id = 1;
112
+ }
113
+
114
+ message ListShiftsRequest {
115
+ common.v1.PaginationRequest pagination = 1;
116
+ optional string branch_id = 2;
117
+ optional string cashier_id = 3;
118
+ optional string terminal_id = 4;
119
+ optional ShiftStatus status = 5;
120
+ optional string date_from = 6;
121
+ optional string date_to = 7;
122
+ }
123
+
124
+ message ListShiftsResponse {
125
+ repeated CashierShift items = 1;
126
+ common.v1.PaginationMeta meta = 2;
127
+ }
128
+
129
+ service TerminalService {
130
+ rpc CreateTerminal(CreateTerminalRequest) returns (PosTerminal);
131
+ rpc UpdateTerminal(UpdateTerminalRequest) returns (PosTerminal);
132
+ rpc GetTerminalById(common.v1.IdRequest) returns (PosTerminal);
133
+ rpc ListTerminals(ListTerminalsRequest) returns (ListTerminalsResponse);
134
+ rpc DeleteTerminal(common.v1.IdRequest) returns (common.v1.BoolResponse);
135
+ rpc GetTerminalStatus(common.v1.IdRequest) returns (TerminalStatusResponse);
136
+ }
137
+
138
+ service ShiftService {
139
+ rpc OpenShift(OpenShiftRequest) returns (CashierShift);
140
+ rpc CloseShift(CloseShiftRequest) returns (CashierShift);
141
+ rpc GetCurrentShift(GetCurrentShiftRequest) returns (CashierShift);
142
+ rpc GetShiftById(GetShiftByIdRequest) returns (CashierShift);
143
+ rpc ListShifts(ListShiftsRequest) returns (ListShiftsResponse);
144
144
  }