public function testAdjudicateProject()
 {
     $projectId = 32;
     $offerId = 5;
     //Proyect owner = 1
     //Winner = 2
     $this->assertTrue(AdjudicationManager::adjudicateProject($projectId, $offerId));
 }
Example #2
0
        $order->set('status', Order::ORDER_STATUS_FAILED);
    }
    $order->save();
    if ($paymentMethod->getStatus() == Payment::PAYMENT_STATUS_APPROVED) {
        //Sacar order products
        $products = OrderProduct::getProductsByOrderId($order->id);
        if (empty($products)) {
            //TODO correo aqui
            //TODO log
            $processResult = 99;
        }
        foreach ($products as $product) {
            //Aplicar cambios segun cada producto
            if ($product->id == Product::PRODUCT_ADJUDICAR_ID) {
                //TODO validar offer id  y project id
                $result = AdjudicationManager::adjudicateProject($data->project_id, $data->offer_id);
                if (!$result) {
                    //Falló adjudicacion
                    //TODO notificar a paulo
                }
            }
        }
    } else {
        $processResult = 99;
    }
}
// Notificar al gateway (mandar la respuesta que ellos esperan)
$response = new \stdClass();
$response->respuesta = $processResult;
$response->token = $token;
$app->getResponse()->jsonResponse($response);