package com.base.scanqrclear.bean

import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_PAYPAL

data class PaypalUIBean(
    val me: String? = null,
) : ScanBean(KEY_PAYPAL) {

    companion object {

        fun isPaypalQR(qrCodeValue: String): Boolean {
            return qrCodeValue.startsWith("https://www.paypal.me")
        }

        fun createPaypalUIBean(qrCodeValue: String): PaypalUIBean {
            val me = qrCodeValue.subSequence("https://www.paypal.me/".length, qrCodeValue.length)
            return PaypalUIBean(me.toString())
        }


        //  https://www.paypal.me/www.baidu.com
        //  https://www.paypal.me/koko
        fun PaypalUIBean.createPaypalQrString(): String {
            return "https://www.paypal.me/$me"
        }

    }
}
