BrightmarketAdapter
Protocol methods and expected row shapes for client adapters.
Your client adapter must implement every method in BrightmarketAdapter.
Return raw rows (list of dict or objects); mapping to API payloads happens in src/sync/.
get_clients_created
Return rows for new clients (e.g. filtered by creation date). Each row: IdCliente, Nombre, RUC, FechaNacimiento, Sexo, IdDepartamento, (Pais, Ciudad, Celular, Email). Used to call create_client (map to client_id, birthdate, sex, state_id, country_id, fidelity).
get_clients_modified
Return rows for modified clients (e.g. filtered by modification date). Same shape as get_clients_created. Used to call update_client.
get_payment_methods
Return distinct payment method rows. Each row: IdValor, NombreMetodo, (BIN, SelloTarjeta). Used to call create_payment_method with externalId=IdValor, name=NombreMetodo.
get_points_movements
Return rows for client point movements. Each row: IdCliente, TipoMovimiento, Puntos, FechaVencimiento, Comentarios. Caller maps rows to create_points_movement(client_external_id, movement_type, points_moved, expiration_date, comments).
get_promotions
Return list of promotion_data dicts for PromotionsWriter.create_promotion. Each dict: "promotion" (externalId, name, description, startDate, endDate, branchOfficeExternalIds, acceptedPaymentMethodExternalIds, etc.), "regularPromotionType", "skuExternalIds", "discountValue", "discountPercent", "giftExternalId".
get_rewards
Return rows for rewards. Each row: (IdCliente, Segmento, Mensaje, Incentivo, FechaVencimiento). Caller groups by Segmento into dicts with clientes, mensaje, incentivo, expiration, then uses build_reward_line_payload and create_rewards (JSONL write + upload).
get_skus
Return rows for articles/SKUs. Each row can be a dict or object with at least:
- CodigoArticulo (article id), CodigoInterno (SKU id), Descripcion, Marca, Genero, Categoria, Clase, Color, Talle, Precio, Costo, FechaAlta. Used to build article_data and sku_data for create_article/create_sku.
get_tickets
Return rows for tickets (one row per line). Each row: IdTicket, Fecha, IdCliente, IdSucursal, IdPuntoVenta, Total, Subtotal, IVA, SKU, Cantidad, Precio, PromocionAplicada, FechaAuditoria. Caller groups by IdTicket and builds ticket_data for create_ticket.