Payment notify event handler.

@param PaymentEvent $event
779304
public function onPaymentNotify(PaymentEvent $event)
    {
        $payment = $event->getPayment();
        if (!$payment instanceof OrderPayment) {
            return;
        }

        $order = $payment->getOrder();

        if ($order->getLocked()) {
            $order->setLocked(false);
            $this->updateOrder($order, $event);
        }
    }
1191152
@SuppressWarnings("unused")
    @Override
    public void onPaymentSuccess(String razorpayPaymentID) {
        try {
            Toast.makeText(this, "Payment Successful: " + razorpayPaymentID, Toast.LENGTH_SHORT).show();
        } catch (Exception e) {
            Log.e(TAG, "Exception in onPaymentSuccess", e);
        }
    }
1149440
public function notify(Event $event)
    {
        $processed = false;
        foreach ($this->listeners as $listener) {
            if ($listener->match($event)) {
                $listener->handle($event);
                $processed = true;
                if ($event->isPropagationStopped()) {
                    break;
                }
            }
        }
        return $processed;
    }
1234820
protected function sendPaymentNotification($orderId, $orderReference, $paymentStatus, $payboxMessage)
    {
        $this->getMailer()->sendEmailToShopManagers(
            Paybox::NOTIFICATION_MESSAGE_NAME,
            [
                'order_ref' => $orderReference,
                'order_id' => $orderId,
                'paybox_payment_status' => $paymentStatus,
                'paybox_message' => $payboxMessage
            ]
        );
    }
553690
public function notify($eventType, MvcInterface $entity) {
        $this->setEntity($entity);
        switch($eventType) {
            case self::EVENT_UPLOAD_FILE_CREATE:
                $this->processUploads(true);
                break;
            case self::EVENT_UPLOAD_FILE_UPDATE:
                $this->processUploads(false);
                break;
        }
    }
1279651
public function onPreSubmit(FormEvent $event)
    {
        $data = $event->getData();

        if ($data['file'] instanceof UploadedFile) {
            $event->getForm()->remove('remove');
        }

        if (empty($data['file']) && (!isset($data['remove']) || !$data['remove'])) {
            $event->setData($event->getForm()->getViewData());
        }
    }
614181
public function notifyPaymentOrderCreated(
        PaymentBridgeInterface $paymentBridge,
        PaymentMethodInterface $paymentMethod
    ) {
        $paymentOrderCreatedEvent = new PaymentOrderCreatedEvent(
            $paymentBridge,
            $paymentMethod
        );

        $this
            ->eventDispatcher
            ->dispatch(
                PaymentCoreEvents::PAYMENT_ORDER_CREATED,
                $paymentOrderCreatedEvent
            );

        return $this;
    }
