Skip to content
Permalink
Browse files

Clean up failed cherry-picking fallout

  • Loading branch information
bkimminich committed Dec 13, 2019
1 parent 2eec8ae commit 0993b4a3e4ab7c6cb5d1a69332def7e4d193df80
Showing with 3 additions and 11 deletions.
  1. +0 −7 lib/utils.js
  2. +3 −4 routes/order.js
@@ -229,10 +229,3 @@ exports.toSimpleIpAddress = (ipv6) => {
exports.thaw = (frozenObject) => {
return JSON.parse(JSON.stringify(frozenObject))
}

exports.longestWord = (sentence) => {
if (sentence && sentence.indexOf(' ') > -1) {
return sentence.split(' ').sort((word, otherWord) => { return otherWord.length - word.length })[0]
}
return sentence
}
@@ -19,8 +19,7 @@ module.exports = function placeOrder () {
const email = customer ? customer.data ? customer.data.email : '' : ''
const orderId = insecurity.hash(email).slice(0, 4) + '-' + utils.randomHexString(16)
const pdfFile = `order_${orderId}.pdf`
const ownerPassword = utils.longestWord(config.get('application.name')) + '2019'
const doc = new PDFDocument({ ownerPassword, permissions: { printing: 'lowResolution' } })
const doc = new PDFDocument()
const date = new Date().toJSON().slice(0, 10)
const fileWriter = doc.pipe(fs.createWriteStream(path.join(__dirname, '../ftp/', pdfFile)))
let logo = config.get('application.logo')
@@ -123,7 +122,7 @@ module.exports = function placeOrder () {
doc.font('Times-Roman', 15).text(`(${req.__('The bonus points from this order will be added 1:1 to your wallet ¤-fund for future purchases!')})`)
doc.moveDown()
doc.moveDown()
doc.font('Times-Roman', 15).text('Thank you for your order!')
doc.font('Times-Roman', 15).text(req.__('Thank you for your order!'))
doc.moveDown()
doc.image(path.join(__dirname, '../frontend/dist/frontend/assets/public/images/', logo), { width: 50 })
doc.end()
@@ -143,7 +142,7 @@ module.exports = function placeOrder () {
})
}

db.orders.insert({
await db.orders.insert({
promotionalAmount: discountAmount,
paymentId: req.body.orderDetails ? req.body.orderDetails.paymentId : null,
addressId: req.body.orderDetails ? req.body.orderDetails.addressId : null,

0 comments on commit 0993b4a

Please sign in to comment.
You can’t perform that action at this time.