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; }