3291
function after_process() {
    global $insert_id, $db, $order;
    if ($_SESSION['paypal_transaction_PDT_passed'] != true) {
      $_SESSION['order_created'] = '';
      unset($_SESSION['paypal_transaction_PDT_passed']);
      return false;
    } else {
    // PDT found order to be approved, so add a new OSH record for this order's PP details
      unset($_SESSION['paypal_transaction_PDT_passed']);
      $sql_data_array= array(array('fieldName'=>'orders_id', 'value'=>$insert_id, 'type'=>'integer'),
                             array('fieldName'=>'orders_status_id', 'value'=>$this->order_status, 'type'=>'integer'),
                             array('fieldName'=>'date_added', 'value'=>'now()', 'type'=>'noquotestring'),
                             array('fieldName'=>'customer_notified', 'value'=>0, 'type'=>'integer'),
                             array('fieldName'=>'comments', 'value'=>'PayPal status: ' . $this->pdtData['payment_status'] . ' ' . ' @ ' . $this->pdtData['payment_date'] . "\n" . ' Trans ID:' . $this->pdtData['txn_id'] . "\n" . ' Amount: ' . $this->pdtData['mc_gross'] . ' ' . $this->pdtData['mc_currency'] . '.', 'type'=>'string'));
      $db->perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
      ipn_debug_email('PDT NOTICE :: Order added: ' . $insert_id . "\n" . 'PayPal status: ' . $this->pdtData['payment_status'] . ' ' . ' @ ' . $this->pdtData['payment_date'] . "\n" . ' Trans ID:' . $this->pdtData['txn_id'] . "\n" . ' Amount: ' . $this->pdtData['mc_gross'] . ' ' . $this->pdtData['mc_currency']);

      // store the PayPal order meta data -- used for later matching and back-end processing activities
      $sql_data_array = array('order_id' => $insert_id,
                          'txn_type' => $this->pdtData['txn_type'],
                          'module_name' => $this->code . ' ' . $this->codeVersion,
                          'module_mode' => 'PDT',
                          'reason_code' => $this->pdtData['reasoncode'],
                          'payment_type' => $this->pdtData['payment_type'],
                          'payment_status' => $this->pdtData['payment_status'],
                          'pending_reason' => $this->pdtData['pendingreason'],
                          'invoice' => $this->pdtData['invoice'],
                          'first_name' => $this->pdtData['first_name'],
                          'last_name' => $this->pdtData['last_name'],
                          'payer_business_name' => $order->billing['company'],
                          'address_name' => $order->billing['name'],
                          'address_street' => $order->billing['street_address'],
                          'address_city' => $order->billing['city'],
                          'address_state' => $order->billing['state'],
                          'address_zip' => $order->billing['postcode'],
                          'address_country' => $this->pdtData['residence_country'], // $order->billing['country']
                          'address_status' => $this->pdtData['address_status'],
                          'payer_email' => $this->pdtData['payer_email'],
                          'payer_id' => $this->pdtData['payer_id'],
                          'payer_status' => $this->pdtData['payer_status'],
                          'payment_date' => datetime_to_sql_format($this->pdtData['payment_date']),
                          'business' => $this->pdtData['business'],
                          'receiver_email' => $this->pdtData['receiver_email'],
                          'receiver_id' => $this->pdtData['receiver_id'],
                          'txn_id' => $this->pdtData['txn_id'],
                          'parent_txn_id' => $this->pdtData['parent_txn_id'],
                          'num_cart_items' => (float)$this->pdtData['num_cart_items'],
                          'mc_gross' => (float)$this->pdtData['mc_gross'],
                          'mc_fee' => (float)$this->pdtData['mc_fee'],
                          'mc_currency' => $this->pdtData['mc_currency'],
                          'settle_amount' => (float)$this->pdtData['settle_amount'],
                          'settle_currency' => $this->pdtData['settle_currency'],
                          'exchange_rate' => ($this->pdtData['exchange_rate'] > 0 ? $this->pdtData['exchange_rate'] : 1.0),
                          'notify_version' => (float)$this->pdtData['notify_version'],
                          'verify_sign' => $this->pdtData['verify_sign'],
                          'date_added' => 'now()',
                          'memo' => '{Successful PDT Confirmation - Record auto-generated by payment module}'
                         );
//TODO: $db->perform vs zen_db_perform
      zen_db_perform(TABLE_PAYPAL, $sql_data_array);
      ipn_debug_email('PDT NOTICE :: paypal table updated: ' . print_r($sql_data_array, true));
    }
  }
628515
public function notifyPaymentOrderSuccess(
        PaymentBridgeInterface $paymentBridge,
        PaymentMethodInterface $paymentMethod
    ) {
        $paymentOrderSuccessEvent = new PaymentOrderSuccessEvent(
            $paymentBridge,
            $paymentMethod
        );

        $this
            ->eventDispatcher
            ->dispatch(
                PaymentCoreEvents::PAYMENT_ORDER_SUCCESS,
                $paymentOrderSuccessEvent
            );

        return $this;
    }
1148613
public function notify( ServesEventData $event )
	{
		$namespaceComponents = explode( "\\", get_class( $event ) );
		$methodName          = sprintf( 'when%s', preg_replace( "#Event$#", '', end( $namespaceComponents ) ) );

		if ( is_callable( [ $this, $methodName ] ) )
		{
			$this->{$methodName}( $event );
		}
		else
		{
			throw new EventListenerMethodNotCallable( $methodName );
		}
	}
718740
public function onInitConfirmation($event)
    {
        $sender = $event->sender;
        /* @var $sender static */
        if (!$sender->confirmationAttribute || empty($sender->confirmationAttribute)) {
            return;
        }
        $sender->confirmation = static::$confirmFalse;
        $sender->confirmCode = '';
    }
