Skip to content

Commit adbd17a

Browse files
committed
refactor
1 parent c90fc48 commit adbd17a

5 files changed

+15
-11
lines changed

dist/tillo-provider.js

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/tillo-provider.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tillo-provider.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ function generateAuthSign(signData: Map<string, string>) {
1717
sd.delete("apiSecret")
1818
const sdList: any = []
1919

20-
2120
sd.forEach((v: any) => {
2221
sdList.push(v)
2322
})
@@ -111,7 +110,9 @@ function TilloProvider(this: any, options: TilloProviderOptions) {
111110

112111
const { clientRequestId, brand, currency, value, sector } = msg.q
113112

114-
const clientRId = clientRequestId || `${msg.q.user_id}-digitalissue-${timestamp}`
113+
const clientRId = clientRequestId ||
114+
`${msg.q.user_id}-${brand}-digitalissue-${value}-${timestamp}`
115+
115116
const curr = currency || "GBP"
116117

117118
const signData: Map<string, string> = new Map([
@@ -165,7 +166,7 @@ function TilloProvider(this: any, options: TilloProviderOptions) {
165166
}
166167

167168
this.shared.headers = {
168-
'API-Key': res.keymap.key.value,
169+
'API-Key': res.keymap.apikey.value,
169170
}
170171

171172
this.shared.secret = res.keymap.secret.value
@@ -183,7 +184,7 @@ function TilloProvider(this: any, options: TilloProviderOptions) {
183184
const defaults: TilloProviderOptions = {
184185

185186
// NOTE: include trailing /
186-
url: 'https://sandbox.tillo.dev/api/v2/',
187+
url: 'https://app.tillo.io/',
187188

188189
// Use global fetch by default - if exists
189190
fetch: ('undefined' === typeof fetch ? undefined : fetch),

test/local-config-template.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
module.exports = {
2+
TILLO_API_KEY: '<API_KEY>',
3+
TILLO_SECRET: '<SECRET>',
24
}

test/tillo-provider.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,22 @@ async function makeSeneca() {
8383
// debug: true,
8484
file: [__dirname + '/local-config.js;?'],
8585
var: {
86-
$TILLO_KEY: String,
86+
$TILLO_API_KEY: String,
8787
$TILLO_SECRET: String,
8888
}
8989
})
9090
.use('provider', {
9191
provider: {
9292
tillo: {
9393
keys: {
94-
key: { value: '$TILLO_KEY' },
94+
apikey: { value: '$TILLO_API_KEY' },
9595
secret: { value: '$TILLO_SECRET' },
9696
}
9797
}
9898
}
9999
})
100100
.use(TilloProvider, {
101-
// fetch: Fetch,
101+
url: 'https://sandbox.tillo.dev/api/v2/',
102102
})
103103

104104
return seneca.ready()

0 commit comments

Comments
 (0)