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

Commit

Permalink
refactor: In-App Purchase Execute API after Backend Changes
Browse files Browse the repository at this point in the history
- Modify the `purchaseToken` parameter to `purchase_token` in the
 execute API.
- Remove the `productId` parameter from the execute API.

Fixes: LEARNER-9937
  • Loading branch information
HamzaIsrar12 committed Apr 16, 2024
1 parent 1b395f5 commit 31dc577
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ class InAppPurchasesAPI @Inject constructor(private val iapService: InAppPurchas

fun executeOrder(
basketId: Long,
productId: String,
purchaseToken: String,
price: Double,
currencyCode: String,
): Call<ExecuteOrderResponse> {
return iapService.executeOrder(
basketId = basketId,
productId = productId,
paymentProcessor = ApiConstants.PAYMENT_PROCESSOR,
purchaseToken = purchaseToken,
price = price,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ interface InAppPurchasesService {
@POST("/api/iap/v1/execute/")
fun executeOrder(
@Field("basket_id") basketId: Long,
@Field("productId") productId: String,
@Field("payment_processor") paymentProcessor: String,
@Field("purchaseToken") purchaseToken: String,
@Field("purchase_token") purchaseToken: String,
@Field("price") price: Double,
@Field("currency_code") currencyCode: String,
): Call<ExecuteOrderResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,13 @@ class InAppPurchasesRepository(private var iapAPI: InAppPurchasesAPI) {

fun executeOrder(
basketId: Long,
productId: String,
purchaseToken: String,
price: Double,
currencyCode: String,
callback: NetworkResponseCallback<ExecuteOrderResponse>
) {
iapAPI.executeOrder(
basketId = basketId,
productId = productId,
purchaseToken = purchaseToken,
price = price,
currencyCode = currencyCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ class InAppPurchasesViewModel @Inject constructor(
this.iapFlowData = iapData
repository.executeOrder(
basketId = iapData.basketId,
productId = iapData.productInfo.courseSku,
purchaseToken = iapData.purchaseToken,
price = iapData.price,
currencyCode = iapData.currencyCode,
Expand Down

0 comments on commit 31dc577

Please sign in to comment.