@t-0/provider-starter-ts 0.4.10 → 0.4.12

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t-0/provider-starter-ts",
3
- "version": "0.4.10",
3
+ "version": "0.4.12",
4
4
  "description": "CLI tool to scaffold a Node.js t-0 Network integration service",
5
5
  "main": "dist/create.js",
6
6
  "bin": {
@@ -23,13 +23,15 @@
23
23
  "version": "2.10.0",
24
24
  "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.10.0.tgz",
25
25
  "integrity": "sha512-fdRs9PSrBF7QUntpZpq6BTw58fhgGJojgg39m9oFOJGZT+nip9b0so5cYY1oWl5pvemDLr0cPPsH46vwThEbpQ==",
26
- "license": "(Apache-2.0 AND BSD-3-Clause)"
26
+ "license": "(Apache-2.0 AND BSD-3-Clause)",
27
+ "peer": true
27
28
  },
28
29
  "node_modules/@connectrpc/connect": {
29
30
  "version": "2.1.0",
30
31
  "resolved": "https://registry.npmjs.org/@connectrpc/connect/-/connect-2.1.0.tgz",
31
32
  "integrity": "sha512-xhiwnYlJNHzmFsRw+iSPIwXR/xweTvTw8x5HiwWp10sbVtd4OpOXbRgE7V58xs1EC17fzusF1f5uOAy24OkBuA==",
32
33
  "license": "Apache-2.0",
34
+ "peer": true,
33
35
  "peerDependencies": {
34
36
  "@bufbuild/protobuf": "^2.7.0"
35
37
  }
@@ -166,6 +168,7 @@
166
168
  "integrity": "sha512-ZsJzA5thDQMSQO788d7IocwwQbI8B5OPzmqNvpf3NY/+MHDAS759Wo0gd2WQeXYt5AAAQjzcrTVC6SKCuYgoCQ==",
167
169
  "dev": true,
168
170
  "license": "MIT",
171
+ "peer": true,
169
172
  "dependencies": {
170
173
  "undici-types": "~6.21.0"
171
174
  }
@@ -295,6 +298,7 @@
295
298
  "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
296
299
  "dev": true,
297
300
  "license": "Apache-2.0",
301
+ "peer": true,
298
302
  "bin": {
299
303
  "tsc": "bin/tsc",
300
304
  "tsserver": "bin/tsserver"
@@ -1,58 +1,72 @@
1
1
  import {
2
- PayoutRequest,
3
- PayoutResponse,
4
- UpdatePaymentRequest,
5
- UpdateLimitRequest,
6
- UpdateLimitResponse,
7
- AppendLedgerEntriesRequest,
8
- AppendLedgerEntriesResponse,
9
- UpdatePaymentResponse,
10
- HandlerContext, type Client, NetworkService,
2
+ AppendLedgerEntriesRequest,
3
+ AppendLedgerEntriesResponse,
4
+ ApprovePaymentQuoteRequest,
5
+ ApprovePaymentQuoteResponse,
6
+ type Client,
7
+ HandlerContext,
8
+ NetworkService,
9
+ PayoutRequest,
10
+ PayoutResponse,
11
+ UpdateLimitRequest,
12
+ UpdateLimitResponse,
13
+ UpdatePaymentRequest,
14
+ UpdatePaymentResponse,
11
15
  } from "@t-0/provider-sdk";
12
16
 
13
17
  /*
14
18
  Please refer to docs, proto definition comments or source code comments to understand purpose of fields
15
19
  */
16
20
  const CreateProviderService = (networkClient: Client<typeof NetworkService>) => {
17
- return {
18
- async updatePayment(req: UpdatePaymentRequest, _: HandlerContext) {
19
- // TODO: Step 2.1 implement how you handle updates of payment initiated by you
20
- console.log(`Received payment update for ${req.paymentId}, payment ${req.result.case}`)
21
- return {} as UpdatePaymentResponse
22
- },
21
+ return {
22
+ async updatePayment(req: UpdatePaymentRequest, _: HandlerContext) {
23
+ // TODO: Step 2.1 implement how you handle updates of payment initiated by you
24
+ console.log(`Received payment update for ${req.paymentId}, payment ${req.result.case}`)
25
+ return {} as UpdatePaymentResponse
26
+ },
27
+
28
+ async payOut(req: PayoutRequest, _: HandlerContext) {
29
+ // TODO: Step 2.4 implement how you do payouts (payments initiated by your counterparts)
30
+ console.log(`Received payout request ${req.payoutId}`)
23
31
 
24
- async payOut(req: PayoutRequest, _: HandlerContext) {
25
- // TODO: Step 2.4 implement how you do payouts (payments initiated by your counterparts)
26
- console.log(`Received payout request ${req.payoutId}`)
32
+ //TODO: confirmPayout should be called when you system notifies that payout has been made successfully
33
+ setInterval(() => {
34
+ networkClient.confirmPayout({
35
+ paymentId: req.paymentId,
36
+ payoutId: req.payoutId,
37
+ })
38
+ }, 2000);
39
+ return {
40
+ result: {
41
+ case: "accepted",
42
+ value: {},
43
+ },
44
+ } as PayoutResponse
45
+ },
27
46
 
28
- //TODO: confirmPayout should be called when you system notifies that payout has been made successfully
29
- setInterval(() => {
30
- networkClient.confirmPayout({
31
- paymentId: req.paymentId,
32
- payoutId: req.payoutId,
33
- })
34
- }, 2000);
35
- return {
36
- result: {
37
- case: "accepted",
38
- value: {},
47
+ async updateLimit(req: UpdateLimitRequest, _: HandlerContext) {
48
+ // TODO: optionally implement updates on your limits and limits usage
49
+ console.log(`Received update of limits with provider ${req.limits[0].counterpartId}`)
50
+ return {} as UpdateLimitResponse
39
51
  },
40
- } as PayoutResponse
41
- },
42
52
 
43
- async updateLimit(req: UpdateLimitRequest, _: HandlerContext) {
44
- // TODO: optionally implement updates on your limits and limits usage
45
- console.log(`Received update of limits with provider ${req.limits[0].counterpartId}`)
46
- return {} as UpdateLimitResponse
47
- },
53
+ async appendLedgerEntries(req: AppendLedgerEntriesRequest, _: HandlerContext) {
54
+ // TODO: optionally implement handling of new ledger transactions and new ledger entries
55
+ console.log(`Received ledger entries for ${req.transactions} transaction(s)`)
56
+ return {} as AppendLedgerEntriesResponse
57
+ },
48
58
 
49
- async appendLedgerEntries(req: AppendLedgerEntriesRequest, _: HandlerContext) {
50
- // TODO: optionally implement handling of new ledger transactions and new ledger entries
51
- console.log(`Received ledger entries for ${req.transactions} transaction(s)`)
52
- return {
53
- } as AppendLedgerEntriesResponse
54
- },
55
- }
59
+ async approvePaymentQuote(req: ApprovePaymentQuoteRequest, _: HandlerContext) {
60
+ // TODO: when the payment goes through the Manual AML Check on the pay-out provider side, the provider submitted the payment will have a last look to approve final quote
61
+ console.log(`Received approve payment quote request for ${req.paymentId}`)
62
+ return {
63
+ result: {
64
+ case: "accepted",
65
+ value: {}
66
+ }
67
+ } as ApprovePaymentQuoteResponse
68
+ }
69
+ }
56
70
  };
57
71
 
58
72
  export default CreateProviderService;