Commit 20edbc9666dc69930e6480c6e156f3b2778d9cc9
1 parent
d23cd0f843
Exists in
master
remote product with quantity
Showing 1 changed file with 9 additions and 1 deletions Side-by-side Diff
lib/actions/buy.js
... | ... | @@ -39,13 +39,21 @@ module.exports = async (xid, transaction) => { |
39 | 39 | productName = iConfig.products[transaction.product_name].remote; |
40 | 40 | } |
41 | 41 | |
42 | + const productNames = productName.split(','); | |
43 | + // eslint-disable-next-line prefer-destructuring | |
44 | + let quantity = transaction.quantity; | |
45 | + | |
46 | + if (productNames.length >= 2) { | |
47 | + [productName, quantity] = productNames; | |
48 | + } | |
49 | + | |
42 | 50 | // const callbackUrl = `${iConfig.url}:${iConfig.port}/apikey/${iConfig.apikey}/updates`; |
43 | 51 | const result = await buyToSDS( |
44 | 52 | xid, |
45 | 53 | `${transaction.request_id}-${transaction.id}`, |
46 | 54 | transaction.destination, |
47 | 55 | productName, |
48 | - transaction.quantity, | |
56 | + quantity, | |
49 | 57 | ); |
50 | 58 | logger.verbose(`${MODULE_NAME} 5BDFAF41: result from sds`, { |
51 | 59 | xid, |