Commit e6960d70 authored by Dostonbek Ibragimov's avatar Dostonbek Ibragimov 💻

[ADD] MUS-288, ReplenishBalance pay vendor

parent ff55e2e3
...@@ -95,4 +95,11 @@ object CONSTANTS { ...@@ -95,4 +95,11 @@ object CONSTANTS {
const val API_SERVICE_INDEX = "service/index" const val API_SERVICE_INDEX = "service/index"
const val API_MAIN_ROAMING = "main/roaming" const val API_MAIN_ROAMING = "main/roaming"
//payment
const val PAY_MIN_AMOUNT = 1000
const val PAY_MAX_AMOUNT = 500_000L
const val PAY_AMOUNT = "PAYMENT_SUCCESS_PAYMENT"
const val PAY_SAVE_CARD = "PAYMENT_SAVE_CARD"
const val PAY_CARD_NUMBER = "PAYMENT_CARD_NUMBER"
} }
...@@ -130,7 +130,7 @@ class CardsListFragment : BaseFragment(R.layout.fragment_cards_list) { ...@@ -130,7 +130,7 @@ class CardsListFragment : BaseFragment(R.layout.fragment_cards_list) {
} }
private fun delete(card: CardInfo) { private fun delete(card: CardInfo) {
MobiUz.deleteCard(card) // MobiUz.deleteCard(card)
} }
......
package uz.mobiuz.mobiservice.dev.ui.sdk.pay
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import uz.mobiuz.mobiservice.dev.databinding.LayoutSelectAnotherCardBinding
/**
* Created by DostonbekIbragimov on 24/12/2021.
*/
class SelectAnotherCard : BottomSheetDialogFragment() {
private var _bn: LayoutSelectAnotherCardBinding? = null
private val bn get() = _bn ?: throw NullPointerException("cannot inflate")
private var mListener: Listener? = null
fun setListener(listener: Listener?) {
this.mListener = listener
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
_bn = LayoutSelectAnotherCardBinding.inflate(inflater)
return bn.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setUpUI()
}
private fun setUpUI() {
bn.apply {
btnAnotherCard.setOnClickListener {
mListener?.onClickAnotherCard()
dismiss()
}
btnAddCard.setOnClickListener {
mListener?.onClickAddCard()
dismiss()
}
}
}
interface Listener {
fun onClickAnotherCard()
fun onClickAddCard()
}
}
\ No newline at end of file
package uz.mobiuz.mobiservice.dev.ui.sdk.pay.success
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.View
import androidx.core.view.isVisible
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
import dagger.hilt.android.AndroidEntryPoint
import uz.agr.mobiuz.ui.fast_action.animation.formatPhone
import uz.agr.sdk.coreui.extension.formattedMoney
import uz.agr.sdk.coreui.extension.showSnackMessage
import uz.mobiuz.mobiservice.dev.R
import uz.mobiuz.mobiservice.dev.databinding.FragmentPaymentSuccessfulBinding
import uz.mobiuz.mobiservice.dev.ui.base.BaseFragment
import uz.mobiuz.mobiservice.dev.ui.global.CONSTANTS
import uz.mobiuz.mobiservice.dev.utils.extensions.formatCard
/**
* Created by DostonbekIbragimov on 06/01/2022.
*/
@AndroidEntryPoint
class PaymentSuccessfulFragment : BaseFragment(R.layout.fragment_payment_successful) {
private var _bn: FragmentPaymentSuccessfulBinding? = null
private val bn get() = _bn ?: throw NullPointerException("cannot inflate")
private var phone = ""
private var amount = ""
private var saveCard: Boolean? = null
private var cardNumber = ""
private val navController: NavController by lazy(LazyThreadSafetyMode.NONE) { NavHostFragment.findNavController(this) }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
phone = arguments?.getString(CONSTANTS.PHONE, "") ?: ""
amount = arguments?.getString(CONSTANTS.PAY_AMOUNT, "0") ?: "0"
saveCard = arguments?.getBoolean(CONSTANTS.PAY_SAVE_CARD)
cardNumber = arguments?.getString(CONSTANTS.PAY_CARD_NUMBER, "") ?: ""
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
_bn = FragmentPaymentSuccessfulBinding.bind(view)
setUpUI()
collects()
}
@SuppressLint("SetTextI18n")
override fun setUpUI() {
bn.apply {
etAmount.text = "${amount.toLong().formattedMoney(showDecimal = false, tiyinToSum = false)} ${getString(uz.agr.mobiuz.R.string.agr_mobi_uz_curr)}"
etPhone.text = phone.formatPhone(minus = false)
if (saveCard == true) {
showSnackMessage(getString(uz.agr.mobiuz.R.string.agr_mobi_uz_card_added))
if (cardNumber.isNotEmpty()) {
tvPanTitle.isVisible = true
etCardPan.text = cardNumber.formatCard()
}
}
if (saveCard == false) {
showSnackMessage(getString(uz.agr.mobiuz.R.string.agr_mobi_uz_card_not_save))
}
}
}
override fun collects() {
}
override fun onDestroy() {
_bn = null
super.onDestroy()
}
}
\ No newline at end of file
...@@ -21,14 +21,14 @@ import androidx.fragment.app.FragmentActivity ...@@ -21,14 +21,14 @@ import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.textfield.TextInputEditText import com.google.android.material.textfield.TextInputEditText
import com.google.gson.JsonSyntaxException import com.google.gson.JsonSyntaxException
import retrofit2.HttpException
import uz.agr.mobiuz.ui.fast_action.animation.getPhoneMasked
import uz.mobiuz.mobiservice.dev.R import uz.mobiuz.mobiservice.dev.R
import uz.mobiuz.mobiservice.dev.model.Translate
import uz.mobiuz.mobiservice.dev.network.model.Errors import uz.mobiuz.mobiservice.dev.network.model.Errors
import uz.mobiuz.mobiservice.dev.ui.global.CONSTANTS import uz.mobiuz.mobiservice.dev.ui.global.CONSTANTS
import uz.mobiuz.mobiservice.dev.ui.global.ExitDialog import uz.mobiuz.mobiservice.dev.ui.global.ExitDialog
import uz.mobiuz.mobiservice.dev.ui.global.OfflineBottomSheet import uz.mobiuz.mobiservice.dev.ui.global.OfflineBottomSheet
import uz.mobiuz.mobiservice.dev.ui.global.SenderDialog import uz.mobiuz.mobiservice.dev.ui.global.SenderDialog
import retrofit2.HttpException
import uz.mobiuz.mobiservice.dev.utils.NetworkUtil import uz.mobiuz.mobiservice.dev.utils.NetworkUtil
import java.io.IOException import java.io.IOException
import java.net.ConnectException import java.net.ConnectException
...@@ -145,8 +145,8 @@ fun View.getStatusBarHeight(): Int { ...@@ -145,8 +145,8 @@ fun View.getStatusBarHeight(): Int {
fun String.maskedTextMobi(): String { fun String.maskedTextMobi(): String {
var newText = "" var newText = ""
for (i in this.indices){ for (i in this.indices) {
if(i == 2 || i == 5 || i == 7){ if (i == 2 || i == 5 || i == 7) {
newText += " " newText += " "
} }
newText += this[i] newText += this[i]
...@@ -290,4 +290,20 @@ fun List<Errors>.getMessage(): String { ...@@ -290,4 +290,20 @@ fun List<Errors>.getMessage(): String {
message += "${it.message}\n" message += "${it.message}\n"
} }
return message return message
} }
\ No newline at end of file
fun String.formatCard(): String {
return when (this.length) {
16 -> "${this.substring(0, 4)} ${this.substring(4, 6)}** **** ${this.substring(12, 16)}"
13 -> "${this.substring(0, 4)} ${this.substring(4, 6)}** **** ${this.substring(9, 13)}"
else -> this
}
}
fun String.formatPhone(minus: Boolean = true): String {
return when (this.length) {
12 -> getPhoneMasked(this.substring(this.length - 9, this.length), minus)
9 -> getPhoneMasked(this, minus)
else -> this
}
}
package uz.mobiuz.mobiservice.dev.utils.format
import android.text.Editable
import uz.mobiuz.mobiservice.dev.ui.global.TextWatcherWrapper
class AmountFormat(private val validListener: (Boolean, Long) -> Unit) : TextWatcherWrapper() {
private var lock = false
override fun afterTextChanged(s: Editable) {
if (lock) return
lock = true
val text = s.toString().replace("\\D".toRegex(), "")
s.replace(0, s.length, text)
var i = s.length - 3
while (i > 0 && i < s.length) {
if (s.toString()[i] != ' ') {
s.insert(i, " ")
}
i -= 3
}
lock = false
validListener.invoke(text.matches("^[1-9][0-9]*$".toRegex()), if (text.isNotEmpty()) text.toLong() else 0L)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:id="@+id/paySuccessLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_30sdp">
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/successPayment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/image"
android:layout_width="@dimen/_70sdp"
android:layout_height="@dimen/_70sdp"
android:layout_gravity="center"
android:layout_marginTop="36dp"
android:adjustViewBounds="true"
android:src="@drawable/icon_female"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="26dp"
android:layout_marginTop="20dp"
android:gravity="center"
android:letterSpacing="0.05"
android:text="@string/agr_mobi_uz_payment_success"
android:textColor="@color/agr_black80"
android:textSize="32sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:text="@string/agr_mobi_uz_summa_pay"
android:textColor="@color/agr_grey110"
android:textSize="12sp" />
<TextView
android:id="@+id/etAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:textColor="@color/primary110"
android:textSize="16sp"
android:textStyle="bold"
tools:text="25 000 UZC" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/agr_mobi_uz_summa_phone"
android:textColor="@color/agr_grey110"
android:textSize="12sp" />
<TextView
android:id="@+id/etPhone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:textColor="@color/primary110"
android:textSize="16sp"
android:textStyle="bold"
tools:text="+998 99 055 21 09" />
<TextView
android:id="@+id/tvPanTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/agr_mobi_uz_summa_card_pan"
android:textColor="@color/agr_grey110"
android:textSize="12sp"
android:visibility="gone"
tools:visibility="visible" />
<TextView
android:id="@+id/etCardPan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:textColor="@color/primary110"
android:textSize="16sp"
android:textStyle="bold"
android:visibility="gone"
tools:text="8600 31** **** 88989"
tools:visibility="visible" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/errorPayment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="@dimen/_30sdp"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="@dimen/_70sdp"
android:layout_height="@dimen/_70sdp"
android:layout_gravity="center"
android:layout_marginTop="36dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/agr_female_error"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="26dp"
android:layout_marginTop="20dp"
android:gravity="center"
android:letterSpacing="0.01"
android:text="@string/agr_mobi_uz_payment_error"
android:textColor="@color/agr_black80"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:text="@string/agr_mobi_uz_refresh_time"
android:textColor="@color/agr_grey110"
android:textSize="14sp" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<Button
android:id="@+id/doneButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginHorizontal="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="30dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="40dp"
android:text="@string/agr_mobi_uz_done"
app:layout_constraintBottom_toBottomOf="parent" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/agr_rounded_dialog"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="12dp"
android:contentDescription="@null"
app:srcCompat="@drawable/agr_bg_bottom_sheet_top" />
<TextView
android:id="@+id/txt_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginHorizontal="@dimen/_20sdp"
android:layout_marginTop="@dimen/_20sdp"
android:gravity="center"
android:text="@string/agr_mobi_uz_source_money_transfer"
android:textColor="@color/agr_text_color"
android:textSize="20sp"
android:textStyle="bold" />
<Button
android:id="@+id/btnAnotherCard"
android:layout_width="match_parent"
android:layout_height="@dimen/_44sdp"
android:layout_gravity="center_horizontal"
android:layout_marginHorizontal="@dimen/_20sdp"
android:layout_marginTop="@dimen/_20sdp"
android:background="@drawable/agr_mobi_uz_button_grey"
android:elevation="0dp"
android:text="@string/agr_mobi_uz_pay_with_another_card"
android:textAllCaps="false"
android:textColor="@color/primary100"
android:textSize="15sp"
android:textStyle="bold"
android:translationZ="0dp" />
<Button
android:id="@+id/btnAddCard"
android:layout_width="match_parent"
android:layout_height="@dimen/_44sdp"
android:layout_gravity="center"
android:layout_marginHorizontal="@dimen/_20sdp"
android:layout_marginTop="@dimen/_12sdp"
android:background="@drawable/agr_mobi_uz_button"
android:elevation="0dp"
android:paddingVertical="12dp"
android:text="@string/agr_mobi_uz_add_card"
android:textAllCaps="false"
android:textColor="@color/agr_white"
android:textSize="15sp"
android:textStyle="bold"
android:translationZ="0dp" />
<Space
android:layout_width="match_parent"
android:layout_height="@dimen/_24sdp" />
</LinearLayout>
\ No newline at end of file
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<navigation xmlns:android="http://schemas.android.com/apk/res/android" <navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
app:startDestination="@id/homeFragment" android:id="@+id/nav_graph_home"
android:id="@+id/nav_graph_home"> app:startDestination="@id/homeFragment">
<fragment <fragment
android:id="@+id/homeFragment" android:id="@+id/homeFragment"
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
tools:layout="@layout/fragment_language" /> tools:layout="@layout/fragment_language" />
<fragment <fragment
android:id="@+id/supportFragment" android:id="@+id/supportFragment"
tools:layout="@layout/fragment_support"
android:name="uz.mobiuz.mobiservice.dev.ui.settings.SupportFragment" android:name="uz.mobiuz.mobiservice.dev.ui.settings.SupportFragment"
android:label="SupportFragment" /> android:label="SupportFragment"
tools:layout="@layout/fragment_support" />
<fragment <fragment
android:id="@+id/securityFragment" android:id="@+id/securityFragment"
android:name="uz.mobiuz.mobiservice.dev.ui.settings.security.SecurityFragment" android:name="uz.mobiuz.mobiservice.dev.ui.settings.security.SecurityFragment"
...@@ -40,9 +40,9 @@ ...@@ -40,9 +40,9 @@
<fragment <fragment
android:id="@+id/changePasswordFragment" android:id="@+id/changePasswordFragment"
tools:layout="@layout/fragment_change_password"
android:name="uz.mobiuz.mobiservice.dev.ui.settings.security.ChangePasswordFragment" android:name="uz.mobiuz.mobiservice.dev.ui.settings.security.ChangePasswordFragment"
android:label="CurrentPasswordFragment" /> android:label="CurrentPasswordFragment"
tools:layout="@layout/fragment_change_password" />
<fragment <fragment
android:id="@+id/billingFragment" android:id="@+id/billingFragment"
...@@ -52,9 +52,9 @@ ...@@ -52,9 +52,9 @@
<fragment <fragment
android:id="@+id/pinFragment" android:id="@+id/pinFragment"
tools:layout="@layout/fragment_pin"
android:name="uz.mobiuz.mobiservice.dev.ui.global.PinFragment" android:name="uz.mobiuz.mobiservice.dev.ui.global.PinFragment"
android:label="FullScreenFragment" /> android:label="FullScreenFragment"
tools:layout="@layout/fragment_pin" />
<fragment <fragment
android:id="@+id/motionFragment" android:id="@+id/motionFragment"
android:name="uz.mobiuz.mobiservice.dev.ui.home.MotionFragment" android:name="uz.mobiuz.mobiservice.dev.ui.home.MotionFragment"
...@@ -62,9 +62,9 @@ ...@@ -62,9 +62,9 @@
tools:layout="@layout/fragment_motion" /> tools:layout="@layout/fragment_motion" />
<fragment <fragment
android:id="@+id/cardsListFragment" android:id="@+id/cardsListFragment"
tools:layout="@layout/fragment_cards_list"
android:name="uz.mobiuz.mobiservice.dev.ui.sdk.card.CardsListFragment" android:name="uz.mobiuz.mobiservice.dev.ui.sdk.card.CardsListFragment"
android:label="CardsListFragment" /> android:label="CardsListFragment"
tools:layout="@layout/fragment_cards_list" />
<fragment <fragment
android:id="@+id/monitoringLocalFragment" android:id="@+id/monitoringLocalFragment"
android:name="uz.mobiuz.mobiservice.dev.ui.sdk.MonitoringLocalFragment" android:name="uz.mobiuz.mobiservice.dev.ui.sdk.MonitoringLocalFragment"
...@@ -77,13 +77,19 @@ ...@@ -77,13 +77,19 @@
tools:layout="@layout/fragment_replenish_balance" /> tools:layout="@layout/fragment_replenish_balance" />
<fragment <fragment
android:id="@+id/addCardFragment" android:id="@+id/addCardFragment"
tools:layout="@layout/fragment_add_card"
android:name="uz.mobiuz.mobiservice.dev.ui.sdk.card.AddCardFragment" android:name="uz.mobiuz.mobiservice.dev.ui.sdk.card.AddCardFragment"
android:label="AddCardFragment" /> android:label="AddCardFragment"
tools:layout="@layout/fragment_add_card" />
<fragment <fragment
android:id="@+id/cardConfirmFragment" android:id="@+id/cardConfirmFragment"
tools:layout=""
android:name="uz.mobiuz.mobiservice.dev.ui.sdk.card.CardConfirmFragment" android:name="uz.mobiuz.mobiservice.dev.ui.sdk.card.CardConfirmFragment"
android:label="CardConfirmFragment" /> android:label="CardConfirmFragment"
tools:layout="" />
<fragment
android:id="@+id/paymentSuccessfulFragment"
android:name="uz.mobiuz.mobiservice.dev.ui.sdk.pay.success.PaymentSuccessfulFragment"
android:label="PaymentSuccessfulFragment"
tools:layout="@layout/fragment_payment_successful" />
</navigation> </navigation>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment