Esempio n. 1
0
 public function create($account_alias = false)
 {
     $invoice_data = array('invoice' => array('items' => $this->items, 'taxes' => $this->taxes, 'total_amount' => $this->getTotalAmount(), 'description' => $this->getDescription()), 'store' => array('name' => Paydunya_Checkout_Store::getName(), 'tagline' => Paydunya_Checkout_Store::getTagline(), 'postal_address' => Paydunya_Checkout_Store::getPostalAddress(), 'phone' => Paydunya_Checkout_Store::getPhoneNumber(), 'logo_url' => Paydunya_Checkout_Store::getLogoUrl(), 'website_url' => Paydunya_Checkout_Store::getWebsiteUrl()), 'custom_data' => $this->showCustomData(), 'actions' => array('cancel_url' => $this->cancel_url, 'return_url' => $this->return_url));
     $payload = array('invoice_data' => $invoice_data, 'opr_data' => array('account_alias' => $account_alias));
     $result = Paydunya_Utilities::httpJsonRequest(Paydunya_Setup::getOPRInvoiceUrl(), $payload);
     switch ($result["response_code"]) {
         case 00:
             $this->status = Paydunya::SUCCESS;
             $this->token = $result["token"];
             $this->invoice_token = $result["invoice_token"];
             $this->response_code = $result["response_code"];
             $this->response_text = $result["response_text"];
             return true;
             break;
         default:
             $this->invoice_url = "";
             $this->status = Paydunya::FAIL;
             $this->response_code = $result["response_code"];
             $this->response_text = $result["response_text"];
             return false;
             break;
     }
 }
Esempio n. 2
0
 public static function setReturnUrl($url)
 {
     if (filter_var($url, FILTER_VALIDATE_URL)) {
         self::$returnUrl = $url;
     }
 }
Esempio n. 3
0
<?php

require 'paydunya_php/paydunya.php';
Paydunya_Setup::setMasterKey("wQzk9ZwR-Qq9m-0hD0-zpud-je5coGC3FHKW");
Paydunya_Setup::setPublicKey("live_public_wxGWFgpBzar1Vd8VJi5Ox7KvU4C");
Paydunya_Setup::setPrivateKey("live_private_SyJiZG2H0mWtGjUIaAO1b4DFGAr");
Paydunya_Setup::setMode("live");
Paydunya_Setup::setToken("mrS9ktL5ullbVHiOV7e1");
//Configuration des informations de votre service/entreprise
Paydunya_Checkout_Store::setName("La boutique de Sandra");
Paydunya_Checkout_Store::setTagline("L'élégance n'a pas de prix");
Paydunya_Checkout_Store::setPhoneNumber("774262038");
Paydunya_Checkout_Store::setPostalAddress("Dakar Plateau - Etablissement kheweul");
// Vous pouvez mettre ici localhost pour vos tests de redirection en local
// Paydunya_Checkout_Store::setCancelUrl("http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php");
// Paydunya_Checkout_Store::setReturnUrl("http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/confirm.php");
Esempio n. 4
0
 public static function setCallbackUrl($url)
 {
     if (filter_var($url, FILTER_VALIDATE_URL)) {
         self::$callbackUrl = $url;
     }
 }