A erreur in payment

Discussion in 'aMember Pro v.4' started by fmagusto, Jan 15, 2012.

  1. fmagusto

    fmagusto Guest

    Hello, i have this error for a payment and the product is a simple paymement and i validate the payement in admin, is appear a recurent

    15/01/12 11:54
    Click to Expand
    31.36.56.5 Existing payments count [1] exceeds number of allowed rebills [0]+1, could not add new payment
    Click to Expand

    /amember/payment/plimus2/ipn?montant=9700&ref=H6YBZ&prix=9700&r=1948&pr=9700&o=3748&ret=http://www.musite.com/amember



    Exception Am_Exception_Paysystem
    Invoice->addPaymentWithoutAccessPeriod [ application/default/models/Invoice.php : 941 ]
    Invoice->addPayment [ application/default/plugins/payment/plimus2.php : 133 ]
    Am_Paysystem_Transaction_Plimus2->processValidated [ library/Am/Paysystem/Transaction/Abstract.php : 46 ]
    Am_Paysystem_Transaction_Abstract->process [ library/Am/Paysystem/Transaction/Incoming.php : 222 ]
    Am_Paysystem_Transaction_Incoming->process [ library/Am/Paysystem/Abstract.php : 442 ]
    Am_Paysystem_Abstract->directAction [ application/default/controllers/DirectController.php : 35 ]
    DirectController->__call [ library/Am/Controller.php : 118 ]
    Am_Controller->dispatch [ library/Zend/Controller/Dispatcher/Standard.php : 295 ]
    Zend_Controller_Dispatcher_Standard->dispatch [ library/Zend/Controller/Front.php : 954 ]
    Zend_Controller_Front->dispatch [ library/Am/App.php : 1372 ]
    Am_App->run [ index.php : 41 ]
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    What is plimus 2 ? Is this something that you created yourself?Error is generated because amember try to insert second payment into not-recurring invoice.
  3. fmagusto

    fmagusto Guest

    Plimus 2, is a plugin for my payement.

    <?php

    class Am_Paysystem_Plimus2 extends Am_Paysystem_Abstract {
    const PLUGIN_STATUS = self::STATUS_DEV;
    const PLUGIN_REVISION = '0.1';
    protected $defaultTitle = 'Paybox2';
    protected $defaultDescription = 'Carte bancaire sécurisée Paybox';
    const URL = "http://www.infoconcours.com/cgi-bin/modulev2.cgi";
    const TESTING_URL = "http://www.infoconcours.com/cgi-bin/modulev2.cgi";
    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', "Nombre de paiement 1 pour 1 fois, et 3 pour Fois",
    "(les autres ne sont pas progammés, mais à voir pour mettre 2 fois par exemple"));
    }
    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->invoice_id = $invoice->invoice_id;



    if ($a->contract_id > 1){
    $a->PBX_CMD = "custom1=$a->custom1&div=PBX_2MONT0000000000PBX_NBPAIE02PBX_FREQ01PBX_QUAND00&prix=$invoice->first_total&r=$a->member_id&pr=$invoice->first_total&o=$a->invoice_id&ret=http://www.infoconcours.com/amember&nom=$a->Nom";
    $invoice->first_total = ($invoice->first_total*100);

    }else {
    $invoice->first_total=$invoice->first_total*100;
    $a->PBX_CMD = "custom1=$a->custom1&prix=$invoice->first_total&r=$a->member_id&pr=$invoice->first_total&o=$a->invoice_id&ret=http://www.infoconcours.com/amember&nom=$a->Nom";

    }

    $o = $invoice->invoice_id;

    $a->currency = $this->getCurrencyCode();
    $a->Nom= $invoice->getFirstName();
    $a->Prenom = $invoice->getLastName();
    $a->PBX_PORTEUR = $invoice->getEmail();
    $a->PBX_MODE = "1";
    $a->PBX_SITE = "5864408";
    $a->PBX_RANG = "01";
    $a->PBX_IDENTIFIANT = "58644081";
    $a->PBX_TOTAL = $invoice->first_total;
    $a->PBX_WAIT = "0";
    $a->PBX_DEVISE = "978";
    $a->PBX_RETOUR = "montant:M;ref:R;auto:A;trans:T;numabo:B,datefin:D";
    $a->PBX_EFFECTUE = "http://www.infoconcours.com/amember/payment/plimus2/ipn";
    $a->PBX_REFUSE = "http://www.infoconcours.com/amember/content/p/id/3/";
    $a->PBX_ANNULE = "http://www.infoconcours.com/amember/signup";
    $a->filterEmpty();
    $result->setAction($a);
    }


    public function createTransaction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs) {
    return new Am_Paysystem_Transaction_Plimus2($this, $request, $response, $invokeArgs);

    }


    function getCurrencyCode()
    {
    return strtoupper($this->invoice->currency);
    }
    // let aMember know how this plugin is going to deal with recurring payments
    public function getRecurringType()
    {
    return self::REPORTS_EOT;
    }


    function getReadme(){
    return <<<CUT
    Ici le texte pour décrire l'explication de paiement
    CUT;
    }
    }

    class Am_Paysystem_Transaction_Plimus2 extends Am_Paysystem_Transaction_Incoming{

    public function findInvoiceId(){
    return $this->request->getFiltered('r');

    }
    public function getUniqId() {
    return $this->request->get("o");


    }

    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;
    }

    public function processValidated() {
    $this->invoice->addPayment($this);
    Am_Controller::redirectLocation($this->request->get("ret"));
    }


    }
    ?>
  4. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Please attach that invoice transaction log as well.(I mean that invoice that generate error)
  5. fmagusto

    fmagusto Guest

    /amember/payment/plimus2/ipn?montant=9700&ref=custom1=WDU1R&prix=9700&r=1344&pr=9700&o=3765&ret=http://www.infoconcours.com/amember&nom=&auto=600642&trans=353233346&numabo:B,datefin=1306

    Exception Am_Exception_Paysystem
    Invoice->addPaymentWithoutAccessPeriod [ application/default/models/Invoice.php : 941 ]
    Invoice->addPayment [ application/default/plugins/payment/plimus2.php : 134 ]
    Am_Paysystem_Transaction_Plimus2->processValidated [ library/Am/Paysystem/Transaction/Abstract.php : 46 ]
    Am_Paysystem_Transaction_Abstract->process [ library/Am/Paysystem/Transaction/Incoming.php : 222 ]
    Am_Paysystem_Transaction_Incoming->process [ library/Am/Paysystem/Abstract.php : 442 ]
    Am_Paysystem_Abstract->directAction [ application/default/controllers/DirectController.php : 35 ]
    DirectController->__call [ library/Am/Controller.php : 118 ]
    Am_Controller->dispatch [ library/Zend/Controller/Dispatcher/Standard.php : 295 ]
    Zend_Controller_Dispatcher_Standard->dispatch [ library/Zend/Controller/Front.php : 954 ]
    Zend_Controller_Front->dispatch [ library/Am/App.php : 1372 ]
    Am_App->run [ index.php : 41 ]
  6. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    I need xml info from aMember CP -> Edit user -> Payments -> Invocie Transaction Log
  7. fmagusto

    fmagusto Guest

    This ?

    1.0 VALUE 3765 1344 plimus2 EUR 81.51 0.00 15.49 0.00 97.00 1y 0 0.00 0.00 0.00 0.00 0.00 19.00 0 WDU1R WBBwEYfB58Y4i460 2012-01-17 11:59:34 2012-01-17 12:00:46 1.000000 3771 3765 103 product Site infoconcours acc&eacute;s complet aux concours Tout le site Infoconcours,mais SANS le journal. 1 81.51 0.00 15.49 97.00 0.00 1y 0 0.00 0.00 0.00 0.00 EUR 0 2 0 0 122 a:2:{s:9:"paypal_nb";s:1:"1";s:18:"plimus_contract_id";s:1:"1";}
  8. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    Please submit a ticket via helpdesk. Debugging scripts in the forum is really not good idea.
  9. fmagusto

    fmagusto Guest

    Ok aleander. I post the helpdesk

Share This Page