Skip to content

Commit

Permalink
fix: fixes android release issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-haripriyan committed Apr 19, 2023
1 parent 99f8821 commit 2be5f79
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 16 deletions.
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.chargebee.android">
package="com.chargebee.android.reactnative">

</manifest>
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.chargebee.android
package com.chargebee.android.reactnative

import com.chargebee.android.Chargebee
import com.chargebee.android.reactnative.ChargebeeReactNativeSpec
import com.chargebee.android.ErrorDetail
import com.chargebee.android.billingservice.CBCallback
import com.chargebee.android.billingservice.CBPurchase
import com.chargebee.android.billingservice.GPErrorCode
Expand All @@ -8,7 +11,15 @@ import com.chargebee.android.exceptions.CBProductIDResult
import com.chargebee.android.exceptions.ChargebeeResult
import com.chargebee.android.models.*
import com.chargebee.android.network.ReceiptDetail
import com.chargebee.android.utils.*
import com.chargebee.android.reactnative.models.*
import com.chargebee.android.reactnative.utils.convertArrayToWritableArray
import com.chargebee.android.reactnative.utils.convertAuthenticationDetailToDictionary
import com.chargebee.android.reactnative.utils.convertListToWritableArray
import com.chargebee.android.reactnative.utils.convertPurchaseResultToDictionary
import com.chargebee.android.reactnative.utils.convertQueryParamsToArray
import com.chargebee.android.reactnative.utils.convertReadableArray
import com.chargebee.android.reactnative.utils.convertReadableMapToCustomer
import com.chargebee.android.reactnative.utils.convertSubscriptionsToDictionary
import com.facebook.react.bridge.*

class ChargebeeReactNativeModule internal constructor(context: ReactApplicationContext) :
Expand All @@ -34,7 +45,12 @@ class ChargebeeReactNativeModule internal constructor(context: ReactApplicationC
}
is ChargebeeResult.Error -> {
val messageUserInfo = it.exp.messageUserInfo()
promise.reject("${CBReactNativeError.INVALID_SDK_CONFIGURATION.code}", messageUserInfo.getString("message"), it.exp, messageUserInfo)
promise.reject(
"${CBReactNativeError.INVALID_SDK_CONFIGURATION.code}",
messageUserInfo.getString("message"),
it.exp,
messageUserInfo
)
}
}
}
Expand Down Expand Up @@ -125,14 +141,19 @@ class ChargebeeReactNativeModule internal constructor(context: ReactApplicationC
@ReactMethod
override fun retrieveSubscriptions(queryParams: ReadableMap, promise: Promise) {
Chargebee.retrieveSubscriptions(queryParams.toMap()) {
when(it){
when (it) {
is ChargebeeResult.Success -> {
val subscriptions = (it.data as CBSubscription).list
promise.resolve(convertSubscriptionsToDictionary(subscriptions))
}
is ChargebeeResult.Error ->{
is ChargebeeResult.Error -> {
val messageUserInfo = it.exp.messageUserInfo()
promise.reject("${CBReactNativeError.INVALID_SDK_CONFIGURATION.code}", messageUserInfo.getString("message"), it.exp, messageUserInfo)
promise.reject(
"${CBReactNativeError.INVALID_SDK_CONFIGURATION.code}",
messageUserInfo.getString("message"),
it.exp,
messageUserInfo
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.chargebee.android
package com.chargebee.android.reactnative

import com.chargebee.android.reactnative.BuildConfig
import com.facebook.react.TurboReactPackage
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.NativeModule
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.chargebee.android.models
package com.chargebee.android.reactnative.models

import com.chargebee.android.exceptions.CBException
import com.facebook.react.bridge.WritableMap
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.chargebee.android.models
package com.chargebee.android.reactnative.models

import com.android.billingclient.api.BillingClient
import com.android.billingclient.api.BillingClient.BillingResponseCode.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.chargebee.android.models
package com.chargebee.android.reactnative.models

import com.chargebee.android.network.ReceiptDetail
import java.io.Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.chargebee.android.models
package com.chargebee.android.reactnative.models

import com.facebook.react.bridge.ReadableMap

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.chargebee.android.utils
package com.chargebee.android.reactnative.utils

import com.chargebee.android.models.CBProduct
import com.chargebee.android.models.PurchaseResult
import com.chargebee.android.reactnative.models.PurchaseResult
import com.chargebee.android.models.SubscriptionDetailsWrapper
import com.chargebee.android.network.CBAuthResponse
import com.chargebee.android.network.CBCustomer
Expand Down
2 changes: 1 addition & 1 deletion android/src/newarch/ChargebeeReactNativeSpec.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.chargebee.android
package com.chargebee.android.reactnative

import com.facebook.react.bridge.ReactApplicationContext

Expand Down
2 changes: 1 addition & 1 deletion android/src/oldarch/ChargebeeReactNativeSpec.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.chargebee.android
package com.chargebee.android.reactnative

import com.facebook.react.bridge.*

Expand Down

0 comments on commit 2be5f79

Please sign in to comment.