public function validateTerms() { return $this->request->getParam('Ds_Amount') / 100 == $this->invoice->first_total && $this->request->getParam('Ds_Currency') == Am_Currency::getNumericCode($this->invoice->currency); }
public function run(Am_Paysystem_Result $result) { $subscriptionid = $this->invoice->data()->get(Am_Paysystem_Epay::SUBSCRIPTIONID); $req = $this->plugin->APIRequest('subscription', 'authorize', $vars = array('merchantnumber' => $this->plugin->getConfig('id'), 'subscriptionid' => $subscriptionid, 'orderid' => $this->invoice->public_id . "-" . $this->invoice->getPaymentsCount(), 'amount' => $this->invoice->second_total * 100, 'currency' => Am_Currency::getNumericCode($this->invoice->currency), 'instantcapture' => 1, 'description' => 'Recurring payment for invoice ' . $this->invoice->public_id, 'email' => $this->invoice->getEmail(), 'ipaddress' => $this->invoice->getUser()->remote_addr)); $log = $this->getInvoiceLog(); $log->add(print_r($vars, true)); $this->ret = $this->plugin->getResponseXML($req); $log->add(print_r($this->ret, true)); if ($this->ret->authorizeResponse->authorizeResult != 'true') { $result->setFailed(___("Payment failed") . ":" . $this->plugin->getEpayError($this->ret->authorizeResponse->epayresponse)); } else { $result->setSuccess($this); $this->processValidated(); } }