function setUp()
 {
     parent::setUp();
     $this->externalBundleId = uniqid();
     $this->account = $this->accountData->create($this->user, $this->reason, $this->comment, $this->tenant->getTenantHeaders());
     $paymentMethod = new Killbill_PaymentMethod();
     $paymentMethod->accountId = $this->account->accountId;
     $paymentMethod->isDefault = true;
     $paymentMethod->pluginName = '__EXTERNAL_PAYMENT__';
     $paymentMethod->create($this->user, $this->reason, $this->comment, $this->tenant->getTenantHeaders());
     $this->account = $this->account->get($this->tenant->getTenantHeaders());
     $this->assertNotEmpty($this->account->paymentMethodId);
 }
 function testBasic()
 {
     $paymentMethod = new Killbill_PaymentMethod();
     $paymentMethod->accountId = $this->account->accountId;
     $paymentMethod->isDefault = true;
     $paymentMethod->pluginName = '__EXTERNAL_PAYMENT__';
     $paymentMethod->create($this->user, $this->reason, $this->comment, $this->tenant->getTenantHeaders());
     $this->account = $this->account->get($this->tenant->getTenantHeaders());
     $this->assertNotEmpty($this->account->paymentMethodId);
     $paymentMethods = $this->account->getPaymentMethods($this->tenant->getTenantHeaders());
     $this->assertNotEmpty($paymentMethods);
     $this->assertEquals(count($paymentMethods), 1);
     $this->assertEquals($paymentMethods[0]->accountId, $this->account->accountId);
     $this->assertEquals($paymentMethods[0]->isDefault, true);
     $this->assertEquals($paymentMethods[0]->pluginName, '__EXTERNAL_PAYMENT__');
 }
Example #3
0
 * under the License.
 */
require_once dirname(__FILE__) . '/killbill-client-php/lib/killbill.php';
require_once dirname(__FILE__) . '/util.php';
include_once dirname(__FILE__) . '/includes/client.php';
ensureLoggedIn();
include_once dirname(__FILE__) . '/includes/header.php';
include_once dirname(__FILE__) . '/includes/nav.php';
?>

<div class="container">
<?php 
$account = loadAccount($tenantHeaders);
$pm_created = null;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $paymentMethodData = new Killbill_PaymentMethod();
    $paymentMethodData->accountId = $account->accountId;
    $paymentMethodData->isDefault = true;
    $paymentMethodData->pluginName = 'killbill-coinbase';
    $propApiKey = new Killbill_PaymentMethodProperties();
    $propApiKey->key = 'apiKey';
    $propApiKey->value = $_POST['btcApiKey'];
    $propApiKey->isUpdatable = false;
    $paymentMethodData->pluginInfo = new Killbill_PaymentMethodPluginDetailAttributes();
    $paymentMethodData->pluginInfo->properties = array($propApiKey);
    $paymentMethod = $paymentMethodData->create("web-user", "PHP_TEST", "Test for the demo", $tenantHeaders);
    if ($paymentMethod->paymentMethodId != null) {
        $pm_created = TRUE;
    } else {
        $pm_created = FALSE;
    }