Skip to content

Commit

Permalink
upi added
Browse files Browse the repository at this point in the history
  • Loading branch information
imabhishekkumar committed Feb 17, 2020
1 parent beb3696 commit 6653c2d
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 1 deletion.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ dependencies {
// Chart
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'

// UPI
implementation 'com.shreyaspatil:EasyUpiPayment:2.0'

// ROOM
implementation 'androidx.room:room-runtime:2.2.3'
kapt 'androidx.room:room-compiler:2.2.3'
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".view.SplitwiseActivity"></activity>
<activity android:name=".AddCardActivity"></activity>
<activity android:name=".UpiPaymentActivity" />
<activity android:name=".view.SplitwiseActivity" />
<activity android:name=".view.WebActivity" />
<activity android:name=".view.InvestmentActivity" />
<activity android:name=".view.MessageActivity" />
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/java/tech/risinglight/financebuddy/AddCardActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package tech.risinglight.financebuddy

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class AddCardActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_add_card)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package tech.risinglight.financebuddy

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.shreyaspatil.EasyUpiPayment.EasyUpiPayment
import kotlinx.android.synthetic.main.activity_upi_payment.*
import kotlin.random.Random


class UpiPaymentActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_upi_payment)

payBtn.setOnClickListener {
val amount =
if (amountET.text.toString().contains('.')) amountET.text.toString() else amountET.text.toString() + ".00"
val random = Random(1100000)
val easyUpiPayment = EasyUpiPayment.Builder()
.with(this)
.setPayeeVpa(upi_idET.text.toString())
.setPayeeName("")
.setTransactionId(random.nextInt().toString())
.setTransactionRefId(random.nextInt().toString())
.setDescription(noteET.text.toString())
.setAmount(amount)
.build()
easyUpiPayment.startPayment()
}
}
}
9 changes: 9 additions & 0 deletions app/src/main/res/layout/activity_add_card.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".AddCardActivity">

</androidx.constraintlayout.widget.ConstraintLayout>
58 changes: 58 additions & 0 deletions app/src/main/res/layout/activity_upi_payment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">

<EditText
android:id="@+id/amountET"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:hint="Amount"
android:inputType="number"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<EditText
android:id="@+id/upi_idET"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/amountET"
android:layout_marginTop="20dp"
android:hint="UPI Id"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/amountET" />

<EditText
android:id="@+id/noteET"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/upi_idET"
android:layout_marginTop="20dp"
android:hint="Note"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/upi_idET" />

<Button
android:id="@+id/payBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/noteET"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:background="@color/colorPrimary"
android:text="PAY BY UPI"
android:textColor="@android:color/white"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/noteET" />


</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit 6653c2d

Please sign in to comment.