fix payment points

This commit is contained in:
2026-09-04 23:35:19 +08:00
parent f3fcfe45da
commit 9dc278bd83
6 changed files with 44 additions and 19 deletions
+4 -2
View File
@@ -39,8 +39,10 @@ final class CommissionLedger {
]);
return $result >= 0;
}
public function record_paid_order(array $order): int {
if (!\AKSRT\Settings\Settings::affiliate_enabled()) return 0;
public function record_paid_order(array $order): int {
$currency = sanitize_key((string) ($order['currency'] ?? ''));
if ($currency === \AKSRT\Ledger\AssetType::POINTS->value) return 0;
if (!\AKSRT\Settings\Settings::affiliate_enabled()) return 0;
$type = sanitize_key((string) ($order['product_type'] ?? ''));
$map = ['vip' => 'membership', 'resource' => 'content'];
$order_type = $map[$type] ?? $type;