salix/print/templates/email/payment-update/payment-update.js

34 lines
880 B
JavaScript
Executable File

const Component = require(`${appPath}/core/component`);
const emailHeader = new Component('email-header');
const emailFooter = new Component('email-footer');
module.exports = {
name: 'payment-update',
async serverPrefetch() {
this.payMethod = await this.fetchPayMethod(this.recipientId);
if (!this.payMethod)
throw new Error('Something went wrong');
},
computed: {
accountAddress: function() {
return this.payMethod.iban.slice(-4);
},
},
methods: {
fetchPayMethod(clientId) {
return this.findOneFromDef('payMethod', [clientId]);
}
},
components: {
'email-header': emailHeader.build(),
'email-footer': emailFooter.build()
},
props: {
recipientId: {
type: [Number, String],
required: true
}
}
};