Skip to content

Commit

Permalink
1.3.93
Browse files Browse the repository at this point in the history
  • Loading branch information
plpt88 committed Dec 20, 2023
1 parent d08e83d commit 95634ad
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions GenesisAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'kotlin-kapt'

ext {
PUBLISH_GROUP_ID = 'com.emerchantpay.gateway'
PUBLISH_VERSION = '1.3.92'
PUBLISH_VERSION = '1.3.93'
PUBLISH_ARTIFACT_ID = 'genesis-android'
PUBLISH_DESCRIPTION = 'Genesis Android SDK'
PUBLISH_URL = 'https://github.com/GenesisGateway/android_sdk'
Expand All @@ -27,7 +27,7 @@ android {
minSdkVersion 19
targetSdkVersion 33
versionCode 1
versionName "1.3.92"
versionName "1.3.93"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,15 +384,7 @@ open class PaymentRequest : Request, PaymentAttributes, CustomerInfoAttributes,
fun addReminder(channel: String, after: Int?): RemindersRequest {
return reminders.addReminder(channel, after)
}

fun setRecurringType(recurringType: RecurringType) {
this.recurringType = recurringType.value
}

fun setRecurringCategory(recurringCategory: RecurringCategory) {
this.recurringCategory = recurringCategory.value
}


fun setGooglePayPaymentSubtype(googlePayPaymentSubtype: GooglePayPaymentSubtype?) {
this.googlePayPaymentSubtype = googlePayPaymentSubtype
googlePayPaymentSubtype?.let { setPaymentSubtype(it) }
Expand Down Expand Up @@ -440,10 +432,10 @@ open class PaymentRequest : Request, PaymentAttributes, CustomerInfoAttributes,

if (isRecurringEnabled(transactionTypesList)) {
recurringType?.let {
paymentRequestBuilder?.addElement("recurring_type", it)
transactionTypes.customAttributes?.addAttribute("recurring_type", it)
}
recurringCategory?.let {
paymentRequestBuilder?.addElement("recurring_category", it)
transactionTypes.customAttributes?.addAttribute("recurring_category", it)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,15 @@ class PaymentRequestUnitTest {

@Test
fun testRecurringParams() {
paymentRequest?.setRecurringType(RecurringType.INITIAL)
paymentRequest?.setRecurringCategory(RecurringCategory.SUBSCRIPTION)
paymentRequest?.transactionTypes?.customAttributes?.addAttribute("recurring_type", RecurringType.INITIAL.value)
paymentRequest?.transactionTypes?.customAttributes?.addAttribute("recurring_category", RecurringCategory.SUBSCRIPTION.value)

paymentRequest!!.isValidData?.let { assertTrue(it) }
assertEquals(paymentRequest?.transactionTypes?.toXML(), paymentRequest?.transactionTypes?.request?.toXML())
paymentRequest?.transactionTypes?.toXML()?.let { it.run {
assertTrue(contains("recurring_type"))
assert(contains("recurring_category"))
} }
}

@Test
Expand All @@ -264,15 +270,17 @@ class PaymentRequestUnitTest {
}

@Test
fun testInvvalidGooglePayTransactionRequest() {
fun testInvalidGooglePayTransactionRequest() {
createPaymentRequest(WPFTransactionTypes.GOOGLE_PAY)

paymentRequest?.transactionTypes?.transactionTypesList?.any { it == WPFTransactionTypes.GOOGLE_PAY.value }
?.let { assertTrue(it) }

paymentRequest?.isValidData?.let { assertFalse(it) }
paymentRequest?.toXML()?.let { it.run {
assertFalse(contains("payment_subtype"))
} }
paymentRequest?.toXML()?.let {
it.run {
assertFalse(contains("payment_subtype"))
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ class GenesisValidatorUnitTest {

@Test
fun testValidDataWithRecurring() {
request?.setRecurringType(RecurringType.INITIAL)
request?.setRecurringCategory(RecurringCategory.SUBSCRIPTION)
request?.transactionTypes?.customAttributes?.addAttribute("recurring_type", RecurringType.INITIAL.value)
request?.transactionTypes?.customAttributes?.addAttribute("recurring_category", RecurringCategory.SUBSCRIPTION.value)
assertTrue(request?.let { validator!!.isValidRequest(it) }!!)
}

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cd GenesisAndroid
* Add the dependency in your build.gradle:
```
dependencies {
implementation 'com.emerchantpay.gateway:genesis-android:1.3.92'
implementation 'com.emerchantpay.gateway:genesis-android:1.3.93'
}
```

Expand Down Expand Up @@ -483,17 +483,19 @@ val paymentRequest = PaymentRequest(this, uniqueId,
"[email protected]", "+555555555", billingAddress,
"https://example.com", transactionTypes)

paymentRequest?.setRecurringType(RecurringType.INITIAL)
paymentRequest?.setRecurringCategory(RecurringCategory.SUBSCRIPTION)
paymentRequest?.transactionTypes?.customAttributes?.addAttribute("recurring_type", RecurringType.INITIAL.value)
paymentRequest?.transactionTypes?.customAttributes?.addAttribute("recurring_category", RecurringCategory.SUBSCRIPTION.value)

// ...
```

```java
// Create Transaction types
TransactionTypesRequest transactionTypes = new TransactionTypesRequest();
transactionTypes.addTransaction(WPFTransactionTypes.SALE);

transactionTypes.addTransaction(WPFTransactionTypes.SALE)
.addParam("recurring_type", RecurringType.INITIAL.getValue())
.addParam("recurring_category", RecurringCategory.SUBSCRIPTION.getValue());

transactionTypes.setMode(RecurringMode.AUTOMATIC)
.setInterval(RecurringInterval.DAYS)
.setFirstDate(FIRST_DATE)
Expand All @@ -508,8 +510,6 @@ PaymentRequest paymentRequest = new PaymentRequest(this, uniqueId,
"[email protected]", "+555555555", billingAddress,
"https://example.com", transactionTypes);

paymentRequest.setRecurringType(RecurringType.INITIAL);
paymentRequest.setRecurringCategory(RecurringCategory.SUBSCRIPTION);

// ...
```
Expand Down

0 comments on commit 95634ad

Please sign in to comment.