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

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.12",
3
+ "version": "0.4.13",
4
4
  "description": "CLI tool to scaffold a Node.js t-0 Network integration service",
5
5
  "main": "dist/create.js",
6
6
  "bin": {
@@ -9,7 +9,7 @@
9
9
  "version": "1.0.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@t-0/provider-sdk": "^1.0.50",
12
+ "@t-0/provider-sdk": "^1.0.51",
13
13
  "dotenv": "^16.3.1",
14
14
  "tiny-invariant": "^1.3.3"
15
15
  },
@@ -122,9 +122,9 @@
122
122
  }
123
123
  },
124
124
  "node_modules/@t-0/provider-sdk": {
125
- "version": "1.0.50",
126
- "resolved": "https://registry.npmjs.org/@t-0/provider-sdk/-/provider-sdk-1.0.50.tgz",
127
- "integrity": "sha512-8Lb2mqGBB9aOOpocbXNql6dWBCl7iuqSU/o49E1qXtvuzUwzer3hu5QqKg6YBAegH/RU5VjbzNwQHz1Pu2svlg==",
125
+ "version": "1.0.51",
126
+ "resolved": "https://registry.npmjs.org/@t-0/provider-sdk/-/provider-sdk-1.0.51.tgz",
127
+ "integrity": "sha512-HsC5DUIoV/1GNRIdVHvDP7PHdV6ccw864kjBoX4z6nj0QxyzGG/+UET+gEu6JedrPIdxC5KCSfr/had99cSvQw==",
128
128
  "dependencies": {
129
129
  "@bufbuild/protobuf": "^2.10.0",
130
130
  "@connectrpc/connect": "^2.1.0",
@@ -12,7 +12,7 @@
12
12
  "author": "",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@t-0/provider-sdk": "^1.0.50",
15
+ "@t-0/provider-sdk": "^1.0.51",
16
16
  "dotenv": "^16.3.1",
17
17
  "tiny-invariant": "^1.3.3"
18
18
  },
@@ -3,22 +3,31 @@ import {toProtoDecimal} from "./lib";
3
3
 
4
4
  export default async function submitPayment(networkClient: Client<typeof NetworkService>): Promise<void> {
5
5
  // TODO: Step 2.3 replace this with receiving quotes from you systems and publishing them into t-0 Network. We recommend publishing at least once per 5 seconds, but not more than once per second
6
- await networkClient.createPayment({
7
- currency: 'GBP',
6
+ const result = await networkClient.createPayment({
7
+ currency: 'GBP',
8
+ amount: {
8
9
  amount: {
9
- amount: {
10
- case: "payOutAmount",
11
- value: toProtoDecimal(10, 0),
12
- },
10
+ case: "payOutAmount",
11
+ value: toProtoDecimal(10, 0),
13
12
  },
14
- paymentDetails: {
15
- details: {
16
- case: "sepa",
17
- value: {
18
- iban: 'GB12345567890',
19
- beneficiaryName: 'Max Mustermann',
20
- }
13
+ },
14
+ paymentDetails: {
15
+ details: {
16
+ case: "sepa",
17
+ value: {
18
+ iban: 'GB12345567890',
19
+ beneficiaryName: 'Max Mustermann',
21
20
  }
22
- },
23
- })
21
+ }
22
+ },
23
+ })
24
+
25
+ switch (result.result.case) {
26
+ case 'accepted':
27
+ console.log(`Payment accepted, ${result.result.value.settlementAmount} USD to settle`)
28
+ break;
29
+ case 'failure':
30
+ console.log(`Payment failed with '${result.result.value.reason}'`)
31
+ break;
32
+ }
24
33
  }