Example #1
0
 function cancelAction(Invoice $invoice, $actionName, Am_Paysystem_Result $result)
 {
     $log = Am_Di::getInstance()->invoiceLogRecord;
     $log->title = "cancelRecurringPaymentProfile";
     $log->paysys_id = $this->getId();
     $apireq = new Am_Paysystem_PaypalApiRequest($this);
     $apireq->cancelRecurringPaymentProfile($invoice, $invoice->data()->get(self::PAYPAL_PROFILE_ID));
     $vars = $apireq->sendRequest($log);
     $log->setInvoice($invoice);
     $log->update();
     if ($vars['ACK'] != 'Success') {
         throw new Am_Exception_InputError('Transaction was not cancelled. Got error from paypal: ' . $vars['L_SHORTMESSAGE0']);
     }
     $invoice->setCancelled(true);
     $result->setSuccess();
 }