Skip to content

Commit a061685

Browse files
feat(import-order): search tiny order by numeroEcommerce with prefix 'ecom:' (#141)
* chore(import-order): use another propertie to get search order * Update functions/lib/integration/import-order.js * Update functions/lib/integration/import-order.js * Update functions/lib/integration/import-order.js --------- Co-authored-by: Leonardo Matos <leomp120894@gmail.com>
1 parent f40d7a9 commit a061685

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

functions/lib/integration/import-order.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ module.exports = ({ appSdk, storeId, auth }, tinyToken, queueEntry, appData, can
103103
if (typeof tinyOrderNumber === 'string' && tinyOrderNumber.startsWith('id:')) {
104104
job = getTinyOrder(tinyOrderNumber.substring(3))
105105
} else {
106-
job = tiny.post('/pedidos.pesquisa.php', { numero: tinyOrderNumber })
106+
const filter = typeof tinyOrderNumber === 'string' && tinyOrderNumber.startsWith('ecom:')
107+
? { numeroEcommerce: tinyOrderNumber.substring(5) }
108+
: { numero: tinyOrderNumber }
109+
job = tiny.post('/pedidos.pesquisa.php', filter)
107110
.then(({ pedidos }) => {
108111
const tinyOrder = pedidos.find(({ pedido }) => Number(tinyOrderNumber) === Number(pedido.numero))
109112
if (tinyOrder) {

0 commit comments

Comments
 (0)