/**
  * @param Config $config
  * @param \PayPal\Api\WebProfile $webProfile
  * @param string $experienceProfileId
  * @return bool
  */
 public static function UpdateExperienceProfile(Config $config, \PayPal\Api\WebProfile $webProfile, $experienceProfileId)
 {
     // set the id
     $webProfile->setId($experienceProfileId);
     // try to update
     try {
         $apiContext = self::getApiContext($config);
         $updated = $webProfile->update($apiContext);
     } catch (\Exception $ex) {
         return false;
     }
     if ($updated) {
         return true;
     } else {
         return false;
     }
 }
 /**
  * @depends testGet
  * @param $createProfileResponse CreateProfileResponse
  */
 public function testDelete($createProfileResponse)
 {
     $webProfile = new WebProfile();
     $webProfile->setId($createProfileResponse->getId());
     $result = $webProfile->delete(null, $this->mockPayPalRestCall);
     $this->assertTrue($result);
 }
 function delete_profile($id)
 {
     // auth
     $apiContext = $this->apiContext();
     // set WebProfile
     $webProfile = new WebProfile();
     $webProfile->setId($id);
     try {
         $webProfile->delete($apiContext);
         $valid = true;
     } catch (Exception $ex) {
         $this->LoggingManager->log(print_r($ex, true), 'DEBUG');
         $valid = false;
     }
     if ($id == $this->get_config('PAYPAL_STANDARD_PROFILE')) {
         $this->delete_config('PAYPAL_STANDARD_PROFILE');
     }
     $this->delete_config($id, 'config_value');
 }
 public function deleteCustomRecord($parameters)
 {
     $webProfile = new WebProfile();
     $webProfile->setId($parameters['id']);
     try {
         $webProfile->delete($this->apiContext);
     } catch (PayPalConnectionException $e) {
         dd($e);
     }
 }
Пример #5
0
 /**
  * Build WebProfile
  *
  * @return boolean|WebProfile
  */
 protected function buildWebProfile()
 {
     $webProfile = new WebProfile();
     if (Mage::getStoreConfig('iways_paypalplus/dev/web_profile_id')) {
         $webProfile->setId(Mage::getStoreConfig('iways_paypalplus/dev/web_profile_id'));
         return $webProfile;
     }
     try {
         $webProfile->setName('magento_' . microtime());
         $webProfile->setPresentation($this->buildWebProfilePresentation());
         $response = $webProfile->create($this->_apiContext);
         $this->saveWebProfileId($response->getId());
         return $response;
     } catch (\PayPal\Exception\PayPalConnectionException $ex) {
         Mage::helper('iways_paypalplus')->handleException($ex);
     }
     return false;
 }