|
@@ -0,0 +1,283 @@
|
|
|
|
|
+# ShopRenter API Resources Documentation
|
|
|
|
|
+
|
|
|
|
|
+## Overview
|
|
|
|
|
+
|
|
|
|
|
+This document covers the ShopRenter Developer API resources with focus on authentication and extended resources for orders, customers, and products.
|
|
|
|
|
+
|
|
|
|
|
+## Authentication
|
|
|
|
|
+
|
|
|
|
|
+The ShopRenter API uses OAuth 2.0 authentication. Based on the existing implementation in this project:
|
|
|
|
|
+
|
|
|
|
|
+### OAuth 2.0 Flow
|
|
|
|
|
+1. **Authorization Request** - Direct user to ShopRenter authorization page
|
|
|
|
|
+2. **Authorization Grant** - User approves application access
|
|
|
|
|
+3. **Token Exchange** - Exchange authorization code for access token
|
|
|
|
|
+4. **Token Refresh** - Refresh expired access tokens using refresh token
|
|
|
|
|
+
|
|
|
|
|
+### Token Management
|
|
|
|
|
+- **Access Token**: Used for API authentication (stored in `stores.api_key`)
|
|
|
|
|
+- **Refresh Token**: Used to obtain new access tokens (stored in `stores.api_secret`)
|
|
|
|
|
+- **Token Expiration**: Monitored via `stores.token_expires_at`
|
|
|
|
|
+- **Automatic Refresh**: Implemented in `_shared/shoprenter-client.ts`
|
|
|
|
|
+
|
|
|
|
|
+### API Endpoints
|
|
|
|
|
+- **Base URL**: `https://{shopname}.api.shoprenter.hu`
|
|
|
|
|
+- **API Version**: Uses ShopRenter REST API
|
|
|
|
|
+- **Authentication Header**: `Authorization: Bearer {access_token}`
|
|
|
|
|
+
|
|
|
|
|
+## Order Extend Resource
|
|
|
|
|
+
|
|
|
|
|
+The Order Extend Resource provides extended order management capabilities with support for shipping and payment method details.
|
|
|
|
|
+
|
|
|
|
|
+### Purpose
|
|
|
|
|
+Extends standard order data with additional delivery and payment information specific to Hungarian and European logistics providers.
|
|
|
|
|
+
|
|
|
|
|
+### Key Properties
|
|
|
|
|
+
|
|
|
|
|
+#### Shipping Method Extension (`shippingMethodExtension`)
|
|
|
|
|
+Identifies the delivery service provider. Supported values include:
|
|
|
|
|
+
|
|
|
|
|
+**Parcel Services:**
|
|
|
|
|
+- `dhl_express` - DHL Express delivery
|
|
|
|
|
+- `dpd` - DPD parcel service
|
|
|
|
|
+- `gls_parcel_shop` - GLS parcel shop pickup
|
|
|
|
|
+- `gls_parcel_locker` - GLS automated locker
|
|
|
|
|
+- `gls_shipping_point` - GLS shipping point
|
|
|
|
|
+- `mpl` - Magyar Posta (Hungarian Post)
|
|
|
|
|
+- `foxpost` - FoxPost automated parcel machines
|
|
|
|
|
+
|
|
|
|
|
+**Specialized Delivery:**
|
|
|
|
|
+- `sameday` - Sameday courier service
|
|
|
|
|
+- `wolt` - Wolt courier service
|
|
|
|
|
+- `wseship_home_delivery` - WSEship home delivery
|
|
|
|
|
+
|
|
|
|
|
+**Collection Points:**
|
|
|
|
|
+- `easybox` - EasyBox locker system
|
|
|
|
|
+- `pick_pack_point` - Pick Pack Point locations
|
|
|
|
|
+- `receiving_point` - Generic receiving points
|
|
|
|
|
+
|
|
|
|
|
+**ShopRenter Go Solutions:**
|
|
|
|
|
+- `shoprenter_go_gls_home_delivery` - Integrated GLS home delivery
|
|
|
|
|
+- `shoprenter_go_gls_parcel_point` - Integrated GLS parcel point
|
|
|
|
|
+- `shoprenter_go_gls_parcel_locker` - Integrated GLS locker
|
|
|
|
|
+
|
|
|
|
|
+#### Payment Method Code (`paymentMethodCode`)
|
|
|
|
|
+Specifies the payment processor or method used. Supported values include:
|
|
|
|
|
+
|
|
|
|
|
+**Card Payments:**
|
|
|
|
|
+- `payu` - PayU gateway
|
|
|
|
|
+- `otp_simplepay` - OTP SimplePay
|
|
|
|
|
+- `otp_bank_card` - OTP Bank card payment
|
|
|
|
|
+- `cib_bank` - CIB Bank gateway
|
|
|
|
|
+- `barion` - Barion payment system
|
|
|
|
|
+- `kh_bank` - K&H Bank gateway
|
|
|
|
|
+- `stripe` - Stripe payment processor
|
|
|
|
|
+
|
|
|
|
|
+**Alternative Methods:**
|
|
|
|
|
+- `paypal` - PayPal
|
|
|
|
|
+- `bank_transfer` - Direct bank transfer
|
|
|
|
|
+- `cash_on_delivery` - Cash on delivery
|
|
|
|
|
+- `sofort` - Sofort banking
|
|
|
|
|
+
|
|
|
|
|
+**Installment Plans:**
|
|
|
|
|
+- `instacpay` - InstaCPay installments
|
|
|
|
|
+- `pastpay` - PastPay deferred payment
|
|
|
|
|
+- `subscription` - Subscription-based payment
|
|
|
|
|
+
|
|
|
|
|
+**Regional Solutions:**
|
|
|
|
|
+- `paysafecard` - Paysafecard vouchers
|
|
|
|
|
+- `paysafecash` - Paysafecash payment
|
|
|
|
|
+- `mbh_credit` - MBH Bank credit
|
|
|
|
|
+- `otp_szep_card` - OTP SZÉP card (Hungarian benefit card)
|
|
|
|
|
+
|
|
|
|
|
+### API Endpoints
|
|
|
|
|
+
|
|
|
|
|
+Standard REST operations for order extend data:
|
|
|
|
|
+- **GET** `/orderExtends` - List order extends
|
|
|
|
|
+- **GET** `/orderExtends/{id}` - Get specific order extend
|
|
|
|
|
+- **POST** `/orderExtends` - Create order extend
|
|
|
|
|
+- **PUT** `/orderExtends/{id}` - Update order extend
|
|
|
|
|
+- **DELETE** `/orderExtends/{id}` - Delete order extend
|
|
|
|
|
+
|
|
|
|
|
+### Integration Notes
|
|
|
|
|
+- Order Extend sits between Order Credit Card and Order History in the API workflow
|
|
|
|
|
+- Used to capture detailed shipping and payment metadata
|
|
|
|
|
+- Essential for logistics integration and payment reconciliation
|
|
|
|
|
+
|
|
|
|
|
+## Customer Extend Resource
|
|
|
|
|
+
|
|
|
|
|
+The Customer Extend Resource provides additional customer data beyond the standard Customer Resource.
|
|
|
|
|
+
|
|
|
|
|
+### Purpose
|
|
|
|
|
+Extends basic customer information with supplementary fields for enhanced customer relationship management and analytics.
|
|
|
|
|
+
|
|
|
|
|
+### Key Features
|
|
|
|
|
+- Extended customer properties beyond core fields
|
|
|
|
|
+- Additional metadata storage
|
|
|
|
|
+- Integration with Customer Resource and Customer Group Resource
|
|
|
|
|
+
|
|
|
|
|
+### API Endpoints
|
|
|
|
|
+
|
|
|
|
|
+Standard REST operations for customer extend data:
|
|
|
|
|
+- **GET** `/customerExtends` - List customer extends
|
|
|
|
|
+- **GET** `/customerExtends/{id}` - Get specific customer extend
|
|
|
|
|
+- **POST** `/customerExtends` - Create customer extend
|
|
|
|
|
+- **PUT** `/customerExtends/{id}` - Update customer extend
|
|
|
|
|
+- **DELETE** `/customerExtends/{id}` - Delete customer extend
|
|
|
|
|
+
|
|
|
|
|
+### Use Cases
|
|
|
|
|
+- Storing custom customer attributes
|
|
|
|
|
+- Managing extended customer profiles
|
|
|
|
|
+- Supporting custom CRM workflows
|
|
|
|
|
+- Tracking additional customer preferences
|
|
|
|
|
+
|
|
|
|
|
+### Related Resources
|
|
|
|
|
+- **Customer Resource** - Base customer data
|
|
|
|
|
+- **Customer Group Resource** - Customer segmentation
|
|
|
|
|
+- **Order Resource** - Customer purchase history
|
|
|
|
|
+
|
|
|
|
|
+## Product Extend Resource
|
|
|
|
|
+
|
|
|
|
|
+The Product Extend Resource provides extended product management capabilities for advanced catalog operations.
|
|
|
|
|
+
|
|
|
|
|
+### Purpose
|
|
|
|
|
+Extends standard product data with additional attributes, relationships, and metadata for complex product catalogs.
|
|
|
|
|
+
|
|
|
|
|
+### Key Features
|
|
|
|
|
+
|
|
|
|
|
+#### Product Relationships
|
|
|
|
|
+- **Category Linking** - Associate products with multiple categories
|
|
|
|
|
+- **Image Management** - Attach and manage product images
|
|
|
|
|
+- **Attribute Management** - Define custom product attributes
|
|
|
|
|
+- **Batch Operations** - Bulk product updates and imports
|
|
|
|
|
+
|
|
|
|
|
+#### Special Features
|
|
|
|
|
+- **Special Pricing** - Promotional pricing and discounts
|
|
|
|
|
+- **Product of the Day** - Featured product promotions
|
|
|
|
|
+- **External Identifiers** - Map to external system IDs
|
|
|
|
|
+- **Document Relations** - Link products to related documents
|
|
|
|
|
+
|
|
|
|
|
+### API Endpoints
|
|
|
|
|
+
|
|
|
|
|
+Standard REST operations for product extend data:
|
|
|
|
|
+- **GET** `/productExtends` - List product extends
|
|
|
|
|
+- **GET** `/productExtends/{id}` - Get specific product extend
|
|
|
|
|
+- **POST** `/productExtends` - Create product extend
|
|
|
|
|
+- **PUT** `/productExtends` - Update product extend
|
|
|
|
|
+- **DELETE** `/productExtends/{id}` - Delete product extend
|
|
|
|
|
+
|
|
|
|
|
+### Common Operations
|
|
|
|
|
+
|
|
|
|
|
+#### Linking Products with Categories
|
|
|
|
|
+```
|
|
|
|
|
+POST /productExtends
|
|
|
|
|
+{
|
|
|
|
|
+ "productId": "123",
|
|
|
|
|
+ "categoryIds": ["456", "789"]
|
|
|
|
|
+}
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+#### Attaching Images
|
|
|
|
|
+```
|
|
|
|
|
+POST /productExtends/{id}/images
|
|
|
|
|
+{
|
|
|
|
|
+ "imageUrl": "https://...",
|
|
|
|
|
+ "sortOrder": 1
|
|
|
|
|
+}
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+#### Managing Special Pricing
|
|
|
|
|
+```
|
|
|
|
|
+PUT /productExtends/{id}
|
|
|
|
|
+{
|
|
|
|
|
+ "specialPrice": 99.99,
|
|
|
|
|
+ "specialPriceStart": "2024-01-01",
|
|
|
|
|
+ "specialPriceEnd": "2024-01-31"
|
|
|
|
|
+}
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+#### Batch Upload
|
|
|
|
|
+Use batch operations for importing large product catalogs with extended attributes.
|
|
|
|
|
+
|
|
|
|
|
+#### Category Assignment with External IDs
|
|
|
|
|
+Map products to categories using external system identifiers for seamless integration.
|
|
|
|
|
+
|
|
|
|
|
+### Integration Context
|
|
|
|
|
+- Sits between Product Document Relation and Product Image resources
|
|
|
|
|
+- Works with core Product Resource for complete catalog management
|
|
|
|
|
+- Supports complex e-commerce scenarios requiring extended metadata
|
|
|
|
|
+
|
|
|
|
|
+## Synchronization
|
|
|
|
|
+
|
|
|
|
|
+The ShopRenter API supports automated data synchronization:
|
|
|
|
|
+
|
|
|
|
|
+### Manual Sync
|
|
|
|
|
+Triggered via Edge Function: `shoprenter-sync`
|
|
|
|
|
+- Syncs products, orders, and customers
|
|
|
|
|
+- Stores data in cache tables
|
|
|
|
|
+- Updates `last_synced_at` timestamp
|
|
|
|
|
+
|
|
|
|
|
+### Scheduled Sync
|
|
|
|
|
+Automated via `shoprenter-scheduled-sync` Edge Function:
|
|
|
|
|
+- Runs hourly via pg_cron
|
|
|
|
|
+- Configurable per store via `store_sync_config`
|
|
|
|
|
+- Logs execution to `sync_logs` table
|
|
|
|
|
+
|
|
|
|
|
+### Sync Configuration
|
|
|
|
|
+Control sync behavior per store:
|
|
|
|
|
+- Enable/disable sync
|
|
|
|
|
+- Set frequency (15min, 30min, hourly, 6hours, daily)
|
|
|
|
|
+- Choose resources to sync (products, orders, customers)
|
|
|
|
|
+
|
|
|
|
|
+## Data Storage
|
|
|
|
|
+
|
|
|
|
|
+### Cache Tables
|
|
|
|
|
+Synced data is stored in dedicated cache tables:
|
|
|
|
|
+
|
|
|
|
|
+**Products**: `shoprenter_products_cache`
|
|
|
|
|
+- Product ID, name, pricing, inventory
|
|
|
|
|
+- Categories, images, variants
|
|
|
|
|
+- Last sync timestamp
|
|
|
|
|
+
|
|
|
|
|
+**Orders**: `shoprenter_orders_cache` (if exists)
|
|
|
|
|
+- Order details and line items
|
|
|
|
|
+- Shipping and payment information
|
|
|
|
|
+- Customer data
|
|
|
|
|
+
|
|
|
|
|
+**Customers**: `shoprenter_customers_cache` (if exists)
|
|
|
|
|
+- Customer profiles
|
|
|
|
|
+- Contact information
|
|
|
|
|
+- Order history references
|
|
|
|
|
+
|
|
|
|
|
+### Token Management
|
|
|
|
|
+Tokens stored in `shoprenter_tokens` table:
|
|
|
|
|
+- Access token and refresh token
|
|
|
|
|
+- Expiration tracking
|
|
|
|
|
+- Shop domain and scopes
|
|
|
|
|
+- Sync status
|
|
|
|
|
+
|
|
|
|
|
+## Rate Limiting
|
|
|
|
|
+
|
|
|
|
|
+The ShopRenter API client implements:
|
|
|
|
|
+- Rate limiting (5 requests/second)
|
|
|
|
|
+- Retry logic with exponential backoff
|
|
|
|
|
+- Automatic pagination for large datasets
|
|
|
|
|
+
|
|
|
|
|
+## Error Handling
|
|
|
|
|
+
|
|
|
|
|
+The API client provides:
|
|
|
|
|
+- Automatic token refresh on 401 errors
|
|
|
|
|
+- Retry on transient failures
|
|
|
|
|
+- Detailed error logging
|
|
|
|
|
+- Graceful degradation
|
|
|
|
|
+
|
|
|
|
|
+## API Reference Links
|
|
|
|
|
+
|
|
|
|
|
+- **Main API Documentation**: `https://doc.shoprenter.hu/api/`
|
|
|
|
|
+- **Order Extend**: `https://doc.shoprenter.hu/api/order_extend.html`
|
|
|
|
|
+- **Customer Extend**: `https://doc.shoprenter.hu/api/customer_extend.html`
|
|
|
|
|
+- **Product Extend**: `https://doc.shoprenter.hu/api/product_extend.html`
|
|
|
|
|
+
|
|
|
|
|
+---
|
|
|
|
|
+
|
|
|
|
|
+*Note: This documentation covers the key resources used in ShopCall.ai integration. For complete API specifications and additional resources, refer to the official ShopRenter Developer Documentation.*
|