Hello, i have a error with my my plugin payment Request not handled - createTransaction() returned null have you a idéa ? Frédéric
Which a plugin plims modified for my CB systeme class Am_Paysystem_Transaction_Plimus2 extends Am_Paysystem_Transaction_Incoming{ public function findInvoiceId(){ return $this->request->get('custom1'); } public function getUniqId() { return $this->request->get("ref"); } public function validateSource() { // there must be some code to validate if IPN came from payment system, and not from a "hacker" return true; } public function validateStatus() { // there must be code to check post variables and confirm that the post indicates successful payment transaction return true; } public function validateTerms() { // compare our invoice payment settings, and what payment system handled // if there is difference, it is possible that redirect url was modified // before payment //$invoice->first_total=$invoice->first_total*100; //return ($this->request->get('montant') == $this->invoice->first_total); return true; } }
Please paste your entire plugin source code. Put Code: [php] .... [/php] around your code for formatting. In short, you have to implement createTransaction() method in your payment plugin to return a transaction object.
PHP: <?phpclass Am_Paysystem_Plimus2 extends Am_Paysystem_Abstract {const PLUGIN_STATUS = self::STATUS_DEV;const PLUGIN_REVISION = '4.1.6.07372be';protected $defaultTitle = 'Paybox2';protected $defaultDescription = 'Carte bancaire sécurisée';const URL = "[URL]http://www.xxxxxxx.cgi[/URL]";const TESTING_URL = "[URL]http://www.xxxxxxx.cgi[/URL]";const MODE_LIVE = 'live';const MODE_SANDBOX = 'sandbox';const MODE_TEST = 'test';public function _initSetupForm(Am_Form_Setup $form) {$s = $form->addSelect("testing")->setLabel("test Mode Enabled");$s->addOption("Live account", self::MODE_LIVE);$s->addOption("Sandbox account", self::MODE_SANDBOX);// $s->addOption("Account in test mode", self::MODE_TEST);}public function getSupportedCurrencies(){return array('EUR');}public function init(){parent::init();$this->getDi()->billingPlanTable->customFields()->add(new Am_CustomFieldText('plimus_contract_id', "Plimus Contract ID","You must enter the contract id of Plimus product.<br/>Plimus contract must have the same settings as amember product."));}public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result){$a = new Am_Paysystem_Action_Redirect((($this->getConfig('testing')==self::MODE_SANDBOX) ? self::TESTING_URL : self::URL));$a->contract_id = $invoice->getItem(0)->getBillingPlanData("plimus_contract_id");$a->custom1 = $invoice->public_id;$a->member_id = $invoice->user_id;$a->currency = $this->getCurrencyCode();$a->Nom= $invoice->getFirstName();$a->Prénom = $invoice->getLastName();$a->PBX_PORTEUR = $invoice->getEmail();$a->PBX_MODE = "1";$a->PBX_SITE = "xxxxx";$a->PBX_RANG = "01";$a->PBX_IDENTIFIANT = "xxxxxx";$invoice->first_total=$invoice->first_total*100;$a->PBX_TOTAL = $invoice->first_total;$a->PBX_WAIT = "0";$a->PBX_DEVISE = "978";$a->PBX_CMD = "custom1:$a->custom1";$a->PBX_RETOUR = "montant:M;ref:R;auto:A;trans:T;numabo:B,datefin:D;tes:K;custom1:$a->custom1;nom:$a->Nom;prenom:$a->Prénom;obj:$a->member_id;obj2";$a->PBX_EFFECTUE = "[URL]http://www.xxxxxx/plimus2/ipn[/URL]";$a->PBX_REFUSE = "[URL]http://www.xxxxxr[/URL]";$a->PBX_ANNULE = "$this->getCancelUrl()";$a->filterEmpty();$result->setAction($a);}public function createTransaction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs) {switch($request->get("transactionType")){}}function getCurrencyCode(){return strtoupper($this->invoice->currency);}// let aMember know how this plugin is going to deal with recurring paymentspublic function getRecurringType(){return self::REPORTS_EOT;} function getReadme(){return <<<CUTIci le texte pour décrire l'explication de paiementCUT;}}class Am_Paysystem_Transaction_Plimus2 extends Am_Paysystem_Transaction_Incoming{public function findInvoiceId(){return $this->request->getFiltered('custom1');}public function getUniqId() {return $this->request->get("ref"); }public function validateSource() {// there must be some code to validate if IPN came from payment system, and not from a "hacker"return true;}public function validateStatus() {// there must be code to check post variables and confirm that the post indicates successful payment transactionreturn true;}public function validateTerms() {// compare our invoice payment settings, and what payment system handled// if there is difference, it is possible that redirect url was modified// before payment//$invoice->first_total=$invoice->first_total*100;//return ($this->request->get('montant') == $this->invoice->first_total);return true;} } ?>
And the link in return /plimus2/ipn?custom1=421N5&psReceipt=dd&montant=18500&ref=3335&auto=032651&trans=351185110&numabo:B,datefin=1404&tes=TA4dgMQpfJml7LE9pQjklHHq4QeC%2BDoYF30Uu%2Bb%2FnRiYQgqKudxppFTLvKD1s%2BZbtNjxHMxn99q
Replace public function createTransaction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs) { switch($request->get("transactionType")){ } } to: public function createTransaction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs) { return new Am_Paysystem_Transaction_Plimus2($this, $request, $response, $invokeArgs); }
I guess this parameter $a->PBX_EFFECTUE = "http://www.xxxxxx/plimus2/ipn"; is used as return url by your payment system and not as hidden postback. If there is no special parameter for hidden postback, add redirect to thanks page after postback will be processed. For example in process validated method: PHP: public function processValidated() { $this->invoice->addPayment($this); Am_Controller::redirectLocation($this->getPlugin()->getReturnUrl()); }
When i add this i have Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /home/infoconc/www/amember/application/default/plugins/payment/plimus2.php on line 118
i have testing with : public function processValidated() { Am_Controller::redirectLocation($this->request->get("ret")); } ret = http://www.ypurssite.com and i have Fatal error: Class '��������Am_Controller' not found in /home/infoconc/www/amember/application/default/plugins/payment/plimus2.php on line 121
Dear fmagusto, I believe it is better to hire a PHP programmer to do the job. I do not think we can debug a script via forum. P.S. Regarding last problem - there are not-printable chars in your PHP source code before Am_Controller.
Sorry alex, it s ok. Finaly it s just the space (i work in mac) and in linux, the space is not egal. Thx, the pluggin work.