コード例 #1
0
 public function processItem($payment_amount, $storeItem, $name)
 {
     $em = $this->getDoctrine()->getManager();
     # get the amount from the item minus reduction
     $amount = $storeItem->getAmount() * (1 - $storeItem->getReduction() / 100);
     $errors = array();
     $logger = $this->get('logger');
     if ($amount == $payment_amount) {
         # send the item ingame
         $query = ModuleController::parseCommand(array("USER" => $name, "TIME" => time()), $storeItem->getCommand());
         $result = ModuleController::executeQuery($query);
         if (!$result['success']) {
             $errors[] = "[ITEM=" . $storeItem->getId() . "] Failed to execute: " . $result['message'];
         }
     } else {
         $errors[] = "Amount paid was not equal to the item price";
     }
     //end $amount == $payment_amount
     if (count($errors) > 0) {
         return array("success" => false, "message" => json_encode($errors));
     } else {
         return array("success" => true, "message" => "The item has been successfully");
     }
 }
コード例 #2
0
 public function __construct()
 {
     parent::__construct();
     $this->bundle = 'MaximModuleApplicationBundle';
 }