@@ -6,14 +6,14 @@ import androidx.activity.result.ActivityResultLauncher
66import androidx.appcompat.app.AppCompatActivity
77import co.thepeer.sdk.model.ThepeerParam
88import co.thepeer.sdk.model.ThepeerResult
9- import co.thepeer.sdk.model.ThepeerSdkType
9+ import co.thepeer.sdk.model.ThepeerSDKType
1010import co.thepeer.sdk.ui.ThepeerResultContract
1111import co.thepeer.sdk.ui.ThepeerResultListener
1212import co.thepeer.sdk.utils.ThepeerConstants
1313import java.math.BigDecimal
1414
1515/* *
16- * This is Thepeer SDk class instance
16+ * This is Thepeer SDK class instance
1717 * @param activity -> Required to launch the drop in UI activity
1818 * @param publicKey -> Required to authenticate the merchant
1919 * @param resultRegistry -> used to register the activity for result
@@ -24,7 +24,7 @@ import java.math.BigDecimal
2424 */
2525class Thepeer internal constructor(
2626 private var publicKey : String ,
27- private var resultRegistry : ActivityResultLauncher < ThepeerParam >,
27+ private var resultRegistry : ActivityResultLauncher <ThepeerParam >,
2828 private var activity : AppCompatActivity ,
2929 private var amount : BigDecimal ,
3030 private var currency : String ,
@@ -49,15 +49,15 @@ class Thepeer internal constructor(
4949 ) {
5050
5151 var resultRegistry = activity.registerForActivityResult(
52- ThepeerResultContract (),
53- activity.activityResultRegistry
54- ) { chargeResult ->
55- when (chargeResult) {
56- is ThepeerResult .Success -> resultListener.onSuccess(chargeResult.transaction)
57- is ThepeerResult .Error -> resultListener.onError(chargeResult.error)
58- ThepeerResult .Cancelled -> resultListener.onCancelled()
59- }
60- }
52+ ThepeerResultContract (),
53+ activity.activityResultRegistry
54+ ) { chargeResult ->
55+ when (chargeResult) {
56+ is ThepeerResult .Success -> resultListener.onSuccess(chargeResult.transaction)
57+ is ThepeerResult .Error -> resultListener.onError(chargeResult.error)
58+ ThepeerResult .Cancelled -> resultListener.onCancelled()
59+ }
60+ }
6161 private var publicKey = getPublicKeyFromManifest(activity)
6262
6363 private var meta: Map <String , String > = emptyMap()
@@ -111,9 +111,9 @@ class Thepeer internal constructor(
111111 * This function will be called to launch ThePeer Send Money Widget
112112 */
113113 fun send () {
114- val params = ThepeerParam (
114+ val params = ThepeerParam (
115115 publicKey,
116- getSdkType(ThepeerSdkType .SEND ),
116+ getSdkType(ThepeerSDKType .SEND ),
117117 amount,
118118 currency,
119119 userReference,
@@ -132,7 +132,7 @@ class Thepeer internal constructor(
132132 fun checkout (emailAddress : String ) {
133133 val params = ThepeerParam (
134134 publicKey,
135- getSdkType(ThepeerSdkType .CHECKOUT ),
135+ getSdkType(ThepeerSDKType .CHECKOUT ),
136136 amount,
137137 currency,
138138 userReference,
@@ -149,9 +149,9 @@ class Thepeer internal constructor(
149149 * This function will be called to launch ThePeer Direct Charge Widget
150150 */
151151 fun directCharge () {
152- val params = ThepeerParam (
152+ val params = ThepeerParam (
153153 publicKey,
154- getSdkType(ThepeerSdkType .DIRECT_CHARGE ),
154+ getSdkType(ThepeerSDKType .DIRECT_CHARGE ),
155155 amount,
156156 currency,
157157 userReference,
@@ -165,15 +165,15 @@ class Thepeer internal constructor(
165165 }
166166
167167
168- private fun getSdkType (type : Enum <ThepeerSdkType >): String {
168+ private fun getSdkType (type : Enum <ThepeerSDKType >): String {
169169 return when (type) {
170- ThepeerSdkType .SEND -> {
170+ ThepeerSDKType .SEND -> {
171171 return ThepeerConstants .SEND
172172 }
173- ThepeerSdkType .CHECKOUT -> {
173+ ThepeerSDKType .CHECKOUT -> {
174174 return ThepeerConstants .CHECKOUT
175175 }
176- ThepeerSdkType .DIRECT_CHARGE -> {
176+ ThepeerSDKType .DIRECT_CHARGE -> {
177177 return ThepeerConstants .DIRECT_CHARGE
178178 }
179179 else -> " "
0 commit comments