<?php include __DIR__ . "/../vendor/autoload.php"; use SeBuDesign\Buckaroo\Transaction; use SeBuDesign\Buckaroo\Helpers\ServiceHelper; use SeBuDesign\Buckaroo\CreditCardTransaction; /** * * WITH CREDIT CARD TRANSACTION CLASS * */ // Get all static credit card types $staticCreditCardTypes = CreditCardTransaction::getStaticCreditCardTypes(); // Specific simplified credit card transaction $oTransaction = new CreditCardTransaction('CHANGEME', __DIR__ . '/../tests/test.pem'); $creditCardResponse1 = $oTransaction->putInTestMode()->setAmount(1.23)->setInvoice('TEST_INVOICE')->setService(ServiceHelper::SERVICE_MASTERCARD)->setCustomerCode('test')->setStartRecurrent(true)->perform(); /** * * WITH TRANSACTION CLASS * */ // Credit card payment $oTransaction = new Transaction('CHANGEME', __DIR__ . '/../tests/test.pem'); $creditCardResponse2 = $oTransaction->putInTestMode()->setAmountDebit(1.23)->setInvoice('TEST_INVOICE')->setService(ServiceHelper::SERVICE_MASTERCARD)->addServiceParameter('customercode', 'a_unique_code')->setStartRecurrent(true)->perform(); var_dump($creditCardResponse1, $creditCardResponse2);
/** * @test * * @expectedException \SeBuDesign\Buckaroo\Exceptions\BuckarooTransactionRequestException * @expectedExceptionMessage You should provide an invoice number */ public function it_should_throw_an_exception_when_no_invioce_number_is_set() { $this->oBuckarooTransaction->setAmountCredit(1.23)->setService('test')->perform(); }
<?php include __DIR__ . "/../vendor/autoload.php"; use SeBuDesign\Buckaroo\BancontactMrCashTransaction; use SeBuDesign\Buckaroo\Transaction; use SeBuDesign\Buckaroo\Helpers\ServiceHelper; /** * * WITH BANCONTACT & MR CASH TRANSACTION CLASS * */ $oTransaction = new BancontactMrCashTransaction('CHANGEME', __DIR__ . '/../tests/test.pem'); $response1 = $oTransaction->putInTestMode()->setAmount(1.23)->setInvoice('TEST_INVOICE')->perform(); /** * * WITH TRANSACTION CLASS * */ $oTransaction = new Transaction('CHANGEME', __DIR__ . '/../tests/test.pem'); $response2 = $oTransaction->putInTestMode()->setAmountDebit(1.23)->setService(ServiceHelper::SERVICE_BANCONTACT_MR_CASH)->setInvoice('TEST_INVOICE')->perform(); var_dump($response1, $response2);
/** * PayPalTransaction constructor. * * @param string $sWebsiteKey The Buckaroo website key * @param string $sPemPath The path to the PEM file */ public function __construct($sWebsiteKey, $sPemPath) { parent::__construct($sWebsiteKey, $sPemPath); $this->setService(ServiceHelper::SERVICE_PAYPAL); }
/** * BancontactMrCashTransaction constructor. * * @param string $sWebsiteKey The Buckaroo website key * @param string $sPemPath The path to the PEM file */ public function __construct($sWebsiteKey, $sPemPath) { parent::__construct($sWebsiteKey, $sPemPath); $this->setService(ServiceHelper::SERVICE_BANCONTACT_MR_CASH); }
<?php include __DIR__ . "/../vendor/autoload.php"; use SeBuDesign\Buckaroo\SofortTransaction; use SeBuDesign\Buckaroo\Transaction; use SeBuDesign\Buckaroo\Helpers\ServiceHelper; /** * * WITH BANCONTACT & MR CASH TRANSACTION CLASS * */ $oTransaction = new SofortTransaction('CHANGEME', __DIR__ . '/../tests/test.pem'); $response1 = $oTransaction->putInTestMode()->sellingPhysicalGoods()->setAmount(1.23)->setInvoice('TEST_INVOICE')->perform(); /** * * WITH TRANSACTION CLASS * */ $oTransaction = new Transaction('CHANGEME', __DIR__ . '/../tests/test.pem'); $response2 = $oTransaction->putInTestMode()->setAmountDebit(1.23)->setService(ServiceHelper::SERVICE_SOFORT_PHYSICAL)->setInvoice('TEST_INVOICE')->perform(); var_dump($response1, $response2);
/** * PayPalTransaction constructor. * * @param string $sWebsiteKey The Buckaroo website key * @param string $sPemPath The path to the PEM file */ public function __construct($sWebsiteKey, $sPemPath) { parent::__construct($sWebsiteKey, $sPemPath); $this->setService(ServiceHelper::SERVICE_SEPA_DIRECT_DEBIT); }
<?php include __DIR__ . "/../vendor/autoload.php"; use SeBuDesign\Buckaroo\Transaction; use SeBuDesign\Buckaroo\PayPalTransaction; use SeBuDesign\Buckaroo\Helpers\ServiceHelper; /** * * WITH PAYPAL TRANSACTION CLASS * */ // With service parameters $oTransaction = new PayPalTransaction('CHANGEME', __DIR__ . '/../tests/test.pem'); $paypalResponse1 = $oTransaction->putInTestMode()->setAmount(1.23)->setInvoice('TEST_INVOICE')->setCustomerEmail('*****@*****.**')->setPageStylesheetUrl('http://link.to/css (30 chars)')->setBillingAgreement('A description used for a billing agreement. (max 127 characters)')->setProductName('A product / order id')->setStartRecurrent(true)->perform(); /** * * WITH TRANSACTION CLASS * */ // With service parameters $oTransaction = new Transaction('CHANGEME', __DIR__ . '/../tests/test.pem'); $paypalResponse2 = $oTransaction->putInTestMode()->setAmountDebit(1.23)->setInvoice('TEST_INVOICE')->setService(ServiceHelper::SERVICE_PAYPAL)->addServiceParameter('BuyerEmail', '*****@*****.**')->addServiceParameter('PageStyle', 'http://link.to/css (30 chars)')->addServiceParameter('BillingAgreementDescription', 'A description used for a billing agreement. (max 127 characters)')->addServiceParameter('ProductName', 'A product / order id')->setStartRecurrent(true)->perform(); var_dump($paypalResponse1, $paypalResponse2);
<?php include __DIR__ . "/../vendor/autoload.php"; use SeBuDesign\Buckaroo\IdealTransaction; use SeBuDesign\Buckaroo\Transaction; use SeBuDesign\Buckaroo\Helpers\ServiceHelper; /** * * WITH IDEAL TRANSACTION CLASS * */ $oTransaction = new IdealTransaction('CHANGEME', __DIR__ . '/../tests/test.pem'); $iDealResponse2 = $oTransaction->putInTestMode()->setAmount(1.23)->setIdealIssuer(ServiceHelper::IDEAL_BUNQ)->setInvoice('TEST_INVOICE')->perform(); // Get all static iDeal banks $staticIdealBanks = IdealTransaction::getStaticIdealBanks(); /** * * WITH TRANSACTION CLASS * */ $oTransaction = new Transaction('CHANGEME', __DIR__ . '/../tests/test.pem'); $iDealResponse = $oTransaction->putInTestMode()->setAmountDebit(1.23)->setService(ServiceHelper::SERVICE_IDEAL)->addServiceParameter('issuer', ServiceHelper::IDEAL_BUNQ)->setInvoice('TEST_INVOICE')->perform(); var_dump($iDealResponse, $iDealResponse2);