<?php

namespace App\Http\Controllers\Api\Cobranzas;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

use App\Danoral\Cobranzas\Cobros\CobroFormaPago;
use App\Http\Controllers\Controller;
use App\Danoral\Bancos\MercantilAPI\MercantilAPI;

class CobroFormaPagoController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\Danoral\Cobranzas\CobroFormaPago  $cobroFormaPago
     * @return \Illuminate\Http\Response
     */
    public function show(CobroFormaPago $cobroFormaPago)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Danoral\Cobranzas\CobroFormaPago  $cobroFormaPago
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, CobroFormaPago $cobroFormaPago)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\Danoral\Cobranzas\CobroFormaPago  $cobroFormaPago
     * @return \Illuminate\Http\Response
     */
    public function destroy(CobroFormaPago $cobroFormaPago)
    {
        //
    }

    public function getTypeCFP() {
        $types = DB::table('config.cfp_types')->orderBy('prioridad', 'asc')->get();

        return response()->json($types, 200);
    }

    public function pagoMovil(Request $request) {
        MercantilAPI::c2p_compra($request->all());

        return response()->json("OK", 200);
    }
}
