Пример #1
0
 /**
  * Service Call: CancelPermissions
  * @param CancelPermissionsRequest $cancelPermissionsRequest
  * @return CancelPermissionsResponse
  * @throws APIException
  */
 public function CancelPermissions($cancelPermissionsRequest, $apiUsername = null)
 {
     $ret = new CancelPermissionsResponse();
     $resp = $this->call("CancelPermissions", $cancelPermissionsRequest, $apiUsername);
     $ret->init(PPUtils::nvpToMap($resp));
     return $ret;
 }
 public function getPayPalHeaders($apiCred, $connection, $accessToken = null, $tokenSecret = null, $url = null)
 {
     $config = PPConfigManager::getInstance();
     if (isset($accessToken) && isset($tokenSecret)) {
         $headers_arr[] = "X-PAYPAL-AUTHORIZATION:  " . $this->generateAuthString($apiCred, $accessToken, $tokenSecret, $url);
         //$headers_arr[] = "CLIENT-AUTH: No cert";
     } else {
         if ($apiCred instanceof PPSignatureCredential) {
             $headers_arr[] = "X-PAYPAL-SECURITY-USERID:  " . $apiCred->getUserName();
             $headers_arr[] = "X-PAYPAL-SECURITY-PASSWORD: "******"X-PAYPAL-SECURITY-SIGNATURE: " . $apiCred->getSignature();
         } else {
             if ($apiCred instanceof PPCertificateCredential) {
                 $headers_arr[] = "X-PAYPAL-SECURITY-USERID:  " . $apiCred->getUserName();
                 $headers_arr[] = "X-PAYPAL-SECURITY-PASSWORD: "******"X-PAYPAL-APPLICATION-ID: " . $apiCred->getApplicationId();
     $headers_arr[] = "X-PAYPAL-REQUEST-DATA-FORMAT: " . $config->get('service.Binding');
     $headers_arr[] = "X-PAYPAL-RESPONSE-DATA-FORMAT: " . $config->get('service.Binding');
     $headers_arr[] = "X-PAYPAL-DEVICE-IPADDRESS: " . PPUtils::getLocalIPAddress();
     $headers_arr[] = "X-PAYPAL-REQUEST-SOURCE: " . PPUtils::getRequestSource();
     return $headers_arr;
 }
Пример #3
0
 public static function xmlToArray($xmlInput)
 {
     $xml = simplexml_load_string($xmlInput);
     $ns = $xml->getNamespaces(true);
     $soap = $xml->children($ns['SOAP-ENV']);
     $getChild = $soap->Body->children();
     $ret = PPUtils::convertXmlObjToArr($getChild, $array = array());
     return $ret;
 }
Пример #4
0
 public function handle($httpConfig, $request, $options)
 {
     $httpConfig->addHeader('X-PAYPAL-REQUEST-DATA-FORMAT', $request->getBindingType());
     $httpConfig->addHeader('X-PAYPAL-RESPONSE-DATA-FORMAT', $request->getBindingType());
     $httpConfig->addHeader('X-PAYPAL-DEVICE-IPADDRESS', PPUtils::getLocalIPAddress());
     $httpConfig->addHeader('X-PAYPAL-REQUEST-SOURCE', PPBaseService::getRequestSource());
     if (isset($options['config']['service.SandboxEmailAddress'])) {
         $httpConfig->addHeader('X-PAYPAL-SANDBOX-EMAIL-ADDRESS', $options['config']['service.SandboxEmailAddress']);
     }
 }
 public function handle($httpConfig, $request)
 {
     $config = PPConfigManager::getInstance();
     $httpConfig->addHeader('X-PAYPAL-REQUEST-DATA-FORMAT', $request->getBindingType());
     $httpConfig->addHeader('X-PAYPAL-RESPONSE-DATA-FORMAT', $request->getBindingType());
     $httpConfig->addHeader('X-PAYPAL-DEVICE-IPADDRESS', PPUtils::getLocalIPAddress());
     $httpConfig->addHeader('X-PAYPAL-REQUEST-SOURCE', PPUtils::getRequestSource());
     if (strstr($httpConfig->getUrl(), "/AdaptiveAccounts/") && strstr($httpConfig->getUrl(), "sandbox")) {
         $httpConfig->addHeader('X-PAYPAL-SANDBOX-EMAIL-ADDRESS', $config->get('service.SandboxEmailAddress'));
     }
 }
 public function handle($httpConfig, $request, $options)
 {
     $httpConfig->addHeader('X-PAYPAL-REQUEST-DATA-FORMAT', $request->getBindingType());
     $httpConfig->addHeader('X-PAYPAL-RESPONSE-DATA-FORMAT', $request->getBindingType());
     $httpConfig->addHeader('X-PAYPAL-DEVICE-IPADDRESS', PPUtils::getLocalIPAddress());
     $httpConfig->addHeader('X-PAYPAL-REQUEST-SOURCE', $this->getRequestSource());
     if (!array_key_exists("User-Agent", $httpConfig->getHeaders())) {
         $httpConfig->addHeader("User-Agent", PPUserAgent::getValue($this->sdkName, $this->sdkVersion));
     }
     if (isset($options['config']['service.SandboxEmailAddress'])) {
         $httpConfig->addHeader('X-PAYPAL-SANDBOX-EMAIL-ADDRESS', $options['config']['service.SandboxEmailAddress']);
     }
 }
Пример #7
0
 /**
  * @param string $property
  * @param array  $element
  */
 private function fillRelation($property, array $element)
 {
     if (!class_exists($type = PPUtils::propertyType($this, $property))) {
         trigger_error("Class {$type} not found.", E_USER_NOTICE);
         return;
         // just ignore
     }
     if (isset($element['num'])) {
         // array of objects
         $this->{$property}[$element['num']] = $item = new $type();
         $item->init($element['children'], false);
     } else {
         $this->{$property} = new $type();
         $this->{$property}->init($element["children"], false);
     }
 }
 /**
  * Service Call: ExternalRememberMeOptOut
  * @param ExternalRememberMeOptOutReq $externalRememberMeOptOutReq
  * @param mixed $apiCredential - Optional API credential - can either be
  * 		a username configured in sdk_config.ini or a ICredential object
  *      created dynamically 		
  * @return ExternalRememberMeOptOutResponseType
  * @throws APIException
  */
 public function ExternalRememberMeOptOut($externalRememberMeOptOutReq, $apiCredential = NULL)
 {
     $this->setStandardParams($externalRememberMeOptOutReq->ExternalRememberMeOptOutRequest);
     $ret = new ExternalRememberMeOptOutResponseType();
     $resp = $this->call('PayPalAPIAA', 'ExternalRememberMeOptOut', $externalRememberMeOptOutReq, $apiCredential);
     $ret->init(PPUtils::xmlToArray($resp));
     return $ret;
 }
 /**
  * Service Call: ExternalRememberMeOptOut
  *
  * @param ExternalRememberMeOptOutReq $externalRememberMeOptOutReq
  *
  * @return ExternalRememberMeOptOutResponseType
  * @throws APIException
  */
 public function ExternalRememberMeOptOut($externalRememberMeOptOutReq, $apiUsername = null)
 {
     $this->setStandardParams($externalRememberMeOptOutReq->ExternalRememberMeOptOutRequest);
     $ret = new ExternalRememberMeOptOutResponseType();
     $resp = $this->call("ExternalRememberMeOptOut", $externalRememberMeOptOutReq, $apiUsername);
     $ret->init(PPUtils::xmlToArray($resp));
     return $ret;
 }
Пример #10
0
 /**
  * @param array $map
  * @param string $prefix
  */
 public function init(array $map = array(), $prefix = '')
 {
     if (empty($map)) {
         return;
     }
     $map = PPUtils::lowerKeys($map);
     foreach (get_object_vars($this) as $property => $defaultValue) {
         if (array_key_exists($propKey = strtolower($prefix . $property), $map) && $this->isBuiltInType($type = PPUtils::propertyType($this, $property))) {
             $type = PPUtils::propertyType($this, $property);
             $this->{$property} = urldecode($map[$propKey]);
             continue;
             // string
         } elseif (!($filtered = PPUtils::filterKeyPrefix($map, $propKey))) {
             continue;
             // NULL
         }
         if (!$this->isBuiltInType($type = PPUtils::propertyType($this, $property), false) && !class_exists($type)) {
             trigger_error("Class {$type} not found.", E_USER_NOTICE);
             continue;
             // just ignore
         }
         if (is_array($defaultValue) || PPUtils::isPropertyArray($this, $property)) {
             // array of objects
             if ($this->isBuiltInType($type)) {
                 // Array of simple types
                 foreach ($filtered as $key => $value) {
                     $this->{$property}[trim($key, "()")] = urldecode($value);
                 }
             } else {
                 // Array of complex objects
                 $delim = '.';
                 for ($i = 0; $itemValues = PPUtils::filterKeyPrefix($filtered, "({$i})"); $i++) {
                     $this->{$property}[$i] = $item = new $type();
                     $item->init(PPUtils::filterKeyPrefix($itemValues, "."));
                     if (array_key_exists("", $itemValues)) {
                         $item->value = urldecode($itemValues[""]);
                     }
                 }
                 // Handle cases where we have a list of objects
                 // with just the value present and all attributes values are null
                 foreach ($filtered as $key => $value) {
                     $idx = trim($key, "()");
                     if (is_numeric($idx) && (is_null($this->{$property}) || !array_key_exists($idx, $this->{$property}))) {
                         $this->{$property}[$idx] = new $type();
                         $this->{$property}[$idx]->value = urldecode($value);
                     }
                 }
             }
         } else {
             // one object
             $this->{$property} = new $type();
             $this->{$property}->init(PPUtils::filterKeyPrefix($filtered, '.'));
             // unprefix
             if (array_key_exists("", $filtered)) {
                 $this->{$property}->value = urldecode($filtered[""]);
             }
         }
     }
 }
Пример #11
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);
         }
         for ($i = 0; $i < 10; $i++) {
             if (PPUtils::array_match_key($map, $prefix . "error({$i})")) {
                 $newPrefix = $prefix . "error({$i}).";
                 $this->error[$i] = new ErrorData();
                 $this->error[$i]->init($map, $newPrefix);
             }
         }
     }
 }
