コード例 #1
0
 public function testGetPaycodeUrl()
 {
     $SofortLibPaycode = new Paycode(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());
 }
コード例 #2
0
ファイル: Paycode.php プロジェクト: sofort/sofortlib-php
<?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
$configkey = '12345:123456:edc788a4316ce7e2ac0ede037aa623d7';
$SofortLibPaycode = new Paycode($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>';
}