Skip to content

Hỗ trợ thesieure.com - #77

Merged
amadeusmz merged 3 commits into
masterfrom
thesieure
Jun 21, 2026
Merged

Hỗ trợ thesieure.com#77
amadeusmz merged 3 commits into
masterfrom
thesieure

Conversation

@minhh2792

@minhh2792 minhh2792 commented May 27, 2026

Copy link
Copy Markdown
Member

Hỗ trợ thesieure.com, và xóa bỏ tàn dư của thesieutoc

Summary by CodeRabbit

Release Notes

  • New Features

    • Updated card charging service to use a new provider with enhanced functionality.
  • Tests

    • Added comprehensive test coverage for the new card service provider.
  • Chores

    • Updated supported provider configuration and credentials.

@minhh2792 minhh2792 self-assigned this May 27, 2026
Copilot AI review requested due to automatic review settings May 27, 2026 14:34
@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR replaces the TheSieuToc card provider with TheSieuRe. The new provider uses partner credentials for authentication, implements charging and waiting-card status checking via distinct request types, parses JSON responses with status-based success logic, and logs transaction IDs while maintaining player notifications. Factory wiring, configuration files, and test coverage are updated accordingly.

Changes

TheSieuRe Provider Migration

Layer / File(s) Summary
TheSieuReCP provider implementation
dotman-plugin/src/main/java/net/minevn/dotman/providers/types/TheSieuReCP.kt
New TheSieuReCP class extends CardProvider with constructor-injected partnerId and partnerKey. Builds charging requests with MD5-signed parameters (partnerKey + pin + seri), random request_id, and telco mapping. Parses JSON responses, logs request_id to LogDAO, and notifies players. Implements waiting-card checking with status-to-message mapping for Vietnamese error codes.
CardProvider factory and Card2KCP cleanup
dotman-plugin/src/main/java/net/minevn/dotman/providers/CardProvider.kt, dotman-plugin/src/main/java/net/minevn/dotman/providers/types/Card2KCP.kt
CardProvider.init() removes "thesieutoc" dispatch branch and adds "thesieure" branch constructing TheSieuReCP from partner-id/partner-key config. Removes unused CardPrice.getPriceId() extension from Card2KCP.
Provider configuration and documentation
dotman-plugin/src/main/resources/config.yml, dotman-plugin/src/main/resources/providers/thesieure.yml
Adds thesieure.yml with partner-id and partner-key fields. Updates config.yml comment to list supported APIs (card2k, thesieure, gamebank).
Provider test coverage
dotman-plugin/src/test/java/net/minevn/dotman/test/providers/TheSieuReCPTest.kt
New test class with Mockito mocks for TheSieuReCP, DotMan, and MainConfig. Reads partner credentials from environment variables with fallback defaults. Asserts getApiUrl() and doRequest() return non-null results.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • minevn/dotman#63: Modifies Card2KCP.kt and touches the same charging request/response handling logic that is refactored here in the provider abstraction layer.

Suggested labels

feat

Poem

🐰 A rabbit hops through provider chains,
Old paths fade as new ones spring!
TheSieuRe now handles all the reins,
With signatures and statuses to bring.
The factory wires, configs align—
One provider out, one freshly designed! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Hỗ trợ thesieure.com' directly and clearly summarizes the main objective of the pull request: adding support for the thesieure.com card provider.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch thesieure

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces the existing thesieutoc.net card provider integration with a new thesieure.com integration. The new TheSieuReCP follows the same pattern as Card2KCP (partner-id/partner-key with MD5 signing) and uses the waiting-card flow for delayed settlement.

Changes:

  • Removes TheSieuTocCP provider, its YAML config, and its test; adds TheSieuReCP, providers/thesieure.yml, and TheSieuReCPTest.
  • Registers the thesieure key in CardProvider.init and updates the supported-provider comment in config.yml.
  • Implements parseResponse / isProcessed against the thesieure.com v2 charging API (statuses 1/99 accepted, status code mapping for check responses).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