412138
public function sendEvent(Event $event)
    {
        try {
            $this->eventFactory->addDefaultTagsToEntity($event);
            $this->sendEventThroughSenders($event);
        } catch (\Exception $exception) {
            $this->logException($exception);
        }
    }
1159614
public function notifyPaymentOrderLoad(
        PaymentBridgeInterface $paymentBridge,
        PaymentMethodInterface $paymentMethod
    ) {
        $paymentOrderLoadEvent = new PaymentOrderLoadEvent(
            $paymentBridge,
            $paymentMethod
        );

        $this
            ->eventDispatcher
            ->dispatch(
                PaymentCoreEvents::PAYMENT_ORDER_LOAD,
                $paymentOrderLoadEvent
            );

        return $this;
    }
520677
public function afterCommit(TransactionEvent $event) {
    if ($event->getPhase() == TransactionEvent::AFTER_COMMIT) {
      $response = $this->getResponse();
      $locationOid = $response->getHeader('Location');

      // replace changed oids
      $changedOids = $event->getInsertedOids();
      foreach ($changedOids as $oldOid => $newOid) {
        if ($response->hasValue($oldOid)) {
          $value = $response->getValue($oldOid);
          $response->setValue($newOid, $value);
          $response->clearValue($oldOid);
        }
        if ($locationOid == $oldOid) {
          $this->setLocationHeaderFromOid($newOid);
        }
      }
    }
  }
396900
public function updateOrderStatus(OrderEvent $event)
    {
        $paybox = new Paybox();

        if ($event->getOrder()->isPaid() && $paybox->isPaymentModuleFor($event->getOrder())) {
            $contact_email = ConfigQuery::read('store_email', false);

            Tlog::getInstance()->debug(
                "Order ".$event->getOrder()->getRef().": sending confirmation email from store contact e-mail $contact_email"
            );

            if ($contact_email) {
                $order = $event->getOrder();

                $this->getMailer()->sendEmailToCustomer(
                    Paybox::CONFIRMATION_MESSAGE_NAME,
                    $order->getCustomer(),
                    [
                        'order_id' => $order->getId(),
                        'order_ref' => $order->getRef()
                    ]
                );

                Tlog::getInstance()->debug("Order ".$order->getRef().": confirmation email sent to customer.");

                if (Paybox::getConfigValue('send_confirmation_email_on_successful_payment', false)) {
                    // Send now the order confirmation email to the customer
                    $event->getDispatcher()->dispatch(TheliaEvents::ORDER_SEND_CONFIRMATION_EMAIL, $event);
                }
            }
        } else {
            Tlog::getInstance()->debug(
                "Order ".$event->getOrder()->getRef().": no confirmation email sent (order not paid, or not the proper payment module)."
            );
        }
    }
1318440
public function void($paymentId, $amount)
    {

        $this->debugData[] = __METHOD__;

        $method = 'PUT';
        $uri = $this->config['apiUri'] . \sprintf('/sales/%s/void', $paymentId);
        $options = [
            'headers' => $this->headers
        ];

        if ($amount) {
            $uri .= sprintf('?amount=%s', (float)$amount);
        }

        $this->debugData[][__LINE__]['method'] = $method;
        $this->debugData[][__LINE__]['uri'] = $uri;
        $this->debugData[][__LINE__]['options'] = $uri;

        try {

            $response = $this->http()->request($method, $uri, $options);

            $this->debugData[][__LINE__]['response'] = $response;

            $result = \json_decode($response->getBody()->getContents(), true);

            $this->debugData[][__LINE__]['result'] = $result;

        } catch (RequestException $e) {

            $result = array(
                'code'=>$e->getCode(),
                'message'=>$e->getMessage()
                );

            $this->debugData[][__LINE__]['exception'] = $e->getMessage();

        }

        return $result;
    }
761496
public function onViewBeforeRender(Event $event)
    {
        /**
         * @var Container $container
         * @var Profiler  $profiler
         */
        $container = $event['view']->getPackage()->getContainer();
        $profiler  = $container->get('profiler');

        $name = $event['view']->getPackage()->name . '@' . $event['view']->getName();

        $profiler->mark(__FUNCTION__ . ' / ' . $name . ' (' . uniqid() . ')', [
            'tag' => 'package.process',
        ]);
    }