@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
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"version": "1.0.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@t-0/provider-sdk": "^1.0.
|
|
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.
|
|
126
|
-
"resolved": "https://registry.npmjs.org/@t-0/provider-sdk/-/provider-sdk-1.0.
|
|
127
|
-
"integrity": "sha512-
|
|
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",
|
package/template/package.json
CHANGED
|
@@ -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
|
-
|
|
7
|
-
|
|
6
|
+
const result = await networkClient.createPayment({
|
|
7
|
+
currency: 'GBP',
|
|
8
|
+
amount: {
|
|
8
9
|
amount: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
value: toProtoDecimal(10, 0),
|
|
12
|
-
},
|
|
10
|
+
case: "payOutAmount",
|
|
11
|
+
value: toProtoDecimal(10, 0),
|
|
13
12
|
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
}
|