Exemplo n.º 1
0
 /**
  * Stores the Payments as present in the POST request
  *
  * See {@see Payment::delete()},
  * {@see Payment::add()}, and
  * {@see Payment::update()}.
  */
 static function storePayments()
 {
     $result = NULL;
     if (isset($_GET['delete_payment'])) {
         $payment_id = intval($_GET['delete_payment']);
         $result = Payment::delete($payment_id);
     }
     if (isset($result)) {
         self::$changed = true;
         self::$success &= $result;
     }
     //DBG::log("after Payment::delete: ".self::$success.", changed: ".self::$changed);
     $result = Payment::add();
     if (isset($result)) {
         self::$changed = true;
         self::$success &= $result;
     }
     //DBG::log("after Payment::add: ".self::$success.", changed: ".self::$changed);
     $result = Payment::update();
     if (isset($result)) {
         self::$changed = true;
         self::$success &= $result;
     }
     //DBG::log("after Payment::update: ".self::$success.", changed: ".self::$changed);
     Payment::reset();
     if (empty($_POST['bpayment'])) {
         return;
     }
     // NOTE: All the following could be handled by Payment::settings()
     \Cx\Core\Setting\Controller\Setting::set('payrexx_instance_name', trim(strip_tags(contrexx_input2raw($_POST['payrexx_instance_name']))));
     \Cx\Core\Setting\Controller\Setting::set('payrexx_api_secret', trim(strip_tags(contrexx_input2raw($_POST['payrexx_api_secret']))));
     \Cx\Core\Setting\Controller\Setting::set('payrexx_active', !empty($_POST['payrexx_active']));
     \Cx\Core\Setting\Controller\Setting::set('postfinance_shop_id', trim(strip_tags(contrexx_input2raw($_POST['postfinance_shop_id']))));
     \Cx\Core\Setting\Controller\Setting::set('postfinance_active', !empty($_POST['postfinance_active']));
     //        \Cx\Core\Setting\Controller\Setting::set('postfinance_hash_seed',
     //            trim(strip_tags(contrexx_input2raw($_POST['postfinance_hash_seed']);
     // Replaced by
     \Cx\Core\Setting\Controller\Setting::set('postfinance_hash_signature_in', trim(strip_tags(contrexx_input2raw($_POST['postfinance_hash_signature_in']))));
     \Cx\Core\Setting\Controller\Setting::set('postfinance_hash_signature_out', trim(strip_tags(contrexx_input2raw($_POST['postfinance_hash_signature_out']))));
     \Cx\Core\Setting\Controller\Setting::set('postfinance_authorization_type', trim(strip_tags(contrexx_input2raw($_POST['postfinance_authorization_type']))));
     // OBSOLETE -- Determined by the available cards and the PostFinance
     // backend settings
     //        \Cx\Core\Setting\Controller\Setting::set('postfinance_accepted_payment_methods', $strYellowpayAcceptedPM);
     \Cx\Core\Setting\Controller\Setting::set('postfinance_use_testserver', !empty($_POST['postfinance_use_testserver']));
     // Postfinance Mobile
     \Cx\Core\Setting\Controller\Setting::set('postfinance_mobile_webuser', trim(strip_tags(contrexx_input2raw($_POST['postfinance_mobile_webuser']))));
     \Cx\Core\Setting\Controller\Setting::set('postfinance_mobile_sign', trim(strip_tags(contrexx_input2raw($_POST['postfinance_mobile_sign']))));
     \Cx\Core\Setting\Controller\Setting::set('postfinance_mobile_ijustwanttotest', !empty($_POST['postfinance_mobile_ijustwanttotest']));
     \Cx\Core\Setting\Controller\Setting::set('postfinance_mobile_status', !empty($_POST['postfinance_mobile_status']));
     // Saferpay
     \Cx\Core\Setting\Controller\Setting::set('saferpay_id', trim(strip_tags(contrexx_input2raw($_POST['saferpay_id']))));
     \Cx\Core\Setting\Controller\Setting::set('saferpay_active', !empty($_POST['saferpay_active']));
     \Cx\Core\Setting\Controller\Setting::set('saferpay_finalize_payment', !empty($_POST['saferpay_finalize_payment']));
     \Cx\Core\Setting\Controller\Setting::set('saferpay_use_test_account', !empty($_POST['saferpay_use_test_account']));
     \Cx\Core\Setting\Controller\Setting::set('saferpay_window_option', intval($_POST['saferpay_window_option']));
     // Paypal
     \Cx\Core\Setting\Controller\Setting::set('paypal_account_email', trim(strip_tags(contrexx_input2raw($_POST['paypal_account_email']))));
     \Cx\Core\Setting\Controller\Setting::set('paypal_active', !empty($_POST['paypal_active']));
     \Cx\Core\Setting\Controller\Setting::set('paypal_default_currency', trim(strip_tags(contrexx_input2raw($_POST['paypal_default_currency']))));
     // Datatrans
     \Cx\Core\Setting\Controller\Setting::set('datatrans_merchant_id', trim(strip_tags(contrexx_input2raw($_POST['datatrans_merchant_id']))));
     \Cx\Core\Setting\Controller\Setting::set('datatrans_active', !empty($_POST['datatrans_active']));
     \Cx\Core\Setting\Controller\Setting::set('datatrans_request_type', trim(strip_tags(contrexx_input2raw($_POST['datatrans_request_type']))));
     \Cx\Core\Setting\Controller\Setting::set('datatrans_use_testserver', !empty($_POST['datatrans_use_testserver']));
     // Paymill
     \Cx\Core\Setting\Controller\Setting::set('paymill_active', !empty($_POST['paymill_active']));
     \Cx\Core\Setting\Controller\Setting::set('paymill_use_test_account', !empty($_POST['paymill_use_test_account']));
     \Cx\Core\Setting\Controller\Setting::set('paymill_test_private_key', trim(strip_tags(contrexx_input2raw($_POST['paymill_test_private_key']))));
     \Cx\Core\Setting\Controller\Setting::set('paymill_test_public_key', trim(strip_tags(contrexx_input2raw($_POST['paymill_test_public_key']))));
     \Cx\Core\Setting\Controller\Setting::set('paymill_live_private_key', trim(strip_tags(contrexx_input2raw($_POST['paymill_live_private_key']))));
     \Cx\Core\Setting\Controller\Setting::set('paymill_live_public_key', trim(strip_tags(contrexx_input2raw($_POST['paymill_live_public_key']))));
     // LSV
     \Cx\Core\Setting\Controller\Setting::set('payment_lsv_active', !empty($_POST['payment_lsv_active']));
     // All preceding should be handled by Payment::settings()
 }
 /**
  * @expectedException         Everypay\Exception\RuntimeException
  * @expectedExceptionMessage  Resource Payments does not support method Everypay\Payment::delete
  */
 public function testPaymentDelete()
 {
     $token = 'pmt_4KQ2DD15gs2w8RS4M2MhBz1Q';
     $payment = Payment::delete($token);
 }