Пример #12
0
 /**
  * Send a HTTP GET request to PayPal's NVP API and return the response.
  * Settings from Yii::app()->getModule('payPal') is used for authentication
  * and API version.
  *
  * Get variables are urlencoded, and imploded using self::urlencode() and
  * self::implode().
  *
  * Failure ACKs received from PayPal is logged.
  *
  * @param array $getVars Assoc array (NVP values as specified by PayPal NVP API)
  * @return mixed Assoc array on success, false on failure
  * @throws CException Unrecognized response
  */
 public static function nvpRequest($getVars)
 {
     $module = Yii::app()->getModule('payPal');
     // Prepare NVP
     $getVars['VERSION'] = PayPalModule::VERSION;
     foreach ($module->account->getNvp() as $k => $v) {
         $getVars[$k] = $v;
     }
     // Sent HTTP GET request
     $getStr = self::urlencode($getVars);
     $getStr = self::implode("&", $getStr);
     $response = PPUtils::httpGet(self::getUrl(self::NVP), $getStr, true);
     // Return false on HTTP error
     if ($response['status'] === false) {
         return false;
     }
     $ack = $response['httpParsedResponseAr']['ACK'];
     // Log and return false on PayPal failures / warnings
     if ($ack == "Failure" || $ack == "FailureWithWarning" || $ack == "Warning") {
         Yii::log("NVP request failed" . "\nRequest:{$getStr}" . "\nResponse:" . self::implode("&", $response['httpParsedResponseAr']), "error", "payPal.helpers.PPUtils");
         return false;
     }
     // Return response on success
     if ($ack == "Success" || $ack == "SuccessWithWarning") {
         return $response['httpParsedResponseAr'];
     }
     // Log error and throw exception on unrecognized response
     $message = "Received unrecognized response";
     Yii::log($message . "\nRequest:{$getStr}" . "\nResponse:" . self::implode("&", $response['httpParsedResponseAr']), "error", "payPal.helpers.PPUtils");
     throw new CException($message);
 }
