# 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 v2 URLs (Clover mandated v2 from October 2023; legacy /oauth/authorize # is deprecated). Note that the AUTHORIZE endpoint is on the merchant/dev # portal host (sandbox.dev.clover.com / www.clover.com) — NOT on the API # host — because it has to render a merchant-facing login + consent UI. # The TOKEN/REFRESH endpoints are on the API host. # https://docs.clover.com/docs/use-oauth#sandbox-and-production-environment-urls OAUTH_AUTHORIZE_URL_TEST = 'https://sandbox.dev.clover.com/oauth/v2/authorize' OAUTH_AUTHORIZE_URL = 'https://www.clover.com/oauth/v2/authorize' OAUTH_TOKEN_URL_TEST = 'https://apisandbox.dev.clover.com/oauth/v2/token' OAUTH_TOKEN_URL = 'https://api.clover.com/oauth/v2/token' OAUTH_REFRESH_URL_TEST = 'https://apisandbox.dev.clover.com/oauth/v2/refresh' OAUTH_REFRESH_URL = 'https://api.clover.com/oauth/v2/refresh' 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', }