Exemplo n.º 3
0
 /**
  * @expectedException         Everypay\Exception\RuntimeException
  * @expectedExceptionMessage  Resource Payments does not support method Everypay\Payment::delete
  * @group                     ecommerce
  * @group                     3dsecure
  */
 public function testPaymentDelete()
 {
     //applicable both in local and remote mode
     $token = 'pmt_4KQ2DD15gs2w8RS4M2MhBz1Q';
     $payment = Payment::delete($token);
 }
Exemplo n.º 4
0
function showPayment()
{
    global $connector;
    $student = new Student();
    $student->setConnector($connector);
    $payment = new Payment();
    $payment->setConnector($connector);
    if (isset($_POST['operation'])) {
        list($operation, $params) = explode("#", $_POST['operation']);
        switch ($operation) {
            case 'selectStudent':
                $result['edit'] = $payment->getById($params);
                if (!isset($result['edit']->student_id)) {
                    $result['edit']->student_id = $params;
                }
                break;
            case 'delete':
                $error_msg = $payment->delete($params);
                break;
            case 'edit':
                $result['edit'] = $payment->getById($params);
                break;
            case 'editChanges':
                $payment->storeFormValues($_POST);
                $error_msg = $payment->update();
                break;
            case 'saveChanges':
                $payment->storeFormValues($_POST);
                $payment->setConnector($connector);
                $error_msg = $payment->insert();
                break;
            default:
                $error_msg = "Operazione non valida";
        }
        if ($error_msg != "") {
            $result["errorMessage"] = $error_msg;
        } elseif ($operation != 'edit' && $operation != 'selectStudent') {
            $result["statusMessage"] = "Operazione completata!";
        }
    }
    $result['students'] = $student->getList("cognome");
    $result['payments'] = $payment->getList();
    $page = "payment.php";
    include_once BASE_PATH . "template.php";
}