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

Commit

Permalink
chore: refactor in-app purchase execute API
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir committed Apr 24, 2024
1 parent 5251050 commit 927a4b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
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

0 comments on commit 927a4b7

Please sign in to comment.