Пример #13
0
 /**
  * @test
  */
 public function deserializeAndSerialize()
 {
     $nvpString = "list2(0).field1=somevalue1&list2(0).field2=somevalue2&list2(1).field1=another+value1&list2(1).field2=anothervalue2&list3(0).attrib1=somevalue1&list3(0).attrib2=somevalue2&list3(0)=value+field&list3(1).attrib1=another+value1&list3(2)=anothervalue2";
     $newC = new SimpleContainerTestClass();
     $newC->init(PPUtils::nvpToMap($nvpString));
     //TODO: Mock nvpToMap
     $this->assertEquals($nvpString, $newC->toNVPString());
 }
Пример #14
0
 /**
  * Service Call: GetPrePaymentDisclosure
  * @param GetPrePaymentDisclosureRequest $getPrePaymentDisclosureRequest
  * @param mixed $apiCredential - Optional API credential - can either be
  * 		a username configured in sdk_config.ini or a ICredential object
  *      created dynamically 		
  * @return GetPrePaymentDisclosureResponse
  * @throws APIException
  */
 public function GetPrePaymentDisclosure($getPrePaymentDisclosureRequest, $apiCredential = NULL)
 {
     $ret = new GetPrePaymentDisclosureResponse();
     $resp = $this->call('AdaptivePayments', 'GetPrePaymentDisclosure', $getPrePaymentDisclosureRequest, $apiCredential);
     $ret->init(PPUtils::nvpToMap($resp));
     return $ret;
 }
Пример #15
0
 /**
  * Service Call: SetFundingSourceConfirmed
  * @param SetFundingSourceConfirmedRequest $setFundingSourceConfirmedRequest
  * @return SetFundingSourceConfirmedResponse
  * @throws APIException
  */
 public function SetFundingSourceConfirmed($setFundingSourceConfirmedRequest, $apiUsername = null)
 {
     $ret = new SetFundingSourceConfirmedResponse();
     $resp = $this->call("SetFundingSourceConfirmed", $setFundingSourceConfirmedRequest, $apiUsername);
     $ret->init(PPUtils::nvpToMap($resp));
     return $ret;
 }
Пример #16
0
 /**
  * Service Call: GetAdvancedPersonalData
  * @param GetAdvancedPersonalDataRequest $getAdvancedPersonalDataRequest
  * @return GetAdvancedPersonalDataResponse
  * @throws APIException
  */
 public function GetAdvancedPersonalData($getAdvancedPersonalDataRequest, $apiUsername = null)
 {
     $ret = new GetAdvancedPersonalDataResponse();
     $resp = $this->call("GetAdvancedPersonalData", $getAdvancedPersonalDataRequest, $apiUsername);
     $ret->init(PPUtils::nvpToMap($resp));
     return $ret;
 }
Пример #17
0
 public function run()
 {
     $event = new PPEvent($this);
     /* If transaction id is missing, it's logged and a failure event is raised */
     // 2010-10-28: TESTED OK
     //		if (!isset($_POST['txn_id'])) {
     //			$event->msg = "IPN Listner recieved an HTTP request without a Transaction ID.";
     //			Yii::log($event->msg, "error", "payPal.controllers.ipn.PPIpnAction");
     //			$this->onFailure($event);
     //			return;
     //		}
     /** Send IPN Request (HTTP POST) to PayPal **/
     // 2010-10-28: TESTED OK
     $event->requestAr = array_merge(array("cmd" => "_notify-validate"), $_POST);
     $postVars = PPUtils::implode('&', PPUtils::urlencode($event->requestAr));
     $response = PPUtils::httpPost(PPUtils::getUrl(PPUtils::IPN), $postVars, false);
     /** If IPN request fails it is logged and a failure event is raised **/
     // 2010-10-28: TESTED OK
     if ($response["status"] == false) {
         $respstr = print_r($response, true);
         Yii::log($respstr, "error", "payPal.controllers.ipn.PPIpnAction");
         $event->msg = "HTTP POST request to PayPal failed";
         Yii::log("{$event->msg}\nRequest:\n{$postVars}", "error", "payPal.controllers.ipn.PPIpnAction");
         $this->onFailure($event);
         return;
     }
     // It will only be one line in the response
     $event->responseAr = explode("\n", $response["httpResponse"]);
     /** If PayPal is unable to verify a request it is logged and a failure event is raised **/
     // 2010-10-28: TESTED OK
     if (count($event->responseAr) < 1 || $event->responseAr[0] != 'VERIFIED') {
         $event->msg = "IPN request failed";
         Yii::log("{$event->msg}\nRequest:\n{$postVars}\nResponse:\n{$response["httpResponse"]}", "error", "payPal.controllers.ipn.PPIpnAction");
         $this->onFailure($event);
         return;
     }
     /** Log successfull request and raise a onRequest event */
     // 2010-10-28: TESTED OK
     $event->details = $event->requestAr;
     $event->msg = "Successfull IPN request";
     Yii::log("{$event->msg}\nRequest:\n{$postVars}\nResponse:\n{$response["httpResponse"]}", "info", "payPal.controllers.ipn.PPIpnAction");
     $this->onRequest($event);
 }
 /**
  * Service Call: ExternalRememberMeOptOut
  * @param ExternalRememberMeOptOutReq $externalRememberMeOptOutReq
  * @param mixed $apiCredential - Optional API credential - can either be
  * 		a username configured in sdk_config.ini or a ICredential object
  *      created dynamically 		
  * @return ExternalRememberMeOptOutResponseType
  * @throws APIException
  */
 public function ExternalRememberMeOptOut($externalRememberMeOptOutReq, $apiCredential = NULL)
 {
     $this->setStandardParams($externalRememberMeOptOutReq->ExternalRememberMeOptOutRequest);
     $apiContext = new PPApiContext($this->config);
     $handlers = array(new PPMerchantServiceHandler($apiCredential, self::$SDK_NAME, self::$SDK_VERSION));
     $ret = new ExternalRememberMeOptOutResponseType();
     $resp = $this->call('PayPalAPIAA', 'ExternalRememberMeOptOut', $externalRememberMeOptOutReq, $apiContext, $handlers);
     $ret->init(PPUtils::xmlToArray($resp));
     return $ret;
 }
 /**
  * Service Call: GetPrePaymentDisclosure
  * @param GetPrePaymentDisclosureRequest $getPrePaymentDisclosureRequest
  * @param mixed $apiCredential - Optional API credential - can either be
  * 		a username configured in sdk_config.ini or a ICredential object
  *      created dynamically 		
  * @return GetPrePaymentDisclosureResponse
  * @throws APIException
  */
 public function GetPrePaymentDisclosure($getPrePaymentDisclosureRequest, $apiCredential = NULL)
 {
     $apiContext = new PPApiContext($this->config);
     $handlers = array(new PPPlatformServiceHandler($apiCredential, self::$SDK_NAME, self::$SDK_VERSION));
     $ret = new GetPrePaymentDisclosureResponse();
     $resp = $this->call('AdaptivePayments', 'GetPrePaymentDisclosure', $getPrePaymentDisclosureRequest, $apiContext, $handlers);
     $ret->init(PPUtils::nvpToMap($resp));
     return $ret;
 }
