function create_profile($config)
 {
     // auth
     $apiContext = $this->apiContext();
     // set FlowConfig
     $flowConfig = new FlowConfig();
     $flowConfig->setLandingPageType($config['flow_config']['landing_page_type']);
     // set Presentation
     $presentation = new Presentation();
     if ($config['presentation']['logo_image'] != '') {
         $presentation->setLogoImage(substr($config['presentation']['logo_image'], 0, 127));
     }
     if ($config['presentation']['brand_name'] != '') {
         $presentation->setBrandName(substr($config['presentation']['brand_name'], 0, 127));
     }
     if ($config['presentation']['locale_code'] != '') {
         $presentation->setLocaleCode(strtoupper($config['presentation']['locale_code']));
     }
     $addess_override = $config['input_fields']['address_override'] == '0' ? 1 : 0;
     // set InputFields
     $inputFields = new InputFields();
     $inputFields->setAllowNote(0)->setNoShipping(0)->setAddressOverride((int) $addess_override);
     // set WebProfile
     $webProfile = new WebProfile();
     $webProfile->setName($config['name'] != '' ? $config['name'] : uniqid())->setFlowConfig($flowConfig)->setPresentation($presentation)->setInputFields($inputFields);
     try {
         $webProfile->create($apiContext);
         $valid = true;
     } catch (Exception $ex) {
         $this->LoggingManager->log(print_r($ex, true), 'DEBUG');
         $valid = false;
     }
 }
 public function testCreate()
 {
     $request = $this->operation['request']['body'];
     $obj = new WebProfile($request);
     $obj->setName(uniqid());
     $result = $obj->create(null, $this->mockPayPalRestCall);
     $this->assertNotNull($result);
     return $result;
 }
 public function storeCustomRecord($parameters)
 {
     // ### Create Web Profile
     // Use the /web-profiles resource to create seamless payment experience profiles. See the payment experience overview for further information about using the /payment resource to create the PayPal payment and pass the experience_profile_id.
     // Documentation available at https://developer.paypal.com/webapps/developer/docs/api/#create-a-web-experience-profile
     // Lets create an instance of FlowConfig and add
     // landing page type information
     $flowConfig = new \PayPal\Api\FlowConfig();
     // Type of PayPal page to be displayed when a user lands on the PayPal site for checkout.
     // Allowed values: Billing or Login. When set to Billing, the Non-PayPal account landing page is used. When set to Login, the PayPal account login landing page is used.
     $flowConfig->setLandingPageType($this->request->input('landingPageType'));
     // The URL on the merchant site for transferring to after a bank transfer payment.
     $flowConfig->setBankTxnPendingUrl($this->request->input('bankTxnPendingUrl'));
     // Parameters for style and presentation.
     $presentation = new \PayPal\Api\Presentation();
     // A URL to logo image. Allowed vaues: .gif, .jpg, or .png.
     $presentation->setLogoImage($this->request->input('logoImage'))->setBrandName($this->request->input('brandName'))->setLocaleCode($this->request->input('localCode'));
     // Parameters for input fields customization.
     $inputFields = new \PayPal\Api\InputFields();
     // Enables the buyer to enter a note to the merchant on the PayPal page during checkout.
     $inputFields->setAllowNote($this->request->has('allowNote'))->setNoShipping((int) $this->request->input('shippingDataType'))->setAddressOverride((int) $this->request->input('displayShippingDataType'));
     // #### Payment Web experience profile resource
     $webProfile = new \PayPal\Api\WebProfile();
     // Name of the web experience profile. Required. Must be unique
     $webProfile->setName($this->request->input('name'))->setFlowConfig($flowConfig)->setPresentation($presentation)->setInputFields($inputFields);
     try {
         // Use this call to create a profile.
         $webProfile->create($this->apiContext);
     } catch (\PayPal\Exception\PayPalConnectionException $e) {
         dd($e);
     }
 }
 /**
  * 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;
 }