mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-11 22:55:55 +05:45
* Add validation logic for Test Store API keys under the TEST_STORE compiler flag * add unit test for test store api key validation * Move API key validation to `configure` and store validation result in `SystemInfo` * start new flow for purchase of `TestStoreProduct`s * WIP: implement alert for purchase of a Test Store product * Add file to Xcode workspace * WIP: implement fake purchase alert in all platforms and OSs * Enforce only one test purchases at once. Use constants for test purchase alert strings * Place new test store purchase APIs under the TEST_STORE compiler flag * fix lint * fix unit tests after change of internal APIs * PR comments * temporarily return hardcoded `CustomerInfo` on confirmed test purchase * tests: adapt unit tests to new `TestStorePurchaseHandler` dependency of `PurchasesOrchestrator` * fix lint * Fix backend integration tests compilation * Remove deprecation warning * remove unnecessary OSs checks Since the minimum supported versions of the SDK are iOS 13 and tvOS 13 * add `GetWebProductsOperation` * avoid duplicating decoding objects from WebOfferingProductsResponse and WebProductsResponse * add missing tests snapshots * Add `WebProductsResponse.ProductType` enum * Fix tests * add web products decoding tests * Rename WebProducts to WebBillingProducts * (more) rename WebProducts to WebBillingProducts * (even more) rename WebProducts to WebBillingProducts * Move `getWebBillingProducts` outside of `OfferingsAPI` into a new `WebBillingAPI` object * improve test * remove unnecessary `sorted()` of `Set` * fix lint * fix tests Since the GetWebBilling request path contains an unordered set of productIds, which the tests do not support, we're only doing snapshot tests with 1 product ID * fix more tests
76 lines
2.1 KiB
Swift
76 lines
2.1 KiB
Swift
//
|
|
// Copyright RevenueCat Inc. All Rights Reserved.
|
|
//
|
|
// Licensed under the MIT License (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://opensource.org/licenses/MIT
|
|
//
|
|
// WebBillingHTTPRequestPath.swift
|
|
//
|
|
// Created by Toni Rico on 5/6/25.
|
|
|
|
import Foundation
|
|
|
|
extension HTTPRequest.WebBillingPath: HTTPRequestPath {
|
|
|
|
// swiftlint:disable:next force_unwrapping
|
|
static let serverHostURL = URL(string: "https://api.revenuecat.com")!
|
|
|
|
var authenticated: Bool {
|
|
switch self {
|
|
case .getWebOfferingProducts,
|
|
.getWebBillingProducts:
|
|
return true
|
|
}
|
|
}
|
|
|
|
var shouldSendEtag: Bool {
|
|
switch self {
|
|
case .getWebOfferingProducts,
|
|
.getWebBillingProducts:
|
|
return true
|
|
}
|
|
}
|
|
|
|
var supportsSignatureVerification: Bool {
|
|
switch self {
|
|
case .getWebOfferingProducts,
|
|
.getWebBillingProducts:
|
|
return false
|
|
}
|
|
}
|
|
|
|
var needsNonceForSigning: Bool {
|
|
switch self {
|
|
case .getWebOfferingProducts,
|
|
.getWebBillingProducts:
|
|
return false
|
|
}
|
|
}
|
|
|
|
var relativePath: String {
|
|
switch self {
|
|
case let .getWebOfferingProducts(appUserID):
|
|
return "/rcbilling/v1/subscribers/\(appUserID.trimmedAndEscaped)/offering_products"
|
|
case let .getWebBillingProducts(userId, productIds):
|
|
let encodedUserId = userId.trimmedAndEscaped
|
|
let encodedProductIds = productIds.map { productId in
|
|
"id=\(productId.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) ?? productId)"
|
|
}.joined(separator: "&")
|
|
return "/rcbilling/v1/subscribers/\(encodedUserId)/products?\(encodedProductIds)"
|
|
}
|
|
}
|
|
|
|
var name: String {
|
|
switch self {
|
|
case .getWebOfferingProducts:
|
|
return "get_web_offering_products"
|
|
case .getWebBillingProducts:
|
|
return "get_web_products"
|
|
}
|
|
}
|
|
|
|
}
|