Пример #20
0
 public function init($map = null, $prefix = '')
 {
     if ($map != null) {
         $mapKeyName = $prefix . 'viaPayPal';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->viaPayPal = $map[$mapKeyName];
         }
         if (PPUtils::array_match_key($map, $prefix . "paypalPayment.")) {
             $newPrefix = $prefix . "paypalPayment.";
             $this->paypalPayment = new PayPalPaymentRefundDetailsType();
             $this->paypalPayment->init($map, $newPrefix);
         }
         if (PPUtils::array_match_key($map, $prefix . "otherPayment.")) {
             $newPrefix = $prefix . "otherPayment.";
             $this->otherPayment = new OtherPaymentRefundDetailsType();
             $this->otherPayment->init($map, $newPrefix);
         }
     }
 }
Пример #21
0
 /**
  * Service Call: GetAdvancedPersonalData
  * @param GetAdvancedPersonalDataRequest $getAdvancedPersonalDataRequest
  * @param mixed $apiCredential - Optional API credential - can either be
  * 		a username configured in sdk_config.ini or a ICredential object
  *      created dynamically 		
  * @return GetAdvancedPersonalDataResponse
  * @throws APIException
  */
 public function GetAdvancedPersonalData($getAdvancedPersonalDataRequest, $apiCredential = NULL)
 {
     $ret = new GetAdvancedPersonalDataResponse();
     $resp = $this->call('Permissions', 'GetAdvancedPersonalData', $getAdvancedPersonalDataRequest, $apiCredential);
     $ret->init(PPUtils::nvpToMap($resp));
     return $ret;
 }
