Jelajahi Sumber

fix(billing): use api2 endpoint for ShopRenter billing API

The Bearer token auth requires the api2 URL format:
<shopname>.api2.myshoprenter.hu/api/billing instead of
<shopname>.api.myshoprenter.hu/billing (which was the old Basic Auth endpoint).
This matches the migration guide in the ShopRenter docs.
Fszontagh 2 minggu lalu
induk
melakukan
deaba912cc
1 mengubah file dengan 6 tambahan dan 6 penghapusan
  1. 6 6
      supabase/functions/_shared/shoprenter-billing-client.ts

+ 6 - 6
supabase/functions/_shared/shoprenter-billing-client.ts

@@ -8,7 +8,7 @@
  *    - Auth: Basic Auth (SHOPRENTER_BILLING_USERNAME:SHOPRENTER_BILLING_TOKEN)
  *    - Auth: Basic Auth (SHOPRENTER_BILLING_USERNAME:SHOPRENTER_BILLING_TOKEN)
  *    - Limitations: No one-time charges
  *    - Limitations: No one-time charges
  *
  *
- * 2. SHOP API (<shopname>.api.myshoprenter.hu/billing)
+ * 2. SHOP API (<shopname>.api2.myshoprenter.hu/api/billing)
  *    - Used for: Creating charges on specific shops
  *    - Used for: Creating charges on specific shops
  *    - Auth: Bearer token (same OAuth token used for product/order API)
  *    - Auth: Bearer token (same OAuth token used for product/order API)
  *    - Supports: One-time charges AND recurring charges
  *    - Supports: One-time charges AND recurring charges
@@ -153,7 +153,7 @@ export interface ShopRenterChargeResponse {
 }
 }
 
 
 // =============================================================================
 // =============================================================================
-// SHOP API TYPES (for <shopname>.api.myshoprenter.hu/billing)
+// SHOP API TYPES (for <shopname>.api2.myshoprenter.hu/api/billing)
 // =============================================================================
 // =============================================================================
 
 
 export interface ShopApiOneTimeChargeRequest {
 export interface ShopApiOneTimeChargeRequest {
@@ -247,7 +247,7 @@ function getPartnerCredentials(): PartnerCredentials {
 }
 }
 
 
 // =============================================================================
 // =============================================================================
-// SHOP API CONFIGURATION (for <shopname>.api.myshoprenter.hu/billing)
+// SHOP API CONFIGURATION (for <shopname>.api2.myshoprenter.hu/api/billing)
 // Now uses Bearer token authentication (same as product/order API)
 // Now uses Bearer token authentication (same as product/order API)
 // =============================================================================
 // =============================================================================
 
 
@@ -453,7 +453,7 @@ async function makePartnerApiRequest(
 
 
 // =============================================================================
 // =============================================================================
 // SHOP API REQUEST HELPER
 // SHOP API REQUEST HELPER
-// For <shopname>.api.myshoprenter.hu/billing endpoints
+// For <shopname>.api2.myshoprenter.hu/api/billing endpoints
 // =============================================================================
 // =============================================================================
 
 
 async function makeShopApiRequest(
 async function makeShopApiRequest(
@@ -478,8 +478,8 @@ async function makeShopApiRequest(
     headers['Content-Length'] = new TextEncoder().encode(bodyJson).length.toString()
     headers['Content-Length'] = new TextEncoder().encode(bodyJson).length.toString()
   }
   }
 
 
-  const hostname = `${shopname}.api.myshoprenter.hu`
-  const fullPath = `/billing${path}`
+  const hostname = `${shopname}.api2.myshoprenter.hu`
+  const fullPath = `/api/billing${path}`
   console.log(`[ShopRenter Shop API] ${method} https://${hostname}${fullPath}`)
   console.log(`[ShopRenter Shop API] ${method} https://${hostname}${fullPath}`)
   if (bodyJson) {
   if (bodyJson) {
     console.log('[ShopRenter Shop API] Request body:', bodyJson)
     console.log('[ShopRenter Shop API] Request body:', bodyJson)