Tribe__Tickets__Commerce__PayPal__Gateway::build_handler()

Builds the correct handler depending on the request type and options.


Return

(Tribe__Tickets__Commerce__PayPal__Handler__Interface) The handler instance.


Top ↑

Source

File: src/Tribe/Commerce/PayPal/Gateway.php

	public function build_handler() {
		$handler = $this->get_handler_slug();

		if ( null === $this->handler ) {
			if ( $handler === 'pdt' && ! empty( $_GET['tx'] ) ) {
				// looks like a PDT request
				if ( ! empty( $this->identity_token ) ) {
					// if there's an identity token set we handle payment confirmation with PDT
					$this->handler = tribe( 'tickets.commerce.paypal.handler.pdt' );
				} else {
					// if there is not an identity token set we log a missed transaction and show a notice
					$this->notices->show_missing_identity_token_notice();
					$this->handler = new Tribe__Tickets__Commerce__PayPal__Handler__Invalid_PDT( $_GET['tx'] );
				}
			} else {
				// we use IPN otherwise
				$this->handler = tribe( 'tickets.commerce.paypal.handler.ipn' );
			}
		}

		return $this->handler;
	}

Top ↑

Changelog

Changelog
Version Description
4.7 Introduced.