Skip to content

Commit 7a563ef

Browse files
committed
fix(appmax): Removing mocked User-Agent and debug strange unauthorizeds on notes
Ensure logging when Appmax order creation seems to fail (status 200 means nothing)
1 parent c98b053 commit 7a563ef

File tree

4 files changed

+2
-5
lines changed

4 files changed

+2
-5
lines changed

packages/apps/appmax/lib-mjs/appmax-create-transaction.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ export default async (modBody) => {
133133
const response = await axios({
134134
method: 'post',
135135
url: appmaxBaseUri,
136-
headers: { 'User-Agent': 'SEC07-Lintfr-VA3' },
137136
data: appmaxTransaction,
138137
});
139138

@@ -215,6 +214,7 @@ export default async (modBody) => {
215214
updated_at: new Date().toISOString(),
216215
current: 'unauthorized',
217216
};
217+
transaction.notes = response.data.text;
218218
return { transaction };
219219
}
220220

packages/apps/appmax/lib-mjs/appmax-webhook.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const handleAppmaxWehook = async (req, res) => {
2121
`https://admin.appmax.com.br/api/v3/order/${appmaxOrderId}`,
2222
{
2323
params: { 'access-token': APPMAX_TOKEN },
24-
headers: { 'User-Agent': 'SEC07-Lintfr-VA3' },
2524
maxRedirects: 0,
2625
validateStatus(status) {
2726
return (status >= 200 && status <= 301) || status === 403;

packages/apps/appmax/lib-mjs/lib/appmax/create-order.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ export const createOrder = async (items, amount, appmaxCustomerId, token) => {
2727
const { data } = await axios({
2828
method: 'post',
2929
url: 'https://admin.appmax.com.br/api/v3/order',
30-
headers: { 'User-Agent': 'SEC07-Lintfr-VA3' },
3130
data: body,
3231
});
3332
if (data?.status === 200) {
3433
const orderId = data.order_id || data.data?.order_id || data.data?.id;
35-
return orderId;
34+
if (orderId) return orderId;
3635
}
3736
logger.warn('Unexpected response from Appmax create order', { body, data });
3837
return null;

packages/apps/appmax/lib-mjs/lib/appmax/get-customer.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export const createOrUpdateCustomer = async (
4747
const { data } = await axios({
4848
method: 'post',
4949
url: 'https://admin.appmax.com.br/api/v3/customer',
50-
headers: { 'User-Agent': 'SEC07-Lintfr-VA3' },
5150
data: body,
5251
});
5352
if (data?.status === 200) {

0 commit comments

Comments
 (0)