コード例 #1
0
ファイル: Order.php プロジェクト: narbelys/fototea
 /**
  * @param $name
  */
 public static function create($userId, $totalAmount)
 {
     $order = ORM::for_table(self::$table)->create();
     $order->user_id = $userId;
     $order->status = self::ORDER_STATUS_IN_PROGRESS;
     $order->date = DateHelper::getCurrentDateTime();
     $order->total = $totalAmount;
     $order->save();
     return $order;
 }
コード例 #2
0
ファイル: Payment.php プロジェクト: narbelys/fototea
 /**
  * @param $userId
  * @param $totalAmount
  * @return $this
  */
 public static function create($orderId, $gatewayId, $paymentMethod)
 {
     $payment = ORM::for_table(self::$table)->create();
     $payment->type = $paymentMethod;
     $payment->date = DateHelper::getCurrentDateTime();
     $payment->status = self::PAYMENT_STATUS_PENDING;
     $payment->gateway_id = $gatewayId;
     $payment->order_id = $orderId;
     $payment->save();
     return $payment;
 }
コード例 #3
0
ファイル: Credit.php プロジェクト: narbelys/fototea
 /**
  * Used to create a new credit.
  * @return bool|int
  */
 public static function newCredit($userId, $reasignedCreditId = null)
 {
     if ($userId == null) {
         return false;
     }
     $credit = ORM::for_table(self::CREDIT_TABLE)->create();
     $credit->user_id = $userId;
     $credit->date = DateHelper::getCurrentDateTime();
     $credit->reasigned_credit_id = $reasignedCreditId;
     $credit->save();
     if ($credit->id) {
         return $credit->id;
     } else {
         return false;
     }
 }
コード例 #4
0
ファイル: puntopagos.php プロジェクト: narbelys/fototea
use Fototea\Models\Order;
use Fototea\Models\OrderProduct;
use Fototea\Models\Payment;
use Fototea\Models\PaymentManager;
use Fototea\Models\Product;
use Fototea\Models\Project;
use Fototea\Models\PuntoPagos;
use Fototea\Models\AdjudicationManager;
//var_dump($app->getRequest()->server());
//var_dump($app->getRequest()->headers('cache-control'));
//TODO Importante blindar este método!!!!! varias fugas
//die();
// INIT - ONLY FOR TEST PURPOSES
$file = 'puntopago.txt';
$content = "-----------------------------------------------------------------------------------------\n";
$content .= DateHelper::getCurrentDateTime();
$content .= "-----------------------------------------------------------------------------------------\n";
$content .= "\nGET\n";
$content .= json_encode($_GET);
$content .= "\n\nPOST\n";
$content .= json_encode($_POST);
$content .= "\n\n";
//file_put_contents($file, $content, FILE_APPEND);
// END - ONLY FOR TEST PURPOSES
$token = $app->getRequest()->get('token');
$processResult = 00;
if (empty($token)) {
    $processResult = 99;
} else {
    //TODO falta validar la firma....
    $paymentMethod = new PaymentManager($app, PuntoPagos::PAYMENT_METHOD_TYPE);