Currency
Currencies around the world
Table name: currencies
Description: To deal with money (pricing, payment,...)
Model
use SaasReady\Models\Currency;
findByCode
Quickly retrieve the Currency
instance by using CurrencyCode
use SaasReady\Constants\CurrencyCode;
Currency::findByCode(CurrencyCode::UNITED_STATES_DOLLAR);
Currency::findByCode(CurrencyCode::tryFrom('VND'));
The CurrencyCode Enum
Contains every CurrencyCode around the world.
use SaasReady\Constants\CurrencyCode;
Response Entity
type Currency = {
uuid: string;
code: string;
name: string;
symbol: string;
decimal_separator: string;
thousands_separator: string;
space_after_symbol: boolean;
is_active: boolean; // v1.0.1
created_at: string;
updated_at: string;
activated_at: string; // v1.0.1
}
Endpoints
[GET] saas/currencies
Get a list of Currencies
Request payload:
{
limit: int; // optional, if this limit is null or not exists, will return ALL
page: int;
}
Response payload:
{
data: Currency[],
}
[GET] saas/currencies/{currencyUuid}
Get single Currency
Response payload:
{
data: Currency,
}
[POST] saas/currencies
Create a new Currency
Request payload:
{
code: string;
name: string;
symbol: string;
decimal_separator: string;
thousands_separator: string;
space_after_symbol: boolean;
is_active: boolean; // v1.0.1+
}
Response payload:
{
uuid: string,
}
[PUT] saas/currencies/{currencyUuid}
Update an existing Currency
Request payload:
{
code: string;
name: string;
symbol: string;
decimal_separator: string;
thousands_separator: string;
space_after_symbol: boolean;
is_active: boolean; // v1.0.1+
}
Response payload:
{
uuid: string,
}
[DELETE] saas/currencies/{currencyUuid}
Delete an existing Currency (soft)
Response payload:
{}
Helper Commands
Activate a Currency (v1.0.1+)
php artisan saas-ready:activate-entity currency {currencyCode}
php artisan saas-ready:activate-entity currency USD
Deactivate a Currency (v1.0.1+)
php artisan saas-ready:deactivate-entity currency {currencyCode}
php artisan saas-ready:deactivate-entity currency VND
Last updated