@t-0/provider-starter-ts 0.4.8 → 0.4.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@t-0/provider-starter-ts",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "CLI tool to scaffold a Node.js t-0 Network integration service",
|
|
5
5
|
"main": "dist/create.js",
|
|
6
6
|
"bin": {
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"author": "New Settlement Technologies Inc.",
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@t-0/provider-sdk": "^1.0.49",
|
|
34
33
|
"chalk": "^4.1.2",
|
|
35
34
|
"fs-extra": "^11.1.1",
|
|
36
35
|
"inquirer": "^8.2.5"
|
|
@@ -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.49",
|
|
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.49",
|
|
126
|
+
"resolved": "https://registry.npmjs.org/@t-0/provider-sdk/-/provider-sdk-1.0.49.tgz",
|
|
127
|
+
"integrity": "sha512-5z1rz8FVAVzEd5eP2/QwzYJEGuVhS+ISkhvGn/NlyaTmtFiRq3D9rBBR7w0tJ2eLCoiA04Q+6l2TT3UCzD2KFQ==",
|
|
128
128
|
"dependencies": {
|
|
129
129
|
"@bufbuild/protobuf": "^2.10.0",
|
|
130
130
|
"@connectrpc/connect": "^2.1.0",
|
package/template/package.json
CHANGED
|
@@ -3,14 +3,12 @@ import {fromProtoDecimal, toProtoDecimal} from "./lib";
|
|
|
3
3
|
|
|
4
4
|
export default async function getQuote(networkClient: Client<typeof NetworkService>) {
|
|
5
5
|
const eurgbp = await networkClient.getQuote({
|
|
6
|
-
payInCurrency: "EUR",
|
|
7
|
-
payInMethod: PaymentMethodType.SEPA,
|
|
8
6
|
payOutCurrency: "GBP",
|
|
9
7
|
payOutMethod: PaymentMethodType.SWIFT,
|
|
10
8
|
quoteType: QuoteType.REALTIME,
|
|
11
9
|
amount: {
|
|
12
10
|
amount: {
|
|
13
|
-
case: '
|
|
11
|
+
case: 'payOutAmount',
|
|
14
12
|
value: toProtoDecimal(10, 0)
|
|
15
13
|
},
|
|
16
14
|
}
|
|
@@ -18,7 +16,7 @@ export default async function getQuote(networkClient: Client<typeof NetworkServi
|
|
|
18
16
|
|
|
19
17
|
switch (eurgbp.result.case) {
|
|
20
18
|
case 'success':
|
|
21
|
-
console.log(`
|
|
19
|
+
console.log(`USD/GBP: ${fromProtoDecimal(eurgbp.result.value.rate!)}`)
|
|
22
20
|
break;
|
|
23
21
|
case 'failure':
|
|
24
22
|
console.error(eurgbp.result.value.reason)
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {type Client, NetworkService, PaymentMethodType} from "@t-0/provider-sdk";
|
|
2
|
+
import {toProtoDecimal} from "./lib";
|
|
2
3
|
|
|
3
4
|
export default async function submitPayment(networkClient: Client<typeof NetworkService>): Promise<void> {
|
|
4
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
|
|
5
6
|
await networkClient.createPayment({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
currency: 'GBP',
|
|
8
|
+
amount: {
|
|
9
|
+
amount: {
|
|
10
|
+
case: "payOutAmount",
|
|
11
|
+
value: toProtoDecimal(10, 0),
|
|
12
|
+
},
|
|
9
13
|
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
iban: 'GB12345567890',
|
|
17
|
-
beneficiaryName: 'Max Mustermann',
|
|
18
|
-
}
|
|
14
|
+
paymentDetails: {
|
|
15
|
+
details: {
|
|
16
|
+
case: "sepa",
|
|
17
|
+
value: {
|
|
18
|
+
iban: 'GB12345567890',
|
|
19
|
+
beneficiaryName: 'Max Mustermann',
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
|
-
}
|
|
22
|
-
|
|
22
|
+
},
|
|
23
23
|
})
|
|
24
24
|
}
|