コード例 #1
0
 public function testGetBillcodeUrl()
 {
     $SofortLibBillcode = new Billcode(self::$configkey);
     $this->assertFalse($SofortLibBillcode->getBillcodeUrl());
     $response = self::_getProperty('_response', $this->_classToTest);
     $billcode = 'http://www.google.de/4711';
     $test['new_billcode']['billcode_url']['@data'] = $billcode;
     $response->setValue($SofortLibBillcode, $test);
     $this->assertEquals($billcode, $SofortLibBillcode->getBillcodeUrl());
 }
コード例 #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
$configkey = '12345:123456:edc788a4316ce7e2ac0ede037aa623d7';
$SofortLibBillcode = new Billcode($configkey);
$SofortLibBillcode->setAmount(5.55)->setCurrencyCode('EUR')->setSenderBankCode('00000')->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');
$SofortLibBillcode->createBillcode();
if ($SofortLibBillcode->isError()) {
    //Sofort-API didn't accept the data
    echo $SofortLibBillcode->getError();
} else {
    //Retreive Paycode or Paycode URL
    require_once dirname(__FILE__) . '/../src/BillcodeDetails.php';
    $SofortLibBillcodeDetails = new BillcodeDetails($configkey);
    $SofortLibBillcodeDetails->setBillcode($SofortLibBillcode->getBillcode());
    $SofortLibBillcodeDetails->sendRequest();
    echo $SofortLibBillcodeDetails->getStatus() . '<br/>';
    echo $SofortLibBillcodeDetails->getProjectId() . '<br/>';
    echo $SofortLibBillcodeDetails->getTransaction() . '<br/>';
    echo $SofortLibBillcodeDetails->getAmount() . '<br/>';
    echo $SofortLibBillcodeDetails->getReason() . '<br/>';
    echo $SofortLibBillcodeDetails->getReason(0) . '<br/>';
    echo $SofortLibBillcodeDetails->getReason(1) . '<br/>';
    echo $SofortLibBillcodeDetails->getTimeCreated() . '<br/>';
    echo $SofortLibBillcodeDetails->getStartDate() . '<br/>';
    echo $SofortLibBillcodeDetails->getTimeUsed() . '<br/>';
    echo $SofortLibBillcodeDetails->getEndDate() . '<br/>';