Example #1
0
 public function testGetPaycodeUrl()
 {
     $SofortLibPaycode = new SofortLibPaycode(self::$configkey);
     $this->assertFalse($SofortLibPaycode->getPaycodeUrl());
     $response = self::_getProperty('_response', $this->_classToTest);
     $paycode = 'http://www.google.de/4711';
     $test['new_paycode']['paycode_url']['@data'] = $paycode;
     $response->setValue($SofortLibPaycode, $test);
     $this->assertEquals($paycode, $SofortLibPaycode->getPaycodeUrl());
 }
Example #2
0
<?php

require_once dirname(__FILE__) . '/../paycode/sofortLibPaycode.inc.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
$configkey = '12345:123456:edc788a4316ce7e2ac0ede037aa623d7';
$SofortLibPaycode = new SofortLibPaycode($configkey);
$SofortLibPaycode->setAmount(5.55)->setCurrencyCode('EUR')->setReason('Reason Line 1', 'Reason Line 2')->setSuccessUrl('http://www.google.de')->setSuccessLinkRedirect(0)->setAbortUrl('http://www.sofort.com')->setNotificationUrl('http://www.diesundjenes.de/notify')->setUserVariable('schwuppsen');
$SofortLibPaycode->createPaycode();
if ($SofortLibPaycode->isError()) {
    //Sofort-API didn't accept the data
    echo $SofortLibPaycode->getError();
} else {
    //Retrieve Paycode or Paycode URL
    echo $SofortLibPaycode->getPaycode();
    echo '<br/>';
    echo $SofortLibPaycode->getPaycodeUrl();
    //echo '<pre>' . print_r($SofortLibPaycode, true) . '</pre>';
}