diff options
author | Camil Staps | 2016-08-01 00:08:05 +0200 |
---|---|---|
committer | Camil Staps | 2016-08-01 00:08:05 +0200 |
commit | 3f28c67f9372387f3a5bc45d5352499d6f919afc (patch) | |
tree | 75f359a414b8f60236925cd6da3932dd582db256 /classes | |
parent | Easier emails (diff) |
Payment confirmation
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Correspondence.php | 3 | ||||
-rw-r--r-- | classes/Payment.php | 24 |
2 files changed, 27 insertions, 0 deletions
diff --git a/classes/Correspondence.php b/classes/Correspondence.php index 80c4c87..e2a0771 100644 --- a/classes/Correspondence.php +++ b/classes/Correspondence.php @@ -109,6 +109,9 @@ class Correspondence extends FPDF { 'mail-offer' => [ 'en' => "Dear {{getContact-name}},\r\n\r\nPlease find attached your invoice. You can either pay by bank transfer, as indicated on the invoice, or using Paypal or a credit card on {{getPaymentUrl}}.\r\n\r\nThank you in advance,\r\n\r\n{{{invoice_name}}}", 'nl' => "Beste {{getContact-name}},\r\n\r\nBijgevoegd vindt u uw factuur. U kunt per bankoverschrijving betalen, zoals aangegeven op de factuur, of met Paypal of een credit card op {{getPaymentUrl}}.\r\n\r\nAlvast hartelijk dank,\r\n\r\n{{{invoice_name}}}"], + 'mail-offer-paid' => [ + 'en' => "Dear {{getOffer-getContact-name}},\r\n\r\nYour invoice at {{getOffer-getPaymentUrl}} has been paid.\r\n\r\nThank you,\r\n\r\n{{{invoice_name}}}", + 'nl' => "Beste {{getOffer-getContact-name}},\r\n\r\nUw factuur op {{getOffer-getPaymentUrl}} is betaald.\r\n\r\nHartelijk dank,\r\n\r\n{{{invoice_name}}}"], ]; /** @var $page_height The height of a page in millimeters */ diff --git a/classes/Payment.php b/classes/Payment.php index 4b8c12b..64b65ae 100644 --- a/classes/Payment.php +++ b/classes/Payment.php @@ -68,4 +68,28 @@ class Payment extends Model { return parent::mutator($key, $value); } } + + /** + * Make a mailer to send about this payment + * + * @return Mailer The mailer + */ + public function mailer() { + $mailer = new Mailer($this->pdo); + $mailer->setOffer($this->getOffer()); + + $mailer->Subject = 'Your invoice has been paid'; + $mailer->Body = Correspondence::__r('mail-offer-paid', $this->getOffer()->getContact()->language, $this); + + return $mailer; + } + + /** + * Send the payment notification to the offer's contact + * + * @return bool The result of Mailer::send + */ + public function send() { + return $this->mailer()->send(); + } } |