コード例 #1
0
 /**
  * Send a customer a notification.
  *
  * @param Event\EntityEvent $event
  */
 public function sendCustomerNotification(Event\EntityEvent $event)
 {
     $note = $event->getEntity();
     if (!$note instanceof Note or !$note->customerNotified) {
         return false;
     }
     $factory = $this->get('mail.factory.order.note.notification')->set('order', $event->getOrder())->set('note', $note);
     $this->get('mail.dispatcher')->send($factory->getMessage());
 }
コード例 #2
0
 /**
  * Creates a transaction for contract payments when a payment is added to a
  * contract.
  *
  * @param  Event\EntityEvent $event event carrying information about created
  *                                  entity
  */
 public function createPaymentTransaction(Event\EntityEvent $event)
 {
     $payment = $event->getEntity();
     $order = $event->getOrder();
     if ($payment instanceof Payment && $order->status->code === Statuses::PAYMENT_PENDING && null !== $order->id) {
         $transaction = new Transaction();
         $transaction->records->add($payment);
         $transaction->type = Types::CONTRACT_PAYMENT;
         $this->get('order.transaction.create')->setDbTransaction($event->getTransaction())->create($transaction);
     }
 }