Skip to content

Commit

Permalink
fix: tentativa de correção do erro 4 utilizando o modelo sugerido na doc
Browse files Browse the repository at this point in the history
  • Loading branch information
isaquefms committed Aug 24, 2019
1 parent f2abe49 commit 05f1118
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ typings/

# dotenv environment variables file
.env

# Config file
config/config.json
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']};
module.exports = {extends: ['@commitlint/config-angular']};
23 changes: 21 additions & 2 deletions lib/Checkout/SaveTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,27 @@ module.exports = (transactionBody, orderId, storeId) => {
'\nTransaction body:' +
'\n' + JSON.stringify(transactionBody, null, 2)
logger.error(new Error(msg))
if (err) {
logger.error(err)
if (err) { // Error in the save transaction method.
logger.error(err) // We need execute patch method for cancel the order.
let endpoint = 'orders/' + orderId + '.json'
body = {
"code": "P05NX",
"status": "cancelled",
"financial_status": {
"current": "pending"
},
"fulfillment_status": {
"current": "invoice_issued"
},
"amount": {},
"staff_notes": "Error in the save transaction method."
}

Api(endpoint, 'PATCH', body, storeId, err => {
if(err) {
logger.error(err)
}
})
}
})
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
},
"devDependencies": {
"@commitlint/cli": "^8.1.0",
"@commitlint/config-angular": "^8.1.0",
"@commitlint/config-conventional": "^8.1.0",
"debug": "^4.1.1",
"husky": "^2.7.0",
Expand Down
2 changes: 1 addition & 1 deletion routes/#checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ module.exports = (checkoutBody, checkoutRespond, storeId) => {
'payer',
'currency_id',
'currency_symbol',
'status' // Getting the status and add to payment_history.
'status' // Getting the status.
].forEach(field => {
if (transactionBody.hasOwnProperty(field) && !transaction.hasOwnProperty(field)) {
transaction[field] = transactionBody[field]
Expand Down

0 comments on commit 05f1118

Please sign in to comment.