CompanyEvent


Modelo CompanyEvent

{
    "id": 1,
    "name": "Navidad",
    "type": "coupon_gen",
    "status": "finished",
    "starts_at": "2020-12-17 20:10:53",
    "ends_at": null,
    "config": {
        "coupon_seeds": [
            {
                "win_rate": 50,
                "max_count": 12,
                "coupon_value_e2": 5,
                "coupon_min_purchase_e2": 0
            },
            {
                "win_rate": 10,
                "max_count": 5,
                "coupon_value_e2": 10,
                "coupon_min_purchase_e2": 0
            },
            {
                "win_rate": 5,
                "max_count": 2,
                "coupon_value_e2": 20,
                "coupon_min_purchase_e2": 0
            },
            {
                "win_rate": 1,
                "max_count": 1,
                "coupon_value_e2": 100,
                "coupon_min_purchase_e2": 0
            }
        ],
        "random_length": 100,
        "winner_message": "Felicidades! Has ganado <b></b>. Usa el código <b></b>",
        "expires_at": null,
        "loser_message": "Keep trying",
        "already_won_message": "Already won.  "
    },
    "created_at": "2020-12-17 20:09:59",
    "updated_at": "2020-12-19 15:30:57",
    "deleted_at": null
}
Atributo Tipo Descripción
id int -
name string -
type string -
status string -
starts_at datetime\|null -
config array -
created_at datetime\|null -
updated_at datetime\|null -

Insertar CompanyEvent

Método URI Cabeceras
POST /companies/{companyId}/company-events Authorization
{
    "name": "required|string|max:64",
    "type": "required|string|in:coupon_gen",
    "starts_at": "date|after:now",
    "ends_at": "date|after:starts_at|after:now",
    "timezone": {
        "string": true,
        "regex": "/^[\+\-]([0-1][0-9]|2[0-3]):[0-5][0-9]$/"
    },
    "config": {
        "coupon_seeds": [
            {
                "max_count": "required|integer|min:1",
                "coupon_value_e2": "integer|min:0",
                "coupon_value_prc": "numeric|between:0.0000,1.0000",
                "coupon_min_purchase_e2": "integer|min:0",
                "win_rate": "required|integer|min:1",
                "coupon_applies_to": "string|in:total,subtotal,base_price,service,delivery",
                "winner_message": "string|max:80",
                "already_won_message": "string|max:80",
                "available_since": "date",
                "available_until": "date"
            }
        ],
        "expires_at": "date|after:now",
        "random_length": "integer|min:1",
        "winner_message": "string|max:80",
        "already_won_message": "string|max:80",
        "loser_message": "string|max:80"
    }
}

Listar CompanyEvent

{info} Soporta: Paginación Filters Carga dinámica

Método URI Cabeceras
GET /companies/{companyId}/company-events Authorization

Mostrar CompanyEvent

{info} Soporta: Carga dinámica

Método URI Cabeceras
GET /companies/{companyId}/company-events/{companyEventId} Authorization

Actualizar CompanyEvent

Método URI Cabeceras
PATCH /companies/{companyId}/company-events/{companyEventId} Authorization
{
    "name": "string|max:64",
    "type": "string|in:coupon_gen",
    "starts_at": "date|after:now",
    "ends_at": "date|after:starts_at|after:now",
    "timezone": {
        "string": true,
        "regex": "/^[\+\-]([0-1][0-9]|2[0-3]):[0-5][0-9]$/"
    },
    "config": {
        "coupon_seeds": [
            {
                "max_count": "required|integer|min:1",
                "coupon_value_e2": "integer|min:0",
                "coupon_value_prc": "numeric|between:0.0000,1.0000",
                "coupon_min_purchase_e2": "integer|min:0",
                "win_rate": "required|integer|min:1",
                "coupon_applies_to": "string|in:total,subtotal,base_price,service,delivery",
                "winner_message": "string|max:80",
                "already_won_message": "string|max:80",
                "available_since": "date",
                "available_until": "date"
            }
        ],
        "expires_at": "date|after:now",
        "random_length": "integer|min:1",
        "winner_message": "string|max:80",
        "already_won_message": "string|max:80",
        "loser_message": "string|max:80"
    }
}

Acciones de CompanyEvent

Set Ready

Método URI Cabeceras
POST /companies/{companyId}/company-events/{companyEventId}/set-ready Authorization
{
    "starts_at": "date|after:now",
    "ends_at": "date|after:starts_at|after:now",
    "timezone": {
        "string": true,
        "regex": "/^[\+\-]([0-1][0-9]|2[0-3]):[0-5][0-9]$/"
    }
}

Set Finished

Método URI Cabeceras
POST /companies/{companyId}/company-events/{companyEventId}/set-finished Authorization

Shake

Método URI Cabeceras
GET /companies/{companyId}/events/shake Authorization

Enlaces de CompanyEvent