Exemple #1
0
 public function runDataLinkServiceProcess()
 {
     $adapter = new BILLINGCCBILL_CLASS_CcbillAdapter();
     $adapter->runDataLinkService();
 }
Exemple #2
0
 public function process()
 {
     $values = $this->getValues();
     $billingService = BOL_BillingService::getInstance();
     $gwKey = BILLINGCCBILL_CLASS_CcbillAdapter::GATEWAY_KEY;
     $billingService->setGatewayConfigValue($gwKey, 'clientAccnum', $values['clientAccnum']);
     $billingService->setGatewayConfigValue($gwKey, 'clientSubacc', $values['clientSubacc']);
     $billingService->setGatewayConfigValue($gwKey, 'ccFormName', $values['ccFormName']);
     $billingService->setGatewayConfigValue($gwKey, 'ckFormName', $values['ckFormName']);
     $billingService->setGatewayConfigValue($gwKey, 'dpFormName', $values['dpFormName']);
     $billingService->setGatewayConfigValue($gwKey, 'edFormName', $values['edFormName']);
     $billingService->setGatewayConfigValue($gwKey, 'dynamicPricingSalt', $values['dynamicPricingSalt']);
     $billingService->setGatewayConfigValue($gwKey, 'datalinkUsername', $values['datalinkUsername']);
     $billingService->setGatewayConfigValue($gwKey, 'datalinkPassword', $values['datalinkPassword']);
     // update additional sub-account values
     $adapter = new BILLINGCCBILL_CLASS_CcbillAdapter();
     $subAccounts = $adapter->getAdditionalSubaccounts();
     if ($subAccounts) {
         foreach ($subAccounts as $key => $sub) {
             if (array_key_exists($key, $values)) {
                 $billingService->setGatewayConfigValue($gwKey, $key, $values[$key]);
             }
         }
     }
 }
Exemple #3
0
 public function postback()
 {
     $logger = OW::getLogger('billingccbill');
     $logger->addEntry(print_r($_POST, true), 'postback.data-array');
     $logger->writeLog();
     $clientAccnum = $_POST['clientAccnum'];
     $clientSubacc = $_POST['clientSubacc'];
     $amount = $_POST['initialPrice'] ? $_POST['initialPrice'] : $_POST['recurringPrice'];
     $saleHash = $_POST['custom'];
     $transId = $_POST['subscription_id'];
     $digest = $_POST['responseDigest'];
     if (!mb_strlen($saleHash) || !mb_strlen($transId)) {
         exit;
     }
     $billingService = BOL_BillingService::getInstance();
     $adapter = new BILLINGCCBILL_CLASS_CcbillAdapter();
     $sale = $billingService->getSaleByHash($saleHash);
     if (!$sale) {
         exit;
     }
     if ($amount != $sale->totalAmount) {
         $logger->addEntry("Wrong amount: " . $amount, 'postback.amount-mismatch');
         $logger->writeLog();
         exit;
     }
     if ($billingService->getGatewayConfigValue(BILLINGCCBILL_CLASS_CcbillAdapter::GATEWAY_KEY, 'clientAccnum') != $clientAccnum) {
         $logger->addEntry("Wrong CCBill account: " . $clientAccnum, 'postback.account-mismatch');
         $logger->writeLog();
         exit;
     }
     if ($adapter->transactionApproved($clientAccnum, $clientSubacc, $transId, $digest)) {
         if ($sale->status != BOL_BillingSaleDao::STATUS_DELIVERED) {
             $sale->transactionUid = $transId;
             if ($billingService->verifySale($adapter, $sale)) {
                 $sale = $billingService->getSaleById($sale->id);
                 $productAdapter = $billingService->getProductAdapter($sale->entityKey);
                 if ($productAdapter) {
                     $billingService->deliverSale($productAdapter, $sale);
                 }
             }
         }
     }
     exit;
 }