dimanche 21 février 2016

Use constants in request method Laravel

I have this method for doing payments. I try assign all needs values to $pr:

public function request()
    {
        $pr = new \SporoPayPaymentRequest();
        $pr->pu_predcislo = SLSP_SPOROPAY_PU_PREDCISLO;
        $pr->pu_cislo = SLSP_SPOROPAY_PU_CISLO;
        $pr->suma = $this->amount; // suma (v €)
        $pr->vs = $this->variableSymbol; // variabilný symbol platby
        $pr->url = $this->returnUrl;
        //$pr->mail_notif_att = 3;
        //$pr->email_adr = 'platby@App.sk';

        // ??? bez tychto dvoch parametrov to nejde
        $pr->param = urldecode('abc=defgh');
        $pr->ss = str_pad($this->specificSymbol, 10, 0, STR_PAD_LEFT);
        $pr->SetRedirectUrlBase('SLSP_SPOROPAY_REDIRECTURLBASE');

        if ($pr->Validate()) {
            $pr->SignMessage(SLSP_SPOROPAY_SHAREDSECRET);
            $paymentRequestUrl = $pr->GetRedirectUrl();
            // header("Location: " . $paymentRequestUrl);

            // pre pripad ze nas to nepresmeruje dame userovi moznost kliknut si priamo na link
            return $paymentRequestUrl;
        } else {
            return FALSE;
        }
    }`

I send array to this method and this array see like:

 array:6 [
  "mode" => "sandbox"
  "SLSP_SPOROPAY_PU_PREDCISLO" => "000000"
  "SLSP_SPOROPAY_PU_CISLO" => "0013662162"
  "SLSP_SPOROPAY_PU_KBANKY" => "0900"
  "SLSP_SPOROPAY_SHAREDSECRET" => "Z3qY08EpvLlAAoMZdnyUdQ=="
  "SLSP_SPOROPAY_REDIRECTURLBASE" => "http://ift.tt/1L3Nkmj"
]

How can i assign to SLSP_SPOROPAY_PU_PREDCISLO value from my array? Thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire