Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introductory offer price support #71

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

cb-amutha
Copy link
Contributor

Feature:

  • Adds introductory offer price change
  • Refactored restore purchase sync with Chargebee and validate receipt

val allPurchases = restorePurchases.filter { subscription ->
subscription.storeStatus == StoreStatus.Active.value || subscription.storeStatus == StoreStatus.InTrial.value
|| subscription.storeStatus == StoreStatus.Cancelled.value || subscription.storeStatus == StoreStatus.Paused.value
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? Should restorePurchases by definition be same as allPurchases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

syncPurchaseWithChargebee(CBRestorePurchaseManager.allTransactions)
} else {
restorePurchaseCallBack.onSuccess(activePurchases)
syncPurchaseWithChargebee(CBRestorePurchaseManager.activeTransactions)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: alignment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

javaClass.simpleName,
"Exception from Server - validateReceipt() : ${it.exp.message}"
)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How could this be conveyed to the app?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are just doing sync purchase. this not required to be notified to user.

if (product.skuDetails.introductoryPrice.isNotEmpty()) {
val subscriptionPeriod = product.skuDetails.introductoryPricePeriod
if (product.skuDetails.introductoryPriceCycles == 1) {
introductoryOfferType = "pay_up_front"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we treat this as an enum?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

val introductoryPrice: String?,
val introductoryPriceAmountMicros: Long?,
val introductoryPricePeriod: Int?,
val introductoryOfferType: String?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we treat this as an enum?
And are all of these values need to be optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

var offerDetail = OfferDetail( introductoryPrice = "",
introductoryPriceAmountMicros = 0,
introductoryPricePeriod = 0,
introductoryOfferType = "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to return this offerdetail even for cases where there are no offers? Can we return and optional empty instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, made changes accordingly.

"channel" to this.channel,
"introductory_offer[price]" to this.offerDetail.introductoryPriceAmountMicros.toString(),
"introductory_offer[type]" to this.offerDetail.introductoryOfferType,
"introductory_offer[period]" to this.offerDetail.introductoryPricePeriod.toString()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these values mandatory for the API?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not mandatory for this API. if no offers associated for the plans yes we can ignore it. thanks @cb-haripriyan

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants