protected function processSubscriptionPayment() {
        $this->debug("Start registering recurring payment / subscription");

        $form = new Pap_Features_RecurringCommissions_RecurringCommissionsForm();
        try {
            $form->createCommissionsNoRpc($this->getSubscriptionID());
            $this->debug("Recurring commission processed.");
        } catch (Gpf_Exception $e) {
            $this->debug("Error occurred during launching recurring commission: " . $e->getMessage());
            if (!$this->allowUseRecurringCommissionSettings()) {
                $this->debug("Registering new recurring commission.");
                $this->findPaymentBySubscriptionID();
                $this->registerCommission();
            } else {
                $this->debug("New inicialize recurring commission was not created, enabled setting - save only matched commissions.");
            }
        }
        $this->debug("End registering recurring payment / subscription");
    }
Exemplo n.º 2
0
    protected function processSubscriptionPayment() {
        $this->debug("Start registering recurring payment / subscription");

        $recurringComm = new Pap_Features_RecurringCommissions_RecurringCommissionsForm();
        $recurringComm->createCommissionsNoRpc($this->getOrderID());

        $this->debug("End registering recurring payment / subscription");
    }
Exemplo n.º 3
0
    private function processRebill($rebill) {
        if ((Gpf_Settings::get(ccBill_Config::USE_RECURRING_COMMISSION)==Gpf::YES) && class_exists('Pap_Features_RecurringCommissions_RecurringCommissionsForm')) {
            $form = new Pap_Features_RecurringCommissions_RecurringCommissionsForm();
            try {
                $form->createCommissionsNoRpc($rebill[3]);
                Gpf_Log::debug('Ok - rebil processed by recurring commissions plugin');
                return;
            } catch (Exception $e) {
                Gpf_Log::debug('Processing by recurring commissions plugin failed: ' . $e->getMessage());
                return;
            }
        } else {
            Gpf_Log::debug('Processing by recurring commissions is DISABLED. Continuing the ordinary way...');
        }
        if ($this->rebillExists($rebill[5])) {
            Gpf_Log::debug('Rebill transaction id = ' . $rebill[5] . ' already exists - skipping');
            return;
        }
        try {
            $transaction = $this->findTransaction($rebill[3]);
        } catch (Gpf_Exception $e) {
            Gpf_Log::debug('Can not find original transaction for rebilling for transaction =' . $rebill[3] . ', reason: ' .$e->getMessage());
            return;
        }

        $newTransaction = new Pap_Common_Transaction();
        $newTransaction = clone $transaction;

        $date = new Gpf_DateTime(strtotime($rebill[4]));

        $newTransaction->setId('_NULL_');
        $newTransaction->setDateInserted($date->toDateTime());
        $newTransaction->setDateApproved($date->toDateTime());
        $newTransaction->setOrderId($rebill[5]);
        $newTransaction->setMerchantNote($this->_('Processed rebill from ccBill transaction: ' . $rebill[3]));
        $newTransaction->insert();

        $form = new Pap_Merchants_Transaction_TransactionsForm();
        $form->addMultiTierTransaction($transaction->getTotalCost(), $transaction->getCampaignId(), $transaction->getUserId(), $transaction->getCommissionTypeId(), $transaction->getStatus(), $newTransaction);
    }