示例#1
0
 /**
  * @dataProvider providerSetSuccessUrl
  * @param string $provided
  */
 public function testSetSuccessUrl($provided)
 {
     $SofortIdeal = new Ideal(self::$ideal_configkey, self::$ideal_password);
     $SofortIdeal->setSuccessUrl($provided);
     $received = $SofortIdeal->getParameters();
     $this->assertEquals($provided, $received['user_variable_3']);
 }
示例#2
0
<?php

namespace Sofort\SofortLib;

require __DIR__ . '/../vendor/autoload.php';
// enter your configuration key – you only can create a new configuration key by creating
// a new Gateway project in your account at sofort.com
define('CONFIGKEY', '12345:123456:edc788a4316ce7e2ac0ede037aa623d7');
define('PASSWORD', 'password_password');
$SofortIdeal = new Ideal(CONFIGKEY, PASSWORD);
// $SofortIdeal = new SofortLibIdeal(CONFIGKEY, PASSWORD, 'md5');
// $SofortIdeal = new SofortLibIdeal(CONFIGKEY, PASSWORD, 'sha256');
$SofortIdeal->setReason('Testzweck', 'Testzweck4');
$SofortIdeal->setAmount(10);
//$SofortIdeal->setSenderAccountNumber('2345678902');
$SofortIdeal->setSenderBankCode('31');
$SofortIdeal->setSenderCountryId('NL');
$SofortIdeal->setSuccessUrl('http://www.yourdomain.org/yourshop/success.php');
$SofortIdeal->setAbortUrl('http://www.yourdomain.org/yourshop/abort.php?transaction=-TRANSACTION-');
$SofortIdeal->setNotificationUrl('http://www.yourdomain.org/yourshop/notification.php?transaction=-TRANSACTION-');
//$SofortIdeal->setVersion('Framework 0.0.1');
echo 'User should be redirected to: <a href="' . $SofortIdeal->getPaymentUrl() . '" target="_blank">Link</a>';
示例#3
0
    $app->render('_head.inc');
    $app->render('landing.php', array('default_amount' => DEFAULT_AMOUNT));
    $app->render('_footer.inc');
});
$app->post('/pirate', function () use($app) {
    $pirate = $app->request()->params();
    $pirate["status"] = "pending";
    // @TODO: append messages somehow. Now only first error is returned.
    if (!valid($app, 'initials', FALSE, '', 'Voorletters zijn vereist') || !valid($app, 'name', FALSE, '', 'Naam is vereist') || !valid($app, 'email', FALSE, '/.+@.+\\..+/', 'E-mailadres is niet correct') || !valid($app, 'address', FALSE, '', 'Adres is vereist') || !valid($app, 'city', FALSE, '', 'Stad is vereist')) {
        $app->redirect("/");
    }
    $pirate = write_pirate($pirate);
    write_mail($pirate);
    // @TODO: if pirate['id'] is not set, writing to database failed. Redirect to error in that case.
    //Prepare form for payment
    $ideal = new Ideal(MERCHANT_ID, SUB_ID, HASH_KEY, AQUIRER_NAME, AQUIRER_URL);
    $ideal->order_id = $pirate["id"];
    $ideal->amount = (double) DEFAULT_AMOUNT;
    $ideal->order_description = "Piratenpartij lidmaatschap";
    $base = $app->request()->getUrl();
    $ideal->url_cancel = "{$base}/error";
    $ideal->url_success = "{$base}/success";
    // render form.
    $app->render('_head.inc');
    $app->render('pirate.php', array('hidden_form' => $ideal->hidden_form(), 'url' => IDEAL_URL));
    $app->render('_footer.inc');
});
$app->get('/success', function () use($app) {
    $app->render('_head.inc');
    $app->render('success.php');
    $app->render('_footer.inc');