function __construct(Am_Paysystem_Transaction_Interface $transaction) { $this->Amount = $transaction->getAmount(); $this->PaysysId = $transaction->getPaysysId(); $this->ReceiptId = $transaction->getReceiptId(); $this->RecurringType = $transaction->getRecurringType(); $this->Time = $transaction->getTime()->format('Y-m-d H:i:s'); $this->TimeZone = $transaction->getTime()->getTimezone()->getName(); $this->UniqId = $transaction->getUniqId(); }
/** * Add access period for current product based on information from incoming paysystem transaction * @throws Am_Exception_Db_NotUnique */ public function addAccessPeriod($isFirstPayment, Invoice $invoice, Am_Paysystem_Transaction_Interface $transaction, $beginDate, $invoicePaymentId) { if ($this->item_type != 'product') { return; } // if that is not a product then no access $a = $this->getDi()->accessRecord; $a->setDisableHooks(true); $a->begin_date = $beginDate; $p = new Am_Period($isFirstPayment ? $this->first_period : $this->second_period); $a->invoice_id = $this->invoice_id; $a->invoice_public_id = $this->invoice_public_id; $recurringType = $transaction->getRecurringType(); if (in_array($recurringType, array(Am_Paysystem_Abstract::REPORTS_EOT, Am_Paysystem_Abstract::REPORTS_NOTHING))) { $a->expire_date = Am_Period::RECURRING_SQL_DATE; } else { $a->expire_date = $p->addTo($a->begin_date); } $a->product_id = $this->item_id; $a->user_id = $invoice->user_id; $a->transaction_id = $transaction->getUniqId(); $a->invoice_payment_id = $invoicePaymentId; $a->invoice_item_id = $this->pk(); $a->qty = $this->qty; $a->insert(); }