@just-education-org/rpc-contracts 1.17.2 → 1.18.1

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.
@@ -8,12 +8,16 @@ export interface CreatePaymentRequest {
8
8
  savePaymentMethod: boolean;
9
9
  /** ISO 4217, lowercase (e.g. "usd or uah"), as required by Stripe */
10
10
  currency: string;
11
+ bookingId: string;
11
12
  }
12
13
  export interface CreatePaymentResponse {
13
14
  url: string;
14
15
  }
15
16
  export interface ProcessPaymentEventRequest {
16
- /** Payment Success | Cancelled | Waiting for Captured? */
17
+ /**
18
+ * Our own normalized event type (PAYMENT_SUCCEEDED | PAYMENT_FAILED),
19
+ * not the provider's raw event type — keeps payment-service provider-agnostic
20
+ */
17
21
  event: string;
18
22
  paymentId: string;
19
23
  bookingId: string;
@@ -23,6 +27,13 @@ export interface ProcessPaymentEventRequest {
23
27
  /** bin */
24
28
  cardFirst6?: string | undefined;
25
29
  cardLast4?: string | undefined;
30
+ bank?: string | undefined;
31
+ brand?: string | undefined;
32
+ /**
33
+ * Final payment id at the provider (e.g. Stripe PaymentIntent) —
34
+ * written to Payment.providerId, replacing the intermediate id (e.g. Checkout Session)
35
+ */
36
+ providerIntentId?: string | undefined;
26
37
  }
27
38
  export interface ProcessPaymentEventResponse {
28
39
  ok: boolean;
@@ -0,0 +1,60 @@
1
+ import { Observable } from "rxjs";
2
+ export declare const protobufPackage = "payment_method.v1";
3
+ export interface GetUserPaymentMethodsRequest {
4
+ userId: string;
5
+ }
6
+ export interface GetUserPaymentMethodsResponse {
7
+ methods: PaymentMethodItem[];
8
+ }
9
+ export interface CreatePaymentMethodRequest {
10
+ userId: string;
11
+ }
12
+ export interface CreatePaymentMethodResponse {
13
+ id: string;
14
+ url: string;
15
+ }
16
+ /**
17
+ * - What is verify for?
18
+ * - The provider doesn't send a webhook when a payment method gets linked.
19
+ * We have to check this ourselves: on creation we make a PaymentMethod row
20
+ * in our DB (no card data yet) linked to the user, and once the user
21
+ * finishes linking it on the provider's page, the frontend redirects back
22
+ * with our internal payment method id as a query param — that's when we
23
+ * call VerifyPaymentMethod to look it up and confirm the link.
24
+ */
25
+ export interface VerifyPaymentMethodRequest {
26
+ userId: string;
27
+ methodId: string;
28
+ }
29
+ export interface VerifyPaymentMethodResponse {
30
+ ok: boolean;
31
+ }
32
+ export interface DeletePaymentMethodRequest {
33
+ userId: string;
34
+ methodId: string;
35
+ }
36
+ export interface DeletePaymentMethodResponse {
37
+ ok: boolean;
38
+ }
39
+ export interface PaymentMethodItem {
40
+ id: string;
41
+ bank?: string | undefined;
42
+ brand?: string | undefined;
43
+ first6?: string | undefined;
44
+ last4?: string | undefined;
45
+ }
46
+ export declare const PAYMENT_METHOD_V1_PACKAGE_NAME = "payment_method.v1";
47
+ export interface PaymentMethodServiceClient {
48
+ getUserPaymentMethods(request: GetUserPaymentMethodsRequest): Observable<GetUserPaymentMethodsResponse>;
49
+ createPaymentMethod(request: CreatePaymentMethodRequest): Observable<CreatePaymentMethodResponse>;
50
+ verifyPaymentMethod(request: VerifyPaymentMethodRequest): Observable<VerifyPaymentMethodResponse>;
51
+ deletePaymentMethod(request: DeletePaymentMethodRequest): Observable<DeletePaymentMethodResponse>;
52
+ }
53
+ export interface PaymentMethodServiceController {
54
+ getUserPaymentMethods(request: GetUserPaymentMethodsRequest): Promise<GetUserPaymentMethodsResponse> | Observable<GetUserPaymentMethodsResponse> | GetUserPaymentMethodsResponse;
55
+ createPaymentMethod(request: CreatePaymentMethodRequest): Promise<CreatePaymentMethodResponse> | Observable<CreatePaymentMethodResponse> | CreatePaymentMethodResponse;
56
+ verifyPaymentMethod(request: VerifyPaymentMethodRequest): Promise<VerifyPaymentMethodResponse> | Observable<VerifyPaymentMethodResponse> | VerifyPaymentMethodResponse;
57
+ deletePaymentMethod(request: DeletePaymentMethodRequest): Promise<DeletePaymentMethodResponse> | Observable<DeletePaymentMethodResponse> | DeletePaymentMethodResponse;
58
+ }
59
+ export declare function PaymentMethodServiceControllerMethods(): (constructor: Function) => void;
60
+ export declare const PAYMENT_METHOD_SERVICE_NAME = "PaymentMethodService";
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.12.0
5
+ // protoc v3.21.12
6
+ // source: payment_method.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.PAYMENT_METHOD_SERVICE_NAME = exports.PAYMENT_METHOD_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
9
+ exports.PaymentMethodServiceControllerMethods = PaymentMethodServiceControllerMethods;
10
+ /* eslint-disable */
11
+ const microservices_1 = require("@nestjs/microservices");
12
+ exports.protobufPackage = "payment_method.v1";
13
+ exports.PAYMENT_METHOD_V1_PACKAGE_NAME = "payment_method.v1";
14
+ function PaymentMethodServiceControllerMethods() {
15
+ return function (constructor) {
16
+ const grpcMethods = [
17
+ "getUserPaymentMethods",
18
+ "createPaymentMethod",
19
+ "verifyPaymentMethod",
20
+ "deletePaymentMethod",
21
+ ];
22
+ for (const method of grpcMethods) {
23
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
24
+ (0, microservices_1.GrpcMethod)("PaymentMethodService", method)(constructor.prototype[method], method, descriptor);
25
+ }
26
+ const grpcStreamMethods = [];
27
+ for (const method of grpcStreamMethods) {
28
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
29
+ (0, microservices_1.GrpcStreamMethod)("PaymentMethodService", method)(constructor.prototype[method], method, descriptor);
30
+ }
31
+ };
32
+ }
33
+ exports.PAYMENT_METHOD_SERVICE_NAME = "PaymentMethodService";
@@ -0,0 +1,28 @@
1
+ import { Observable } from "rxjs";
2
+ export declare const protobufPackage = "refund.v1";
3
+ export interface CreateRefundRequest {
4
+ bookingId: string;
5
+ userId: string;
6
+ }
7
+ export interface CreateRefundResponse {
8
+ ok: boolean;
9
+ }
10
+ export interface ProcessRefundEventRequest {
11
+ event: string;
12
+ providerRefundId: string;
13
+ status: string;
14
+ }
15
+ export interface ProcessRefundEventResponse {
16
+ ok: boolean;
17
+ }
18
+ export declare const REFUND_V1_PACKAGE_NAME = "refund.v1";
19
+ export interface RefundServiceClient {
20
+ createRefund(request: CreateRefundRequest): Observable<CreateRefundResponse>;
21
+ processRefundEvent(request: ProcessRefundEventRequest): Observable<ProcessRefundEventResponse>;
22
+ }
23
+ export interface RefundServiceController {
24
+ createRefund(request: CreateRefundRequest): Promise<CreateRefundResponse> | Observable<CreateRefundResponse> | CreateRefundResponse;
25
+ processRefundEvent(request: ProcessRefundEventRequest): Promise<ProcessRefundEventResponse> | Observable<ProcessRefundEventResponse> | ProcessRefundEventResponse;
26
+ }
27
+ export declare function RefundServiceControllerMethods(): (constructor: Function) => void;
28
+ export declare const REFUND_SERVICE_NAME = "RefundService";
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.12.0
5
+ // protoc v3.21.12
6
+ // source: refund.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.REFUND_SERVICE_NAME = exports.REFUND_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
9
+ exports.RefundServiceControllerMethods = RefundServiceControllerMethods;
10
+ /* eslint-disable */
11
+ const microservices_1 = require("@nestjs/microservices");
12
+ exports.protobufPackage = "refund.v1";
13
+ exports.REFUND_V1_PACKAGE_NAME = "refund.v1";
14
+ function RefundServiceControllerMethods() {
15
+ return function (constructor) {
16
+ const grpcMethods = ["createRefund", "processRefundEvent"];
17
+ for (const method of grpcMethods) {
18
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
19
+ (0, microservices_1.GrpcMethod)("RefundService", method)(constructor.prototype[method], method, descriptor);
20
+ }
21
+ const grpcStreamMethods = [];
22
+ for (const method of grpcStreamMethods) {
23
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
24
+ (0, microservices_1.GrpcStreamMethod)("RefundService", method)(constructor.prototype[method], method, descriptor);
25
+ }
26
+ };
27
+ }
28
+ exports.REFUND_SERVICE_NAME = "RefundService";
@@ -10,4 +10,6 @@ export declare const PROTO_PATHS: {
10
10
  readonly SEAT: string;
11
11
  readonly SCREENING: string;
12
12
  readonly PAYMENT: string;
13
+ readonly PAYMENT_METHOD: string;
14
+ readonly REFUND: string;
13
15
  };
@@ -14,4 +14,6 @@ exports.PROTO_PATHS = {
14
14
  SEAT: (0, path_1.join)(__dirname, "../../proto/seat.proto"),
15
15
  SCREENING: (0, path_1.join)(__dirname, "../../proto/screening.proto"),
16
16
  PAYMENT: (0, path_1.join)(__dirname, "../../proto/payment.proto"),
17
+ PAYMENT_METHOD: (0, path_1.join)(__dirname, "../../proto/payment_method.proto"),
18
+ REFUND: (0, path_1.join)(__dirname, "../../proto/refund.proto"),
17
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@just-education-org/rpc-contracts",
3
- "version": "1.17.2",
3
+ "version": "1.18.1",
4
4
  "description": "Protobuf definitions and generated TS types",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -14,6 +14,7 @@ message CreatePaymentRequest {
14
14
  optional string payment_method_id = 4;
15
15
  bool save_payment_method = 5;
16
16
  string currency = 6; // ISO 4217, lowercase (e.g. "usd or uah"), as required by Stripe
17
+ string booking_id = 7;
17
18
  }
18
19
 
19
20
  message CreatePaymentResponse {
@@ -21,14 +22,24 @@ message CreatePaymentResponse {
21
22
  }
22
23
 
23
24
  message ProcessPaymentEventRequest {
24
- string event = 1; // Payment Success | Cancelled | Waiting for Captured?
25
+ // Our own normalized event type (PAYMENT_SUCCEEDED | PAYMENT_FAILED),
26
+ // not the provider's raw event type — keeps payment-service provider-agnostic
27
+ string event = 1;
25
28
  string payment_id = 2;
26
29
  string booking_id = 3;
27
30
  string user_id = 4;
28
31
  bool save_payment_method = 5;
29
32
  optional string provider_method_id = 6;
33
+
30
34
  optional string card_first6 = 7; // bin
31
35
  optional string card_last4 = 8;
36
+
37
+ optional string bank = 9;
38
+ optional string brand = 10;
39
+
40
+ // Final payment id at the provider (e.g. Stripe PaymentIntent) —
41
+ // written to Payment.providerId, replacing the intermediate id (e.g. Checkout Session)
42
+ optional string provider_intent_id = 11;
32
43
  }
33
44
 
34
45
  message ProcessPaymentEventResponse {
@@ -0,0 +1,60 @@
1
+ syntax = "proto3";
2
+
3
+ package payment_method.v1;
4
+
5
+ service PaymentMethodService {
6
+ rpc GetUserPaymentMethods(GetUserPaymentMethodsRequest) returns(GetUserPaymentMethodsResponse);
7
+ rpc CreatePaymentMethod(CreatePaymentMethodRequest) returns(CreatePaymentMethodResponse);
8
+ rpc VerifyPaymentMethod(VerifyPaymentMethodRequest) returns(VerifyPaymentMethodResponse);
9
+ rpc DeletePaymentMethod(DeletePaymentMethodRequest) returns(DeletePaymentMethodResponse);
10
+ }
11
+ message GetUserPaymentMethodsRequest {
12
+ string user_id = 1;
13
+ }
14
+
15
+ message GetUserPaymentMethodsResponse {
16
+ repeated PaymentMethodItem methods = 1;
17
+ }
18
+
19
+ message CreatePaymentMethodRequest {
20
+ string user_id = 1;
21
+ }
22
+
23
+ message CreatePaymentMethodResponse {
24
+ string id = 1;
25
+ string url = 2;
26
+ }
27
+
28
+ message VerifyPaymentMethodRequest {
29
+ // - What is verify for?
30
+ // - The provider doesn't send a webhook when a payment method gets linked.
31
+ // We have to check this ourselves: on creation we make a PaymentMethod row
32
+ // in our DB (no card data yet) linked to the user, and once the user
33
+ // finishes linking it on the provider's page, the frontend redirects back
34
+ // with our internal payment method id as a query param — that's when we
35
+ // call VerifyPaymentMethod to look it up and confirm the link.
36
+
37
+ string user_id = 1;
38
+ string method_id = 2;
39
+ }
40
+
41
+ message VerifyPaymentMethodResponse {
42
+ bool ok = 1;
43
+ }
44
+
45
+ message DeletePaymentMethodRequest {
46
+ string user_id = 1;
47
+ string method_id = 2;
48
+ }
49
+
50
+ message DeletePaymentMethodResponse {
51
+ bool ok = 1;
52
+ }
53
+
54
+ message PaymentMethodItem {
55
+ string id = 1;
56
+ optional string bank = 2;
57
+ optional string brand = 3;
58
+ optional string first6 = 4;
59
+ optional string last4 = 5;
60
+ }
@@ -0,0 +1,27 @@
1
+ syntax = "proto3";
2
+
3
+ package refund.v1;
4
+
5
+ service RefundService {
6
+ rpc CreateRefund(CreateRefundRequest) returns(CreateRefundResponse);
7
+ rpc ProcessRefundEvent(ProcessRefundEventRequest) returns(ProcessRefundEventResponse);
8
+ }
9
+
10
+ message CreateRefundRequest {
11
+ string booking_id = 1;
12
+ string user_id = 2;
13
+ }
14
+
15
+ message CreateRefundResponse {
16
+ bool ok = 1;
17
+ }
18
+
19
+ message ProcessRefundEventRequest {
20
+ string event = 1;
21
+ string provider_refund_id = 2;
22
+ string status = 3;
23
+ }
24
+
25
+ message ProcessRefundEventResponse {
26
+ bool ok = 1;
27
+ }