Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

chore: refactor in-app purchase execute API #1826

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Source/CourseUpgradeAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,16 @@ public struct CourseUpgradeAPI {
return Success(v: (OrderVerify(json: json)))
}

static func executeAPI(basketID: Int, productID: String, price: NSDecimalNumber, currencyCode: String, receipt: String) -> NetworkRequest<OrderVerify> {
static func executeAPI(basketID: Int, price: NSDecimalNumber, currencyCode: String, receipt: String) -> NetworkRequest<OrderVerify> {
return NetworkRequest(
method: .POST,
path: "/api/iap/v1/execute/",
requiresAuth: true,
body: .jsonBody(JSON([
"basket_id": basketID,
"productId": productID,
"price": price,
"currency_code": currencyCode,
"purchaseToken": receipt,
"purchase_token": receipt,
"payment_processor": PaymentProcessor
] as [String : Any])),
deserializer: .jsonResponse(executeDeserializer)
Expand Down
2 changes: 1 addition & 1 deletion Source/CourseUpgradeHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class CourseUpgradeHandler: NSObject {

// Execute API, pass the payment receipt to complete the course upgrade
let baseURL = CourseUpgradeAPI.baseURL
let request = CourseUpgradeAPI.executeAPI(basketID: basketID, productID: courseSku, price: price ?? 0, currencyCode: currencyCode ?? "", receipt: receipt)
let request = CourseUpgradeAPI.executeAPI(basketID: basketID, price: price ?? 0, currencyCode: currencyCode ?? "", receipt: receipt)

environment?.networkManager.taskForRequest(base: baseURL, request) { [weak self] response in
if response.error == nil {
Expand Down
Loading