Skip to content

Add iran-pay 0.1.0 + parsitext 0.1.1 (tantivy, IBAN gen)#6

Merged
r21gh merged 2 commits into
mainfrom
feat/add-ir-payment
May 5, 2026
Merged

Add iran-pay 0.1.0 + parsitext 0.1.1 (tantivy, IBAN gen)#6
r21gh merged 2 commits into
mainfrom
feat/add-ir-payment

Conversation

@r21gh
Copy link
Copy Markdown
Contributor

@r21gh r21gh commented May 5, 2026

iran-pay (new):
Unified async SDK for six Iranian payment gateways behind one
strongly-typed Gateway trait — ZarinPal, IDPay, NextPay, Pay.ir, Zibal,
Vandar. Each driver targets a specific upstream API version; URLs and
field names are sourced from the providers' published documentation
(verified May 2026 — see VERSIONING.md for the upgrade policy).

Highlights:
* Trait-level API, dyn-safe, runtime-pluggable across providers.
* Toman/Rial Amount type that prevents the unit-mixup bug that ships to production at every Iranian e-commerce merchant.
* Sandbox per provider; .with_api_base() to redirect at wiremock for tests; .with_client() for custom timeouts/proxies.
* MockGateway (no I/O) + scriptable Behavior for unit-testing your own checkout code.
* security:: helpers — constant_time_eq, verify_hmac_sha256 (pure safe-Rust SHA-256 + HMAC implementation, RFC test-vector-checked), check_amount, check_authority_format.
* validators feature re-exports parsitext::validators (national_id, sheba, bank_card with bank lookup, phone with operator detection, landline with province detection, postal_code, car_plate).
* tracing::instrument on every API call.
* Per-feature Cargo gates so binaries can ship only the providers they actually use.
* 53 tests (lib + integration + security), criterion benches, full doc coverage, four runnable examples.
* Per-crate CI workflow with seven feature-combo build matrices plus cargo package.

parsitext 0.1.1:

  • NEW: validators::sheba::generate(bank_code, account_type, account) — generates a fully-checksummed Iranian IBAN (matches the iranianbank crate's Iban::new feature; we previously only validated, not generated).
  • NEW: tantivy feature with PersianTokenizer + per-token stem filter
    • optional pre-normalization, ZWNJ-aware so compound words like "می‌روم" stay intact in the search index.

jalali-calendar 0.1.1:

  • Re-publish at the new workspace version; no functional changes.
  • Audited against persian-rs (crates.io); we already strictly exceed its surface (date conversion + 2 validators).

Workspace:

  • Workspace package version bumped to 0.1.1.
  • iran-pay overrides version to 0.1.0 (initial release).
  • iran-pay depends on parsitext = "0.1.1" so its CI cargo-package step needs parsitext 0.1.1 published first.

iran-pay (new):
  Unified async SDK for six Iranian payment gateways behind one
  strongly-typed Gateway trait — ZarinPal, IDPay, NextPay, Pay.ir, Zibal,
  Vandar.  Each driver targets a specific upstream API version; URLs and
  field names are sourced from the providers' published documentation
  (verified May 2026 — see VERSIONING.md for the upgrade policy).

  Highlights:
    * Trait-level API, dyn-safe, runtime-pluggable across providers.
    * Toman/Rial Amount type that prevents the unit-mixup bug that ships
      to production at every Iranian e-commerce merchant.
    * Sandbox per provider; .with_api_base() to redirect at wiremock for
      tests; .with_client() for custom timeouts/proxies.
    * MockGateway (no I/O) + scriptable Behavior for unit-testing your
      own checkout code.
    * security:: helpers — constant_time_eq, verify_hmac_sha256 (pure
      safe-Rust SHA-256 + HMAC implementation, RFC test-vector-checked),
      check_amount, check_authority_format.
    * validators feature re-exports parsitext::validators (national_id,
      sheba, bank_card with bank lookup, phone with operator detection,
      landline with province detection, postal_code, car_plate).
    * tracing::instrument on every API call.
    * Per-feature Cargo gates so binaries can ship only the providers
      they actually use.
    * 53 tests (lib + integration + security), criterion benches, full
      doc coverage, four runnable examples.
    * Per-crate CI workflow with seven feature-combo build matrices plus
      cargo package.

parsitext 0.1.1:
  * NEW: validators::sheba::generate(bank_code, account_type, account)
    — generates a fully-checksummed Iranian IBAN (matches the
    iranianbank crate's Iban::new feature; we previously only
    validated, not generated).
  * NEW: tantivy feature with PersianTokenizer + per-token stem filter
    + optional pre-normalization, ZWNJ-aware so compound words like
    "می‌روم" stay intact in the search index.

jalali-calendar 0.1.1:
  * Re-publish at the new workspace version; no functional changes.
  * Audited against persian-rs (crates.io); we already strictly exceed
    its surface (date conversion + 2 validators).

Workspace:
  * Workspace package version bumped to 0.1.1.
  * iran-pay overrides version to 0.1.0 (initial release).
  * iran-pay depends on parsitext = "0.1.1" so its CI cargo-package
    step needs parsitext 0.1.1 published first.
@r21gh r21gh force-pushed the feat/add-ir-payment branch 4 times, most recently from 1b52099 to cd58ff3 Compare May 5, 2026 14:33
@r21gh r21gh force-pushed the feat/add-ir-payment branch from cd58ff3 to f1f3a34 Compare May 5, 2026 14:36
@r21gh r21gh merged commit 2e67b8f into main May 5, 2026
14 of 15 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

r21gh added a commit that referenced this pull request May 5, 2026
Two fixes for the failing run on PR #6:

1. Rust 1.95's clippy added `clippy::manual_is_multiple_of` (`% N == 0`).
   The workspace MSRV is now 1.88 which has the method on unsigned types,
   so switch the four affected sites to `.is_multiple_of(N)`:
     - parsitext: bank_card Luhn checksum, ISBN-10 mod-11, ISBN-13 mod-10
       (also flipped the ISBN `sum` from i32 to u32 since the method is
        not available on signed integers).
     - iran-pay: amount thousand-separator stride, hex-string parity check.

2. iran-pay's `cargo package` step in CI failed because the path-dep on
   parsitext required "^0.1.1", but only 0.1.0 is on crates.io.  iran-pay
   only uses APIs that exist in 0.1.0, so loosen the requirement to
   "0.1" — the path build still resolves locally to 0.1.1, and the
   published-package verify resolves it to whatever 0.1.x is on crates.io.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant