# Part of Odoo. See LICENSE file for full copyright and licensing details.

# Clover Ecommerce API (charges, refunds, tokenization)
ECOM_BASE_URL = 'https://scl.clover.com'
ECOM_BASE_URL_TEST = 'https://scl-sandbox.dev.clover.com'

# Clover Platform API (merchants, orders, etc.)
API_BASE_URL = 'https://api.clover.com'
API_BASE_URL_TEST = 'https://apisandbox.dev.clover.com'

# Clover Tokenization Service
TOKEN_BASE_URL = 'https://token.clover.com'
TOKEN_BASE_URL_TEST = 'https://token-sandbox.dev.clover.com'

# Clover Card Present / REST Pay Display API (Cloud connection)
# Used for sending payment requests to Clover terminals via cloud.
CONNECT_BASE_URL = 'https://api.clover.com/connect/v1'
CONNECT_BASE_URL_TEST = 'https://apisandbox.dev.clover.com/connect/v1'

# OAuth URLs
OAUTH_AUTHORIZE_URL_TEST = 'https://apisandbox.dev.clover.com/oauth/authorize'
OAUTH_AUTHORIZE_URL = 'https://api.clover.com/oauth/authorize'
OAUTH_TOKEN_URL_TEST = 'https://apisandbox.dev.clover.com/oauth/token'
OAUTH_TOKEN_URL = 'https://api.clover.com/oauth/token'

DEFAULT_PAYMENT_METHOD_CODES = {
    'card',
    'visa',
    'mastercard',
    'amex',
    'discover',
}

# Mapping of Clover charge statuses to Odoo payment transaction states.
STATUS_MAPPING = {
    'authorized': ('pending',),
    'done': ('succeeded', 'paid', 'captured'),
    'cancel': ('canceled', 'voided'),
    'error': ('failed',),
    'refund': ('refunded',),
}

# Card brand mapping from Clover scheme to Odoo payment method codes
CARD_BRAND_MAPPING = {
    'VISA': 'visa',
    'MC': 'mastercard',
    'MASTERCARD': 'mastercard',
    'AMEX': 'amex',
    'AMERICAN_EXPRESS': 'amex',
    'DISCOVER': 'discover',
    'DINERS_CLUB': 'diners_club',
    'JCB': 'jcb',
}

# Clover amounts are in cents (minor currency units)
CURRENCY_DECIMALS = {
    'JPY': 0,
    'KRW': 0,
}

# Clover Platform API v3 — transaction statuses that indicate a void
VOIDED_STATUSES = {'VOIDED', 'VOID'}

# Referenced refund age limit (days).  Clover does NOT impose a hard limit,
# but card networks generally restrict refund-to-original-card beyond ~180 days.
REFERENCED_REFUND_LIMIT_DAYS = 180

# Handled webhook event types
HANDLED_WEBHOOK_EVENTS = {
    'charge.succeeded',
    'charge.failed',
    'charge.captured',
    'charge.voided',
    'refund.created',
    'refund.succeeded',
    'refund.failed',
    'payment.created',
}

# Sensitive keys that should be masked in logs
SENSITIVE_KEYS = {
    'clover_api_key',
    'clover_secret',
    'access_token',
}