Пример #22
0
 public function init($map = null, $prefix = '')
 {
     if ($map != null) {
         $mapKeyName = $prefix . 'emailAddress';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->emailAddress = $map[$mapKeyName];
         }
         $mapKeyName = $prefix . 'accountType';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->accountType = $map[$mapKeyName];
         }
         $mapKeyName = $prefix . 'accountId';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->accountId = $map[$mapKeyName];
         }
         if (PPUtils::array_match_key($map, $prefix . "name.")) {
             $newPrefix = $prefix . "name.";
             $this->name = new NameType();
             $this->name->init($map, $newPrefix);
         }
         $mapKeyName = $prefix . 'businessName';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->businessName = $map[$mapKeyName];
         }
     }
 }
Пример #23
0
 private static function log($msg, $level, $requestAr = null, $responseAr = null)
 {
     if ($requestAr != null) {
         $msg .= "\nRequest: " . PPUtils::implode("&", $requestAr);
     }
     if ($responseAr != null) {
         $msg .= "\nResponse: " . PPUtils::implode("&", $responseAr);
     }
     Yii::log($msg, $level, "payPal.components.PPButtonManager");
 }
Пример #24
0
 /**
  * Convert a DOM node to an intermediate nested array
  * representation that can be iterated
  * 
  * @param DOMNode $node	DOM node to convert
  */
 private static function xmlNodeToArray($node)
 {
     $result = array();
     $children = $node->childNodes;
     if (!empty($children)) {
         for ($i = 0; $i < (int) $children->length; $i++) {
             $child = $children->item($i);
             if ($child !== null) {
                 if ($child->childNodes->item(0) instanceof \DOMText) {
                     $result[$i]['name'] = $child->nodeName;
                     $result[$i]['text'] = $child->childNodes->item(0)->nodeValue;
                     if ($child->hasAttributes()) {
                         foreach ($child->attributes as $k => $v) {
                             if ($v->namespaceURI != 'http://www.w3.org/2001/XMLSchema-instance') {
                                 $result[$i]['attributes'][$v->name] = $v->value;
                             }
                         }
                     }
                 } else {
                     if (!in_array($child->nodeName, $result)) {
                         $result[$i]['name'] = $child->nodeName;
                         $result[$i]['children'] = PPUtils::xmlNodeToArray($child);
                         if ($child->hasAttributes()) {
                             $attrs = $child->attributes;
                             foreach ($attrs as $k => $v) {
                                 if ($v->namespaceURI != 'http://www.w3.org/2001/XMLSchema-instance') {
                                     $result[$i]['attributes'][$v->name] = $v->value;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $result;
 }
Пример #25
0
 /**
  * Service Call: GetUserLimits
  * @param GetUserLimitsRequest $getUserLimitsRequest
  * @return GetUserLimitsResponse
  * @throws APIException
  */
 public function GetUserLimits($getUserLimitsRequest, $apiUsername = null)
 {
     $ret = new GetUserLimitsResponse();
     $resp = $this->call("GetUserLimits", $getUserLimitsRequest, $apiUsername);
     $ret->init(PPUtils::nvpToMap($resp));
     return $ret;
 }
Пример #26
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);
         }
         $i = 0;
         while (true) {
             if (PPUtils::array_match_key($map, $prefix . "userLimit({$i})")) {
                 $newPrefix = $prefix . "userLimit({$i}).";
                 $this->userLimit[$i] = new UserLimit();
                 $this->userLimit[$i]->init($map, $newPrefix);
             } else {
                 break;
             }
             $i++;
         }
         if (PPUtils::array_match_key($map, $prefix . "warningDataList.")) {
             $newPrefix = $prefix . "warningDataList.";
             $this->warningDataList = new WarningDataList();
             $this->warningDataList->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++;
         }
     }
 }
Пример #27
0
 /**
  * @test
  */
 public function testGetLocalIPAddress()
 {
     $ip = $this->object->getLocalIPAddress();
     //$this->assertEquals('127.0.0.1',$ip);
 }
 /**
  * Service Call: BMButtonSearch
  * @param BMButtonSearchReq $bMButtonSearchReq
  * @param mixed $apiCredential - Optional API credential - can either be
  * 		a username configured in sdk_config.ini or a ICredential object
  *      created dynamically 		
  * @return BMButtonSearchResponseType
  * @throws APIException
  */
 public function BMButtonSearch($bMButtonSearchReq, $apiCredential = NULL)
 {
     $this->setStandardParams($bMButtonSearchReq->BMButtonSearchRequest);
     $ret = new BMButtonSearchResponseType();
     $resp = $this->call('PayPalAPI', 'BMButtonSearch', $bMButtonSearchReq, $apiCredential);
     $ret->init(PPUtils::xmlToArray($resp));
     return $ret;
 }
 public function toXMLString()
 {
     $str = '';
     $str .= parent::toXMLString();
     if ($this->ExternalRememberMeID != null) {
         $str .= '<urn:ExternalRememberMeID>' . PPUtils::escapeInvalidXmlCharsRegex($this->ExternalRememberMeID) . '</urn:ExternalRememberMeID>';
     }
     if ($this->ExternalRememberMeOwnerDetails != null) {
         $str .= '<urn:ExternalRememberMeOwnerDetails>';
         $str .= $this->ExternalRememberMeOwnerDetails->toXMLString();
         $str .= '</urn:ExternalRememberMeOwnerDetails>';
     }
     return $str;
 }
 /**
  * Service Call: BMButtonSearch
  * @param BMButtonSearchReq $bMButtonSearchReq
  * @param mixed $apiCredential - Optional API credential - can either be
  * 		a username configured in sdk_config.ini or a ICredential object
  *      created dynamically 		
  * @return BMButtonSearchResponseType
  * @throws APIException
  */
 public function BMButtonSearch($bMButtonSearchReq, $apiCredential = NULL)
 {
     $this->setStandardParams($bMButtonSearchReq->BMButtonSearchRequest);
     $ret = new BMButtonSearchResponseType();
     $apiContext = new PPApiContext($this->config);
     $handlers = array(new PPMerchantServiceHandler($apiCredential, self::$SDK_NAME, self::$SDK_VERSION));
     $resp = $this->call('PayPalAPI', 'BMButtonSearch', $bMButtonSearchReq, $apiContext, $handlers);
     $ret->init(PPUtils::xmlToArray($resp));
     return $ret;
 }