dotman-plugin/src/main/java/net/minevn/dotman/providers/types/TheSieuReCP.kt New provider implementation for thesieure.com.
dotman-plugin/src/main/java/net/minevn/dotman/providers/CardProvider.kt Swaps the thesieutoc registration branch for thesieure.
dotman-plugin/src/main/resources/providers/thesieure.yml New provider config with partner-id/partner-key placeholders.
dotman-plugin/src/main/resources/providers/thesieutoc.yml Removed old provider config.
dotman-plugin/src/main/resources/config.yml Updates supported-provider comment list.
dotman-plugin/src/test/java/net/minevn/dotman/test/providers/TheSieuReCPTest.kt New mock-based test covering API URL and a sample doRequest call.
dotman-plugin/src/test/java/net/minevn/dotman/test/providers/TheSieuTocCPTest.kt Removed test for the deleted provider.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dotman-plugin/src/main/java/net/minevn/dotman/providers/types/TheSieuReCP.kt Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread dotman-plugin/src/main/resources/config.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@dotman-plugin/src/main/java/net/minevn/dotman/providers/types/TheSieuReCP.kt`:
- Around line 35-37: The parseResponse method currently prints raw provider
responses to stdout via println(response); remove that call from the CardResult
creation in parseResponse (method parseResponse in TheSieuReCP) to avoid leaking
sensitive data and noisy logs, and if you need to keep the response for
debugging use the existing logger at debug/trace level or sanitize the payload
before logging instead of printing to stdout.
- Around line 79-93: Wrap the network/JSON chain starting at get(getApiUrl(),
parameters = params).parseJson() in a try-catch so parse/network exceptions
don't short-circuit the waiting-card cycle: in the catch set isSuccess = false,
set message to a clear error (e.g. include e.message or a generic "network/parse
error"), and return true (or the value that keeps the card in waiting) so the
polling continues; implement this around the existing let block that reads
status/sets message and uses status != 99 to decide completion.

In
`@dotman-plugin/src/test/java/net/minevn/dotman/test/providers/TheSieuReCPTest.kt`:
- Around line 42-50: The testCard currently performs a live HTTP request and
only assertsNotNull; make it deterministic by stubbing the HTTP boundary used by
the provider (the mockedTheSieuReCP instance or its internal HTTP client) to
return a fixed JSON fixture, then call mockedTheSieuReCP.doRequest("testplayer",
Card("69420","67", CardPrice.CP_50K, CardType.VIETTEL)) and assert the parsed
response fields (isSuccess/boolean, message/String, transactionId/String) match
the fixture values; keep existing setup calls
(setInstance(MainConfig::class.java, mockedConfig), doReturn("testserver")...
and mockedTheSieuReCP.setInternal("main", mockedMain)) but replace real network
I/O with a mock/stub on the HTTP client used by TheSieuReCP so the test becomes
fast and deterministic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a0246605-4070-44f0-beba-2ad88c59dead

📥 Commits

Reviewing files that changed from the base of the PR and between 6379abf and e5ae958.

📒 Files selected for processing (9)
  • dotman-plugin/src/main/java/net/minevn/dotman/providers/CardProvider.kt
  • dotman-plugin/src/main/java/net/minevn/dotman/providers/types/Card2KCP.kt
  • dotman-plugin/src/main/java/net/minevn/dotman/providers/types/TheSieuReCP.kt
  • dotman-plugin/src/main/java/net/minevn/dotman/providers/types/TheSieuTocCP.kt
  • dotman-plugin/src/main/resources/config.yml
  • dotman-plugin/src/main/resources/providers/thesieure.yml
  • dotman-plugin/src/main/resources/providers/thesieutoc.yml
  • dotman-plugin/src/test/java/net/minevn/dotman/test/providers/TheSieuReCPTest.kt
  • dotman-plugin/src/test/java/net/minevn/dotman/test/providers/TheSieuTocCPTest.kt
💤 Files with no reviewable changes (4)
  • dotman-plugin/src/main/resources/providers/thesieutoc.yml
  • dotman-plugin/src/test/java/net/minevn/dotman/test/providers/TheSieuTocCPTest.kt
  • dotman-plugin/src/main/java/net/minevn/dotman/providers/types/Card2KCP.kt
  • dotman-plugin/src/main/java/net/minevn/dotman/providers/types/TheSieuTocCP.kt

@minhh2792

minhh2792 commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

Test nạp thẻ

image
[20:19:33 INFO]: CursedKiwi issued server command: /napthe
[20:19:46 INFO]: [DotMan] Ghi log thành công: UUID: 53f919cc-776f-3464-bfe2-33f9d3315948, ID: 2
[20:19:47 INFO]: {"trans_id":23839645,"request_id":"QCUFQJRNZE5","amount":8500,"value":null,"declared_value":10000,"telco":"VINAPHONE","serial":"59000035572685","code":"69459823179805","status":99,"message":"PENDING"}
[20:19:57 INFO]: DotMan > Người chơi CursedKiwi đã nạp thẻ mệnh giá 10000 VNĐ và nhận được 10 xu
[20:19:57 INFO]: [Essentials] CONSOLE issued server command: /tell CursedKiwi Bạn vừa nạp 10k
[20:19:57 INFO]: [me -> CursedKiwi] Bạn vừa nạp 10k

@minhh2792
minhh2792 requested a review from amadeusmz June 8, 2026 13:33
@amadeusmz
amadeusmz merged commit 47ac00c into master Jun 21, 2026
2 checks passed
@amadeusmz
amadeusmz deleted the thesieure branch June 21, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants