forked from openedx/openedx-app-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Payments and upgrade execution for the course (#1)
* feat: Payments and upgrade execution for the course - Learners can purchase a course and unlock the gated content from the main dashboard - Loading course price on upgrade buttons successfully - Calling necessary APIs on interaction with the upgrade button - Processing the course upgrade - IAP Analytics fixes: LEARNER-9956 * feat: IAP for course dashboard * feat: added IAP UI views * feat: Add success message after upgrade - Code improvements & fixes * feat: handle UnfulfilledPurchase - In this case, the app relaunch must rerun the course upgrade flow with the available course upgrade data. fixes: LEARNER-9917 * feat: restore purchases from settings screen fixes: LEARNER-9915 * refactor: Error Alert Action Analytics Handling - fix IAP Analytics issues - Code improvements fixes: LEARNER-10042 * feat: update rocket icon for full screen loader - Full screen loader whille course is upgarding - Code improvements --------- Co-authored-by: k1rill <[email protected]>
- Loading branch information
1 parent
1d7a091
commit 8b5722f
Showing
89 changed files
with
4,006 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
core/src/main/java/org/openedx/core/data/api/iap/InAppPurchasesApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.openedx.core.data.api.iap | ||
|
||
import org.openedx.core.data.model.iap.AddToBasketResponse | ||
import org.openedx.core.data.model.iap.CheckoutResponse | ||
import org.openedx.core.data.model.iap.ExecuteOrderResponse | ||
import retrofit2.Response | ||
import retrofit2.http.Field | ||
import retrofit2.http.FormUrlEncoded | ||
import retrofit2.http.GET | ||
import retrofit2.http.POST | ||
import retrofit2.http.Query | ||
|
||
interface InAppPurchasesApi { | ||
@GET("/api/iap/v1/basket/add/") | ||
suspend fun addToBasket(@Query("sku") productId: String): Response<AddToBasketResponse> | ||
|
||
@FormUrlEncoded | ||
@POST("/api/iap/v1/checkout/") | ||
suspend fun proceedCheckout( | ||
@Field("basket_id") basketId: Long, | ||
@Field("payment_processor") paymentProcessor: String | ||
): Response<CheckoutResponse> | ||
|
||
@FormUrlEncoded | ||
@POST("/api/iap/v1/execute/") | ||
suspend fun executeOrder( | ||
@Field("basket_id") basketId: Long, | ||
@Field("payment_processor") paymentProcessor: String, | ||
@Field("purchase_token") purchaseToken: String, | ||
@Field("price") price: Double, | ||
@Field("currency_code") currencyCode: String, | ||
): Response<ExecuteOrderResponse> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
core/src/main/java/org/openedx/core/data/model/CourseAccessDetails.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.openedx.core.data.model | ||
|
||
import com.google.gson.annotations.SerializedName | ||
import org.openedx.core.data.model.room.discovery.CourseAccessDetailsDb | ||
import org.openedx.core.utils.TimeUtils | ||
import org.openedx.core.domain.model.CourseAccessDetails as DomainCourseAccessDetails | ||
|
||
data class CourseAccessDetails( | ||
@SerializedName("audit_access_expires") | ||
val auditAccessExpires: String?, | ||
@SerializedName("courseware_access") | ||
var coursewareAccess: CoursewareAccess?, | ||
) { | ||
fun mapToDomain(): DomainCourseAccessDetails = | ||
DomainCourseAccessDetails( | ||
TimeUtils.iso8601ToDate(auditAccessExpires ?: ""), | ||
coursewareAccess?.mapToDomain() | ||
) | ||
|
||
fun mapToRoomEntity(): CourseAccessDetailsDb = | ||
CourseAccessDetailsDb(auditAccessExpires, coursewareAccess?.mapToRoomEntity()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.