/** * @expectedException \InvalidArgumentException * @expectedExceptionMessage BankTxnPendingUrl is not a fully qualified URL */ public function testUrlValidationForBankTxnPendingUrl() { $obj = new FlowConfig(); $obj->setBankTxnPendingUrl(null); }
function update_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->setId($config['id'])->setName($config['name'])->setFlowConfig($flowConfig)->setPresentation($presentation)->setInputFields($inputFields); try { $webProfile->update($apiContext); $valid = true; } catch (Exception $ex) { $this->LoggingManager->log(print_r($ex, true), 'DEBUG'); $valid = false; if ($ex instanceof \PayPal\Exception\PayPalConnectionException) { global $messageStack; $error_json = $ex->getData(); $error = json_decode($error_json, true); $messageStack->add_session((isset($error['name']) ? '<b>' . $error['name'] . ':</b> ' : '') . $error['message'], 'warning'); if (isset($error['details'])) { for ($i = 0, $n = count($error['details']); $i < $n; $i++) { $messageStack->add_session($error['details'][$i]['field'] . ': ' . $error['details'][$i]['issue'], 'warning'); } } } } if ($config['status'] == '1') { $sql_data_array = array(array('config_key' => 'PAYPAL_STANDARD_PROFILE', 'config_value' => $config['id'])); $this->save_config($sql_data_array); } elseif ($config['id'] == $this->get_config('PAYPAL_STANDARD_PROFILE')) { $this->delete_config('PAYPAL_STANDARD_PROFILE'); } $sql_data_array = array(array('config_key' => strtoupper($config['id']) . '_TIME', 'config_value' => time()), array('config_key' => strtoupper($config['id']) . '_ADDRESS', 'config_value' => $addess_override)); $this->save_config($sql_data_array); }