Skip to main content

Prices

Overview

This document provides information about Prices.

Other Gen Rosso snippets:


This script will create a set of SQL queries that will then be run manually:

$currencies = [
"ARS" => 100,
"CLP" => 7.89, // CLP is non decimal, with this we make the conversion and remove the 2 decimal places
"UYU" => 43.7,
"PYG" => 6910,
"COP" => 3619,
"PEN" => 3.5,
"BOB" => 6.90,
"BRL" => 5.37,
"MXN" => 22.37,
];

$plansPrices = [
2089 => 500,
2090 => 1000,
2091 => 1500,
2092 => 2000,
2093 => 2500,
2094 => 5000,
2095 => 10000,
2096 => 15000,
2097 => 20000,
2098 => 25000,
];

collect($currencies)
->each(function ($currencyRate, $currencyId) use($plansPrices) {
echo "\n\n\n-- $currencyId\n";
echo 'INSERT INTO `prices` (`tenant_id`, `priceable_type`, `priceable_id`, `type`, `country_code`, `currency_id`, `amount_in_cents`, `created_at`, `updated_at`) VALUES';
collect($plansPrices)
->each(function ($price, $plan) use($currencyId, $currencyRate) {
$priceInCurrency = $price*$currencyRate;
echo "\n('249', 'plan', '$plan', 'prepaid', NULL, '$currencyId', $priceInCurrency, NOW(), NOW()),";
});
echo "\n\r";
});
-- Gen Rosso
-- Force logout all users
UPDATE
`farfalla`.`users`
SET
`force_logout` = '1'
WHERE
`tenant_id` = '249'
AND created_at > '2020-11-29';

-- Inscritos antes del 29/11/2020 que se han vuelto a conectar
SELECT
email,
updated_at
FROM
users
WHERE
tenant_id = 249
AND force_logout = 0
AND created_at > '2020-11-29'
ORDER BY
updated_at;

X

Graph View