Exemplo n.º 1
0
 /**
  * $res is an object
  * */
 function addPayoutEntry($order_id, $txnid, $status, $pg_plugin)
 {
     // GET BUSINESS EMAIL
     $plugin = JPluginHelper::getPlugin('payment', $pg_plugin);
     $pluginParams = json_decode($plugin->params);
     $businessPayEmial = "";
     if (property_exists($pluginParams, 'business')) {
         $businessPayEmial = trim($pluginParams->business);
     } else {
         return array();
     }
     $params = JComponentHelper::getParams('com_quick2cart');
     $send_payments_to_owner = $params->get('send_payments_to_owner', 0);
     if ($pg_plugin == 'adaptive_paypal') {
         $comquick2cartHelper = new comquick2cartHelper();
         $storeHelper = new storeHelper();
         $adaptiveDetails = $storeHelper->getorderItemsStoreInfo($order_id);
         $Quick2cartModelReports = $comquick2cartHelper->loadqtcClass(JPATH_SITE . "/components/com_quick2cart/models/reports.php", 'Quick2cartModelReports');
         $reportStatus = $status == 'C' ? 1 : 0;
         foreach ($adaptiveDetails as $userReport) {
             $Quick2cartModelpayment = new Quick2cartModelpayment();
             $payDetail = $Quick2cartModelpayment->getPayoutId($txnid, $userReport['owner']);
             if (!empty($payDetail) && $payDetail['status'] == $reportStatus) {
                 // payout already present mean $payDetail will not empty AND STATUS is same then dont process.
                 // for new payout,thisl will not process
                 break;
             }
             $post = array();
             $post['id'] = empty($payDetail['id']) ? '' : $payDetail['id'];
             $post['user_id'] = $userReport['owner'];
             $post['payee_name'] = $comquick2cartHelper->getUserName($post['user_id']);
             $post['paypal_email'] = $userReport['store_email'];
             $post['transaction_id'] = $txnid;
             $post['payment_amount'] = $userReport['commissonCutPrice'];
             $post['payout_date'] = date('Y-m-d');
             $post['status'] = $reportStatus;
             $post['payment_comment'] = "adaptive pay";
             $Quick2cartModelReports->savePayout($post);
         }
     }
 }