Skip to content

Commit

Permalink
Android SDK v2.1.19 added, CF Loader Flow
Browse files Browse the repository at this point in the history
  • Loading branch information
kishan-cashfree committed Aug 9, 2024
1 parent 7735961 commit aca21c1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

implementation 'com.cashfree.pg:api:2.1.18'
implementation 'com.cashfree.pg:api:2.1.19'

androidTestImplementation platform('androidx.compose:compose-bom:2022.10.00')
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/cashfree/sdk_sample/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import com.cashfree.pg.core.api.upi.CFUPI

data class Config(
// CFSession Inputs
val orderID: String = "order_101024392jMkFaGS2z5AJMx9vxWb7reG7Wz",
val paymentSessionID: String = "session_R16H4Krd12PXpy767jf0BjydfGYF8SqPZEzkK7kUPPCHFCkqlNm2ucYMIAZANBkMrQpJVNq0fODJBT3TcPnKc44iYsrVbLvarjym8-M4dpXn",
val orderID: String = "devstudio_95987450",
val paymentSessionID: String = "session_Diki726QGmNZ3GRLMjM0G5HdSQ3CoaQFsU6qLVY4NRrOr98KtY0MWbMRo0kD_jkDHilmYpXX2Iurk1bHlgUXKiyPOeKXKTc_yJsWb4qm4pXY",
val environment: CFSession.Environment = CFSession.Environment.SANDBOX,

//Card Payment Inputs
Expand Down Expand Up @@ -36,5 +36,5 @@ data class Config(
val payLaterChannel: String = "lazypay",

// Net Banking mode
val bankCode: Int = 3003
val bankCode: Int = 3006
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.cashfree.pg.core.api.CFCorePaymentGatewayService;
import com.cashfree.pg.core.api.CFSession;
import com.cashfree.pg.core.api.CFTheme;
import com.cashfree.pg.core.api.base.CFPayment;
import com.cashfree.pg.core.api.callback.CFCheckoutResponseCallback;
import com.cashfree.pg.core.api.card.CFCard;
import com.cashfree.pg.core.api.card.CFCardPayment;
Expand Down Expand Up @@ -136,6 +137,8 @@ public void doCardPayment(View view) {
.setCardExpiryYear(cardYY)
.setCVV(cardCVV)
.build();

//To Set your theme on Cashfree UI
CFTheme theme = new CFTheme.CFThemeBuilder()
.setNavigationBarBackgroundColor("#6A2222")
.setNavigationBarTextColor("#FFFFFF")
Expand All @@ -150,10 +153,10 @@ public void doCardPayment(View view) {
.build();
cfCardPayment.setTheme(theme);
/**
* To set Loader UI before order pay network call.
* To set Full Screen Loader UI before order pay network call.
* This is optional for merchants. If they specially want to show UI loader then only enable it.
*/
cfCardPayment.setLoaderEnable(true);
cfCardPayment.setCfSDKFlow(CFPayment.CFSDKFlow.WITH_CASHFREE_FULLSCREEN_LOADER);

CFCorePaymentGatewayService.getInstance().doPayment(ElementCheckoutActivity.this, cfCardPayment);
} catch (CFException exception) {
Expand Down Expand Up @@ -272,6 +275,7 @@ public void doNetBankingPayment(View view) {
CFNetBanking cfNetBanking = new CFNetBanking.CFNetBankingBuilder()
.setBankCode(bankCode)
.build();
//To Set your theme on Cashfree UI
CFTheme theme = new CFTheme.CFThemeBuilder()
.setNavigationBarBackgroundColor("#6A2222")
.setNavigationBarTextColor("#FFFFFF")
Expand All @@ -285,11 +289,13 @@ public void doNetBankingPayment(View view) {
.setCfNetBanking(cfNetBanking)
.build();
cfNetBankingPayment.setTheme(theme);

/**
* To set Loader UI before order pay network call.
* This is optional for merchants. If they specially want to show UI loader then only enable it.
*/
cfNetBankingPayment.setLoaderEnable(true);
cfNetBankingPayment.setCfSDKFlow(CFPayment.CFSDKFlow.WITH_CASHFREE_FULLSCREEN_LOADER);

CFCorePaymentGatewayService.getInstance().doPayment(ElementCheckoutActivity.this, cfNetBankingPayment);
} catch (CFException exception) {
exception.printStackTrace();
Expand All @@ -316,6 +322,8 @@ public void doWalletPayment(View view) {
.setProvider(channel)
.setPhone(phone)
.build();

//To Set your theme on Cashfree UI
CFTheme theme = new CFTheme.CFThemeBuilder()
.setNavigationBarBackgroundColor("#6A2222")
.setNavigationBarTextColor("#FFFFFF")
Expand All @@ -333,7 +341,7 @@ public void doWalletPayment(View view) {
* To set Loader UI before order pay network call.
* This is optional for merchants. If they specially want to show UI loader then only enable it.
*/
cfWalletPayment.setLoaderEnable(true);
cfWalletPayment.setCfSDKFlow(CFPayment.CFSDKFlow.WITH_CASHFREE_FULLSCREEN_LOADER);
CFCorePaymentGatewayService.getInstance().doPayment(ElementCheckoutActivity.this, cfWalletPayment);
} catch (CFException exception) {
exception.printStackTrace();
Expand Down

0 comments on commit aca21c1

Please sign in to comment.