protected function buildRequestEnvelope( RequestEnvelope $requestEnvelope , AbstractPayPalMessageFactory $factory ) {
		$requestEnvelopeElement = $factory->createMessageElement();
		$requestEnvelopeElement->addChild( $factory->createMessageField( 'errorLanguage' , $factory->createMessagePrimitive( $requestEnvelope->getErrorLanguage() ) ) );
		$requestEnvelopeElement->addChild( $factory->createMessageField( 'detailLevel' , $factory->createMessagePrimitive( $requestEnvelope->getDetailLevel() ) ) );

		return $requestEnvelopeElement;
	}
	public function buildPaymentDetailsRequest( PaymentDetailsRequest $request , AbstractPayPalMessageFactory $factory ) {
		$payKey = $request->getPayKey();
		$transactionId = $request->getTransactionId();
		$trackingId = $request->getTrackingId();

		if ( $payKey != null ) {
			$this->message->addChild( $factory->createMessageField( 'payKey' , $factory->createMessagePrimitive( $payKey ) ) );
		}

		if ( $trackingId != null ) {
			$this->message->addChild( $factory->createMessageField( 'trackingId' , $factory->createMessagePrimitive( $trackingId ) ) );
		}

		if ( $transactionId != null ) {
			$this->message->addChild( $factory->createMessageField( 'transactionId' , $factory->createMessagePrimitive( $transactionId ) ) );
		}

		$this->message->addChild( $factory->createMessageField( 'requestEnvelope' , $this->buildRequestEnvelope( $request->requestEnvelope() , $factory ) ) );
	}
	private function buildSender( SenderIdentifier $sender , AbstractPayPalMessageFactory $factory ) {
		$senderIdentifierElement = $factory->createMessageElement();

		if ( ( $email = $sender->getEmail() ) != null ) {
			$senderIdentifierElement->addChild( $factory->createMessageField( 'email' , $factory->createMessagePrimitive( $email ) ) );
		}

		if ( ( $phone = $sender->getPhone() ) != null ) {
			$senderIdentifierElement->addChild( $factory->createMessageField( 'phone' , $this->buildPhoneNumber( $phone , $factory ) ) );
		}

		if ( ( $useCredentials = $sender->getUseCredentials() ) != null ) {
			$senderIdentifierElement->addChild( $factory->createMessageField( 'useCredentials' , $factory->createMessagePrimitive( $useCredentials == true ? true : false ) ) );
		}

		return $senderIdentifierElement;
	}