Skip to content

Commit

Permalink
Merge pull request #56 from ringpublishing/dev/new-offer-id-parameter
Browse files Browse the repository at this point in the history
Add mobile_offer_id parameter in Purchase event_details
  • Loading branch information
grzegorzmalopolski authored Oct 30, 2024
2 parents 93886f7 + f9d74ec commit 0a0d623
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 9 deletions.
7 changes: 7 additions & 0 deletions Changelogs/1.6.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
1.6.2 Release notes (2024-10-29)
================================

### Changes

* Add PaidEventParam with 'mobile_offer_id' from offerData used in PurchaseEvent

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ maven {
2. Add to your application project module dependencies section

```ruby
implementation("com.ringpublishing:tracking:1.4.+")
implementation("com.ringpublishing:tracking:1.6.+")
```


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package com.ringpublishing.tracking.data.paid
* @param [paywallTemplateId]: offer template id
* @param [paywallVariantId]: offer template variant id
* @param [displayMode]: offer display mode (inline or modal)
* @param [mobileOfferId]: offer id from subscription base plan
*
* @see SupplierData
* @see OfferDisplayMode
Expand All @@ -21,6 +22,7 @@ data class OfferData(
val paywallTemplateId: String,
val paywallVariantId: String?,
val displayMode: OfferDisplayMode,
val mobileOfferId: String?,
)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ internal class PaidEventsFactory(private val gson: Gson) {
subscriptionPromoPrice = subscriptionPaymentData.subscriptionPromoPrice,
subscriptionPromoDuration = subscriptionPaymentData.subscriptionPromoDuration,
subscriptionPriceCurrency = subscriptionPaymentData.subscriptionPriceCurrency,
fakeUserId = fakeUserId
fakeUserId = fakeUserId,
mobileOfferId = offerData.mobileOfferId
)
)?.let {
this[PaidEventParam.EVENT_DETAILS.text] = it
Expand Down Expand Up @@ -259,5 +260,6 @@ internal class PaidEventsFactory(private val gson: Gson) {
@SerializedName("subscription_promo_duration") val subscriptionPromoDuration: String? = null,
@SerializedName("subscription_price_currency") val subscriptionPriceCurrency: String? = null,
@SerializedName("fake_user_id") val fakeUserId: String? = null,
@SerializedName("mobile_offer_id") val mobileOfferId: String? = null,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class PaidEventsFactoryTest
supplierData = sampleSupplierData,
paywallTemplateId = "OTT8ICJL3LWX",
paywallVariantId = "OTVAEW37T5NG3",
displayMode = OfferDisplayMode.INLINE
displayMode = OfferDisplayMode.INLINE,
mobileOfferId = "standard-promo"
)

private val sampleOfferContextData = OfferContextData(
Expand Down Expand Up @@ -191,9 +192,9 @@ class PaidEventsFactoryTest
val sampleTermId = "TMEVT00KVHV0"
val sampleFakeUserId = "fake_001"
val sampleTermConversionId = "TCCJTS9X87VB"
val sampleFakePurchaseJson =
val sampleEventDetailsData =
"{\"subscription_base_price\":100.0,\"subscription_promo_price\":99.99,\"subscription_promo_duration\":\"1W\",\"subscription_price_currency\":\"usd\"," +
"\"fake_user_id\":\"fake_001\"}"
"\"fake_user_id\":\"fake_001\",\"mobile_offer_id\":\"standard-promo\"}"
val event = eventsFactory.createPurchaseEvent(
contentMetadata = sampleContentMetadata,
offerData = sampleOfferData,
Expand All @@ -218,7 +219,7 @@ class PaidEventsFactoryTest
Assert.assertEquals(event.parameters[PaidEventParam.TPCC.text], sampleTpcc)
Assert.assertEquals(event.parameters[PaidEventParam.TERM_ID.text], sampleTermId)
Assert.assertEquals(event.parameters[PaidEventParam.TERM_CONVERSION_ID.text], sampleTermConversionId)
Assert.assertEquals(event.parameters[PaidEventParam.EVENT_DETAILS.text], sampleFakePurchaseJson)
Assert.assertEquals(event.parameters[PaidEventParam.EVENT_DETAILS.text], sampleEventDetailsData)
Assert.assertEquals(event.parameters[EventParam.MARKED_AS_PAID_DATA.text], mockRdlcnEncodingPaid())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ val sampleOfferData = OfferData(
supplierData = sampleSupplierData,
paywallTemplateId = "OTT8ICJL3LWX",
paywallVariantId = "OTVAEW37T5NG3",
displayMode = OfferDisplayMode.INLINE
displayMode = OfferDisplayMode.INLINE,
"standard-promo"
)

val sampleOfferContextData = OfferContextData(
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ android.useAndroidX=true
android.enableJetifier=true

#Library version name
sdk_version_name=1.6.1
sdk_version_name=1.6.2
#Library version code
sdk_version_code=20
sdk_version_code=21

0 comments on commit 0a0d623

Please sign in to comment.