Skip to content

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