/** * Processed if payment is successfully written, send a receipt to the customer * and notification to the admin * * @see Payment_Extension::onAfterWrite() */ public function onAfterPayment() { $this->Status = $this->getPaid() ? self::STATUS_PROCESSING : self::STATUS_PENDING; $this->PaymentStatus = $this->getPaid() ? 'Paid' : 'Unpaid'; $this->write(); ReceiptEmail::create($this->Member(), $this)->send(); NotificationEmail::create($this->Member(), $this)->send(); $this->extend('onAfterPayment'); }
/** * Send a receipt if one has not already been sent. */ public function sendReceipt() { if (!$this->ReceiptSent) { $receipt = new ReceiptEmail($this->Member(), $this); if ($receipt->send()) { $this->ReceiptSent = true; $this->write(); } } }