From 3f28c67f9372387f3a5bc45d5352499d6f919afc Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 1 Aug 2016 00:08:05 +0200 Subject: Payment confirmation --- classes/Payment.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'classes/Payment.php') 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(); + } } -- cgit v1.2.3