saga-proto-contracts 1.0.8 → 1.0.9

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.
@@ -14,21 +14,21 @@ export interface ReserveRequest {
14
14
  }
15
15
  export interface ReserveResponse {
16
16
  reservationId: string;
17
- status: string;
17
+ status: ReservationStatus;
18
18
  }
19
19
  export interface CommitRequest {
20
20
  orderId: string;
21
21
  idempotencyKey: string;
22
22
  }
23
23
  export interface CommitResponse {
24
- status: string;
24
+ status: ReservationStatus;
25
25
  }
26
26
  export interface ReleaseRequest {
27
27
  orderId: string;
28
28
  idempotencyKey: string;
29
29
  }
30
30
  export interface ReleaseResponse {
31
- status: string;
31
+ status: ReservationStatus;
32
32
  }
33
33
  export interface ReserveItem {
34
34
  productId: string;
@@ -1,12 +1,13 @@
1
1
  import { Observable } from "rxjs";
2
2
  export declare const protobufPackage = "payment.v1";
3
3
  export declare enum PaymentStatus {
4
- PAYMENT_STATUS_UNKNOWN = 0,
4
+ PAYMENT_STATUS_UNSPECIFIED = 0,
5
5
  PAYMENT_STATUS_PENDING = 1,
6
- PAYMENT_STATUS_SUCCEEDED = 2,
7
- PAYMENT_STATUS_FAILED = 3,
6
+ PAYMENT_STATUS_HELD = 2,
7
+ PAYMENT_STATUS_CAPTURED = 3,
8
8
  PAYMENT_STATUS_CANCELLED = 4,
9
9
  PAYMENT_STATUS_REFUNDED = 5,
10
+ PAYMENT_STATUS_FAILED = 6,
10
11
  UNRECOGNIZED = -1
11
12
  }
12
13
  export interface CreatePaymentRequest {
@@ -26,7 +27,7 @@ export interface CancelPaymentRequest {
26
27
  idempotencyKey: string;
27
28
  }
28
29
  export interface CancelPaymentResponse {
29
- status: string;
30
+ status: PaymentStatus;
30
31
  }
31
32
  export interface RefundPaymentRequest {
32
33
  paymentId: string;
@@ -34,17 +35,30 @@ export interface RefundPaymentRequest {
34
35
  }
35
36
  export interface RefundPaymentResponse {
36
37
  refundId: string;
37
- status: string;
38
+ status: PaymentStatus;
39
+ }
40
+ export interface CapturePaymentRequest {
41
+ paymentId: string;
42
+ idempotencyKey: string;
43
+ }
44
+ export interface CapturePaymentResponse {
45
+ status: PaymentStatus;
38
46
  }
39
47
  export declare const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
40
48
  export interface PaymentServiceClient {
49
+ /** hold */
41
50
  createPayment(request: CreatePaymentRequest): Observable<CreatePaymentResponse>;
51
+ /** cancel hold */
42
52
  cancelPayment(request: CancelPaymentRequest): Observable<CancelPaymentResponse>;
53
+ capturePayment(request: CapturePaymentRequest): Observable<CapturePaymentResponse>;
43
54
  refundPayment(request: RefundPaymentRequest): Observable<RefundPaymentResponse>;
44
55
  }
45
56
  export interface PaymentServiceController {
57
+ /** hold */
46
58
  createPayment(request: CreatePaymentRequest): Promise<CreatePaymentResponse> | Observable<CreatePaymentResponse> | CreatePaymentResponse;
59
+ /** cancel hold */
47
60
  cancelPayment(request: CancelPaymentRequest): Promise<CancelPaymentResponse> | Observable<CancelPaymentResponse> | CancelPaymentResponse;
61
+ capturePayment(request: CapturePaymentRequest): Promise<CapturePaymentResponse> | Observable<CapturePaymentResponse> | CapturePaymentResponse;
48
62
  refundPayment(request: RefundPaymentRequest): Promise<RefundPaymentResponse> | Observable<RefundPaymentResponse> | RefundPaymentResponse;
49
63
  }
50
64
  export declare function PaymentServiceControllerMethods(): (constructor: Function) => void;
@@ -8,18 +8,19 @@ import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
8
8
  export const protobufPackage = "payment.v1";
9
9
  export var PaymentStatus;
10
10
  (function (PaymentStatus) {
11
- PaymentStatus[PaymentStatus["PAYMENT_STATUS_UNKNOWN"] = 0] = "PAYMENT_STATUS_UNKNOWN";
11
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_UNSPECIFIED"] = 0] = "PAYMENT_STATUS_UNSPECIFIED";
12
12
  PaymentStatus[PaymentStatus["PAYMENT_STATUS_PENDING"] = 1] = "PAYMENT_STATUS_PENDING";
13
- PaymentStatus[PaymentStatus["PAYMENT_STATUS_SUCCEEDED"] = 2] = "PAYMENT_STATUS_SUCCEEDED";
14
- PaymentStatus[PaymentStatus["PAYMENT_STATUS_FAILED"] = 3] = "PAYMENT_STATUS_FAILED";
13
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_HELD"] = 2] = "PAYMENT_STATUS_HELD";
14
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_CAPTURED"] = 3] = "PAYMENT_STATUS_CAPTURED";
15
15
  PaymentStatus[PaymentStatus["PAYMENT_STATUS_CANCELLED"] = 4] = "PAYMENT_STATUS_CANCELLED";
16
16
  PaymentStatus[PaymentStatus["PAYMENT_STATUS_REFUNDED"] = 5] = "PAYMENT_STATUS_REFUNDED";
17
+ PaymentStatus[PaymentStatus["PAYMENT_STATUS_FAILED"] = 6] = "PAYMENT_STATUS_FAILED";
17
18
  PaymentStatus[PaymentStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
18
19
  })(PaymentStatus || (PaymentStatus = {}));
19
20
  export const PAYMENT_V1_PACKAGE_NAME = "payment.v1";
20
21
  export function PaymentServiceControllerMethods() {
21
22
  return function (constructor) {
22
- const grpcMethods = ["createPayment", "cancelPayment", "refundPayment"];
23
+ const grpcMethods = ["createPayment", "cancelPayment", "capturePayment", "refundPayment"];
23
24
  for (const method of grpcMethods) {
24
25
  const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
25
26
  GrpcMethod("PaymentService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saga-proto-contracts",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -16,7 +16,7 @@ message ReserveRequest {
16
16
 
17
17
  message ReserveResponse {
18
18
  string reservation_id = 1;
19
- string status = 2;
19
+ ReservationStatus status = 2;
20
20
  }
21
21
 
22
22
  message CommitRequest {
@@ -25,7 +25,7 @@ message CommitRequest {
25
25
  }
26
26
 
27
27
  message CommitResponse {
28
- string status = 1;
28
+ ReservationStatus status = 1;
29
29
  }
30
30
 
31
31
  message ReleaseRequest {
@@ -34,7 +34,7 @@ message ReleaseRequest {
34
34
  }
35
35
 
36
36
  message ReleaseResponse {
37
- string status = 1;
37
+ ReservationStatus status = 1;
38
38
  }
39
39
 
40
40
  message ReserveItem {
@@ -15,7 +15,7 @@ message CreateOrderRequest {
15
15
  message CreateOrderResponse {
16
16
  string order_id = 1;
17
17
  OrderStatus status = 2;
18
- double total_price = 4;
18
+ int32 total_price = 4;
19
19
  }
20
20
 
21
21
  message OrderItem {
@@ -3,8 +3,9 @@ syntax = "proto3";
3
3
  package payment.v1;
4
4
 
5
5
  service PaymentService {
6
- rpc CreatePayment(CreatePaymentRequest) returns (CreatePaymentResponse);
7
- rpc CancelPayment(CancelPaymentRequest) returns (CancelPaymentResponse);
6
+ rpc CreatePayment(CreatePaymentRequest) returns (CreatePaymentResponse); // hold
7
+ rpc CancelPayment(CancelPaymentRequest) returns (CancelPaymentResponse); // cancel hold
8
+ rpc CapturePayment(CapturePaymentRequest) returns (CapturePaymentResponse);
8
9
  rpc RefundPayment(RefundPaymentRequest) returns (RefundPaymentResponse);
9
10
  }
10
11
 
@@ -29,7 +30,7 @@ message CancelPaymentRequest {
29
30
  }
30
31
 
31
32
  message CancelPaymentResponse {
32
- string status = 1;
33
+ PaymentStatus status = 1;
33
34
  }
34
35
 
35
36
  message RefundPaymentRequest {
@@ -39,14 +40,25 @@ message RefundPaymentRequest {
39
40
 
40
41
  message RefundPaymentResponse {
41
42
  string refund_id = 1;
42
- string status = 2;
43
+ PaymentStatus status = 2;
44
+ }
45
+
46
+
47
+ message CapturePaymentRequest {
48
+ string payment_id = 1;
49
+ string idempotency_key = 2;
50
+ }
51
+
52
+ message CapturePaymentResponse {
53
+ PaymentStatus status = 1;
43
54
  }
44
55
 
45
56
  enum PaymentStatus {
46
- PAYMENT_STATUS_UNKNOWN = 0;
47
- PAYMENT_STATUS_PENDING = 1;
48
- PAYMENT_STATUS_SUCCEEDED = 2;
49
- PAYMENT_STATUS_FAILED = 3;
50
- PAYMENT_STATUS_CANCELLED = 4;
51
- PAYMENT_STATUS_REFUNDED = 5;
57
+ PAYMENT_STATUS_UNSPECIFIED = 0;
58
+ PAYMENT_STATUS_PENDING = 1;
59
+ PAYMENT_STATUS_HELD = 2;
60
+ PAYMENT_STATUS_CAPTURED = 3;
61
+ PAYMENT_STATUS_CANCELLED = 4;
62
+ PAYMENT_STATUS_REFUNDED = 5;
63
+ PAYMENT_STATUS_FAILED = 6;
52
64
  }