Esempio n. 1
0
 /** @return EcommercePaymentRequest*/
 protected function provideEcommercePaymentRequest()
 {
     $ecommercePaymentRequest = new EcommercePaymentRequest(new FakeShaComposer());
     $ecommercePaymentRequest->setPspid('123456789');
     $ecommercePaymentRequest->setOrderid('987654321');
     $ecommercePaymentRequest->setCurrency('EUR');
     $ecommercePaymentRequest->setAmount(100);
     return $ecommercePaymentRequest;
 }
Esempio n. 2
0
 /** @return EcommercePaymentRequest */
 protected function provideMinimalPaymentRequest()
 {
     $paymentRequest = new EcommercePaymentRequest(new FakeShaComposer());
     $paymentRequest->setPspid('123456789');
     $paymentRequest->setOrderid('987654321');
     $paymentRequest->setOgoneUri(EcommercePaymentRequest::TEST);
     // minimal required fields for ogone (together with pspid and orderid)
     $paymentRequest->setCurrency("EUR");
     $paymentRequest->setAmount(100);
     // these fields are actually optional but are good practice to be included
     $paymentRequest->setCustomername("Louis XIV");
     $paymentRequest->setOwnerAddress("1, Rue du Palais");
     $paymentRequest->setOwnerTown("Versailles");
     $paymentRequest->setOwnerZip('2300');
     $paymentRequest->setOwnerCountry("FR");
     $paymentRequest->setEmail("*****@*****.**");
     return $paymentRequest;
 }
Esempio n. 3
0
 /**
  * @param string $locale
  * @param string $orderId
  * @param string $customerName
  * @param integer $amount Amount in cents
  * @param string $currency Example : EUR
  * @param array $options
  * @param bool $showSubmitButton
  * @return string
  */
 public function getRequestForm($locale, $orderId, $customerName, $amount, $currency = "EUR", $options = array(), $showSubmitButton = true)
 {
     $passphrase = $this->shaIn;
     $shaComposer = new AllParametersShaComposer($passphrase);
     $shaComposer->addParameterFilter(new ShaInParameterFilter());
     //optional
     $paymentRequest = new EcommercePaymentRequest($shaComposer);
     switch ($this->environment) {
         case 'prod':
             $paymentRequest->setOgoneUri(EcommercePaymentRequest::PRODUCTION);
             break;
         default:
             $paymentRequest->setOgoneUri(EcommercePaymentRequest::TEST);
             break;
     }
     $paymentRequest->setPspid($this->pspid);
     $paymentRequest->setCn($customerName);
     $paymentRequest->setOrderid($orderId);
     $paymentRequest->setAmount($amount);
     $paymentRequest->setCurrency($currency);
     // setting options defined in config
     foreach ($this->options as $option => $value) {
         $setter = "set" . $option;
         $paymentRequest->{$setter}($value);
     }
     // setting options defined in method call
     foreach ($options as $option => $value) {
         $setter = "set" . $option;
         $paymentRequest->{$setter}($value);
     }
     $paymentRequest->setLanguage($this->localeToIso($locale));
     $paymentRequest->validate();
     $this->formGenerator->showSubmitButton($showSubmitButton);
     return $this->formGenerator->render($paymentRequest);
 }
Esempio n. 4
0
use Ogone\Passphrase;
use Ogone\Ecommerce\EcommercePaymentRequest;
use Ogone\ShaComposer\AllParametersShaComposer;
use Ogone\FormGenerator\SimpleFormGenerator;
$passphrase = new Passphrase('my-sha-in-passphrase-defined-in-ogone-interface');
$shaComposer = new AllParametersShaComposer($passphrase);
$shaComposer->addParameterFilter(new ShaInParameterFilter());
//optional
$ecommercePaymentRequest = new EcommercePaymentRequest($shaComposer);
// Optionally set Ogone uri, defaults to TEST account
//$ecommercePaymentRequest->setOgoneUri(EcommercePaymentRequest::PRODUCTION);
// Set various params:
$ecommercePaymentRequest->setOrderid('123456');
$ecommercePaymentRequest->setAmount(150);
// in cents
$ecommercePaymentRequest->setCurrency('EUR');
// ...
$ecommercePaymentRequest->validate();
$formGenerator = new SimpleFormGenerator();
$html = $formGenerator->render($ecommercePaymentRequest);
// Or use your own generator. Or pass $ecommercePaymentRequest to a view
class Ogone extends Front
{
    public function __construct()
    {
        parent::__construct();
        \CI::lang()->load('ogone');
    }
    //back end installation functions
    public function checkoutForm()
    {