Skip to content

HassiyYT/tenge-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tenge-converter

CLI app in pure safe Rust that converts a requested Steam Kazakhstan balance amount (KZT) into the RUB amount you need to pay a ggsel seller via SBP.

The app reads the current ggsel course from:

  • product page (default): https://ggsel.net/catalog/product/avtopopolnenie-steam-kazaxstan-tenge-kzt-4841114
  • fallback main page: https://ggsel.net/

Features

  • Pure Rust codebase (#![forbid(unsafe_code)])
  • Zero Rust dependencies (std only)
  • Runtime logging (--verbose)
  • Structured error messages
  • Automatic fallback from product page to main page when parser fails
  • Offline mode for deterministic tests via --html-file

Prerequisites

  • Rust toolchain (cargo, rustc)
  • curl in PATH (used to fetch HTTPS ggsel pages)

Build

cargo build --release

Usage

# Live fetch from ggsel product page (with fallback to main page)
cargo run -- 1000

# Verbose logs
cargo run -- --verbose 1500

# Custom URLs
cargo run -- --url "https://ggsel.net/catalog/product/avtopopolnenie-steam-kazaxstan-tenge-kzt-4841114" --main-url "https://ggsel.net/" 2000

# Offline/fixture mode (no network)
cargo run -- --html-file tests/fixtures/product_page_sample.html 1000

Example output:

KZT requested: 1000.00
Detected rate: 1 KZT = 0.187000 RUB
RUB to pay via SBP: 187.00

CLI Options

--url <URL>           Primary ggsel URL
--main-url <URL>      Fallback ggsel URL
--timeout <SECONDS>   curl timeout in seconds
--html-file <PATH>    Read HTML from local file instead of network
--no-fallback         Do not fetch fallback URL if parser fails
-v, --verbose         Enable debug logs
-h, --help            Show help

Testing

cargo test

Tests include:

  • unit tests for argument parsing
  • unit tests for course extraction/parsing
  • unit tests for conversion/rounding
  • integration CLI tests with fixture HTML

Notes

  • The converter rounds up to the nearest kopeck (0.01 RUB) to avoid underpaying.
  • ggsel markup can change; if parsing fails, update the parser heuristics in src/parse.rs.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages