-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
415 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...va/com/emerchantpay/gateway/genesisandroid/api/constants/recurring/RecurringAmountType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.emerchantpay.gateway.genesisandroid.api.constants | ||
|
||
import java.util.* | ||
|
||
enum class RecurringAmountType(val value: String) { | ||
// Amount types | ||
FIXED("fixed"), | ||
MAX("max"); | ||
|
||
override fun toString(): String { | ||
return name.lowercase(Locale.ROOT) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...java/com/emerchantpay/gateway/genesisandroid/api/constants/recurring/RecurringCategory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.emerchantpay.gateway.genesisandroid.api.constants.recurring | ||
|
||
import java.util.* | ||
|
||
enum class RecurringCategory(val value: String) { | ||
SUBSCRIPTION("subscription"), | ||
STANDING_ORDER("stanging_order"); | ||
|
||
override fun toString(): String { | ||
return name.lowercase(Locale.ROOT) | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...ava/com/emerchantpay/gateway/genesisandroid/api/constants/recurring/RecurringFrequency.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.emerchantpay.gateway.genesisandroid.api.constants | ||
|
||
import java.util.* | ||
|
||
enum class RecurringFrequency(val value: String) { | ||
// Frequency | ||
DAYLY("daily"), | ||
TWICE_WEEKLY("twice_weekly"), | ||
WEEKLY("weekly"), | ||
TEN_DAYS("ten_days"), | ||
FORTNIGHTLY("fortnightly"), | ||
MONTHLY("monthly"), | ||
EVERY_TWO_MONTHS("every_two_months"), | ||
TRIMESTER("trimester"), | ||
QUARTERLY("quarterly"), | ||
TWICE_YEARLY("twice_yearly"), | ||
ANUALLY("annually"), | ||
UNSCHEDULED("unscheduled"); | ||
|
||
override fun toString(): String { | ||
return name.lowercase(Locale.ROOT) | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...java/com/emerchantpay/gateway/genesisandroid/api/constants/recurring/RecurringInterval.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.emerchantpay.gateway.genesisandroid.api.constants | ||
|
||
import java.util.* | ||
|
||
enum class RecurringInterval(val value: String) { | ||
// Interval | ||
DAYS("days"), | ||
MONTHS("months"); | ||
|
||
override fun toString(): String { | ||
return name.lowercase(Locale.ROOT) | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...ain/java/com/emerchantpay/gateway/genesisandroid/api/constants/recurring/RecurringMode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.emerchantpay.gateway.genesisandroid.api.constants | ||
|
||
import java.util.* | ||
|
||
enum class RecurringMode(val value: String) { | ||
// Mode | ||
AUTOMATIC("automatic"), | ||
MANUAL("manual"); | ||
|
||
override fun toString(): String { | ||
return name.lowercase(Locale.ROOT) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...a/com/emerchantpay/gateway/genesisandroid/api/constants/recurring/RecurringPaymentType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.emerchantpay.gateway.genesisandroid.api.constants | ||
|
||
import java.util.* | ||
|
||
enum class RecurringPaymentType(val value: String) { | ||
// Payment types | ||
INITIAL("initial"), | ||
SUBSEQUENT("subsequent"), | ||
MODIFICATION("modification"), | ||
CANCELLATION("cancellation"); | ||
|
||
override fun toString(): String { | ||
return name.lowercase(Locale.ROOT) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...ain/java/com/emerchantpay/gateway/genesisandroid/api/constants/recurring/RecurringType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.emerchantpay.gateway.genesisandroid.api.constants.recurring | ||
|
||
import java.util.* | ||
|
||
enum class RecurringType(val value: String) { | ||
INITIAL("initial"), | ||
MANAGED("managed"); | ||
|
||
override fun toString(): String { | ||
return name.lowercase(Locale.ROOT) | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...ntpay/gateway/genesisandroid/api/interfaces/recurring/CommonManagedRecurringAttributes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.emerchantpay.gateway.genesisandroid.api.interfaces.recurring | ||
|
||
import com.emerchantpay.gateway.genesisandroid.api.constants.RecurringInterval | ||
import com.emerchantpay.gateway.genesisandroid.api.constants.RecurringMode | ||
import com.emerchantpay.gateway.genesisandroid.api.util.RequestBuilder | ||
import java.text.SimpleDateFormat | ||
import java.util.* | ||
|
||
interface CommonManagedRecurringAttributes: IndianManagedRecurringAttributes { | ||
|
||
fun setMode(mode: RecurringMode) { | ||
requestBuilder.addElement("mode", mode.toString()) | ||
} | ||
|
||
fun setInterval(interval: RecurringInterval) { | ||
requestBuilder.addElement("interval", interval.toString()) | ||
} | ||
|
||
fun setFirstDate(firstDate: Date?) { | ||
firstDate?.let { requestBuilder.addElement("first_date", SimpleDateFormat(DATE_FORMAT).format(it)) } | ||
} | ||
|
||
fun setTimeOfDay(timeOfDay: Int) { | ||
requestBuilder.addElement("time_of_day", timeOfDay) | ||
} | ||
|
||
fun setPeriod(period: Int) { | ||
requestBuilder.addElement("period", period) | ||
} | ||
|
||
fun setAmount(amount: Int) { | ||
requestBuilder.addElement("amount", amount) | ||
} | ||
|
||
fun setMaxCount(maxCount: Int) { | ||
requestBuilder.addElement("max_count", maxCount) | ||
} | ||
|
||
fun buildManagedRecurringAttributes(): RequestBuilder = requestBuilder | ||
|
||
companion object { | ||
private const val DATE_FORMAT = "yyyy-MM-dd" | ||
private val requestBuilder = RequestBuilder("") | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...ntpay/gateway/genesisandroid/api/interfaces/recurring/IndianManagedRecurringAttributes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.emerchantpay.gateway.genesisandroid.api.interfaces.recurring | ||
|
||
import com.emerchantpay.gateway.genesisandroid.api.constants.RecurringAmountType | ||
import com.emerchantpay.gateway.genesisandroid.api.constants.RecurringFrequency | ||
import com.emerchantpay.gateway.genesisandroid.api.constants.RecurringPaymentType | ||
import com.emerchantpay.gateway.genesisandroid.api.util.RequestBuilder | ||
|
||
interface IndianManagedRecurringAttributes { | ||
|
||
fun setPaymentType(paymentType: RecurringPaymentType) { | ||
requestBuilder.addElement("payment_type", paymentType.value) | ||
} | ||
|
||
fun setAmountType(amountType: RecurringAmountType) { | ||
requestBuilder.addElement("amount_type", amountType.value) | ||
} | ||
|
||
fun setFrequency(frequency: RecurringFrequency) { | ||
requestBuilder.addElement("frequency", frequency.value) | ||
} | ||
|
||
fun setRegistrationReferenceNumber(referenceNumber: Int) { | ||
requestBuilder.addElement("registration_reference_number", referenceNumber.toString()) | ||
} | ||
|
||
fun setMaxAmount(maxAmount: Int) { | ||
requestBuilder.addElement("max_amount", maxAmount.toString()) | ||
} | ||
|
||
fun setValidated(validated: Boolean) { | ||
requestBuilder.addElement("validated", validated.toString()) | ||
} | ||
|
||
fun buildIndianManagedRecurringAttributes(): RequestBuilder = requestBuilder | ||
|
||
companion object { | ||
private val requestBuilder = RequestBuilder("") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.