private function buildFundingConstraint( FundingConstraint $fundingConstraint , AbstractPayPalMessageFactory $factory ) {
		$allowedFundingType = $fundingConstraint->allowedFundingType();
		$allowedFundingConstraintElement = $factory->createMessageElement();
		$allowedFundingTypeList = $factory->createMessageList();

		foreach ( $allowedFundingType->getIterator() as $fundingType ) {
			$fundingInfoElement = $factory->createMessageElement();
			$fundingInfoElement->addChild( $factory->createMessageField( 'fundingType' , $factory->createMessagePrimitive( $fundingType ) ) );

			$allowedFundingTypeList->addChild( $fundingInfoElement );
		}

		$fundingTypeInfoElement = $factory->createMessageField( 'fundingTypeInfo' , $allowedFundingTypeList );
		$allowedFundingTypeElement = $factory->createMessageElement();
		$allowedFundingTypeElement->addChild( $fundingTypeInfoElement );
		$allowedFundingConstraintElement->addChild( $factory->createMessageField( 'allowedFundingType' , $allowedFundingTypeElement ) );

		return $allowedFundingConstraintElement;
	}
예제 #2
0
 public function init($map = null, $prefix = '')
 {
     if ($map != null) {
         if (PPUtils::array_match_key($map, $prefix . "responseEnvelope.")) {
             $newPrefix = $prefix . "responseEnvelope.";
             $this->responseEnvelope = new ResponseEnvelope();
             $this->responseEnvelope->init($map, $newPrefix);
         }
         $mapKeyName = $prefix . 'cancelUrl';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->cancelUrl = $map[$mapKeyName];
         }
         $mapKeyName = $prefix . 'currencyCode';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->currencyCode = $map[$mapKeyName];
         }
         $mapKeyName = $prefix . 'ipnNotificationUrl';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->ipnNotificationUrl = $map[$mapKeyName];
         }
         $mapKeyName = $prefix . 'memo';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->memo = $map[$mapKeyName];
         }
         if (PPUtils::array_match_key($map, $prefix . "paymentInfoList.")) {
             $newPrefix = $prefix . "paymentInfoList.";
             $this->paymentInfoList = new PaymentInfoList();
             $this->paymentInfoList->init($map, $newPrefix);
         }
         $mapKeyName = $prefix . 'returnUrl';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->returnUrl = $map[$mapKeyName];
         }
         $mapKeyName = $prefix . 'senderEmail';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->senderEmail = $map[$mapKeyName];
         }
         $mapKeyName = $prefix . 'status';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->status = $map[$mapKeyName];
         }
         $mapKeyName = $prefix . 'trackingId';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->trackingId = $map[$mapKeyName];
         }
         $mapKeyName = $prefix . 'payKey';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->payKey = $map[$mapKeyName];
         }
         $mapKeyName = $prefix . 'actionType';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->actionType = $map[$mapKeyName];
         }
         $mapKeyName = $prefix . 'feesPayer';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->feesPayer = $map[$mapKeyName];
         }
         $mapKeyName = $prefix . 'reverseAllParallelPaymentsOnError';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->reverseAllParallelPaymentsOnError = $map[$mapKeyName];
         }
         $mapKeyName = $prefix . 'preapprovalKey';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->preapprovalKey = $map[$mapKeyName];
         }
         if (PPUtils::array_match_key($map, $prefix . "fundingConstraint.")) {
             $newPrefix = $prefix . "fundingConstraint.";
             $this->fundingConstraint = new FundingConstraint();
             $this->fundingConstraint->init($map, $newPrefix);
         }
         if (PPUtils::array_match_key($map, $prefix . "sender.")) {
             $newPrefix = $prefix . "sender.";
             $this->sender = new SenderIdentifier();
             $this->sender->init($map, $newPrefix);
         }
         $i = 0;
         while (true) {
             if (PPUtils::array_match_key($map, $prefix . "error({$i})")) {
                 $newPrefix = $prefix . "error({$i}).";
                 $this->error[$i] = new ErrorData();
                 $this->error[$i]->init($map, $newPrefix);
             } else {
                 break;
             }
             $i++;
         }
     }
 }
예제 #3
0
 public function getOutput()
 {
     $output = array();
     $output["returnUrl"] = $this->returnUrl;
     $output["cancelUrl"] = $this->cancelUrl;
     $output["ipnNotificationUrl"] = $this->ipnUrl;
     $output["memo"] = $this->memo;
     if (isset($this->localeCode)) {
         $output["localeCode"] = LocaleCode::ConstantToString($this->localeCode);
     }
     if (isset($this->currencyCode)) {
         $output["currencyCode"] = CurrencyCode::ConstantToString($this->currencyCode);
     }
     $this->sender->addSenderToOutput($output);
     Receiver::addReceiversToOutput($this->receivers, $output);
     OrderItem::addOrderItemsToOutput($this->orderItems, $output);
     if (isset($this->fundingConstraints)) {
         FundingConstraint::addConstraintsToOutput($this->fundingConstraints, $output);
         if (in_array(FundingConstraint::INVOICE, $this->fundingConstraints) and isset($this->invoiceFee)) {
             $output["invoiceFee"] = $this->invoiceFee;
         }
     }
     if (isset($this->custom)) {
         $output["custom"] = $this->custom;
     }
     if (isset($this->trackingId)) {
         $output["trackingId"] = $this->trackingId;
     }
     if (isset($this->feesPayer)) {
         $output["feesPayer"] = FeesPayer::ConstantToString($this->feesPayer);
     }
     if (isset($this->guaranteeOffered)) {
         $output["guaranteeOffered"] = GuaranteeOffered::ConstantToString($this->guaranteeOffered);
     }
     return $output;
 }