package mysql import ( "context" "database/sql" "errors" mysqlDriver "github.com/go-sql-driver/mysql" "strings" "time" ) type seedPaymentMethod struct { CountryCode string CountryName string CurrencyCode string PayWay string PayType string MethodName string Rate string SortOrder int } func isDuplicateColumnError(err error) bool { var mysqlErr *mysqlDriver.MySQLError return errors.As(err, &mysqlErr) && mysqlErr.Number == 1060 } // defaultMifaPayLogoURL 按 MiFaPay 的国家、payWay、payType 精确回填 COS logo;key 全部归一化,兼容存量库里的大小写差异。 func defaultMifaPayLogoURL(countryCode string, payWay string, payType string) string { logos := map[string]string{ "AE|card|creditcard": "https://media.haiyihy.com/admin/payment/mifapay/logos/ae/card-creditcard.png", "BD|ewallet|nagad": "https://media.haiyihy.com/admin/payment/mifapay/logos/bd/ewallet-nagad.png", "BD|ewallet|bkash": "https://media.haiyihy.com/admin/payment/mifapay/logos/bd/ewallet-bkash.png", "BH|card|creditcard": "https://media.haiyihy.com/admin/payment/mifapay/logos/bh/card-creditcard.png", "EG|card|creditcard": "https://media.haiyihy.com/admin/payment/mifapay/logos/eg/card-creditcard.png", "EG|ewallet|fawrypay": "https://media.haiyihy.com/admin/payment/mifapay/logos/eg/ewallet-fawrypay.png", "EG|ewallet|meeza": "https://media.haiyihy.com/admin/payment/mifapay/logos/eg/ewallet-meeza.png", "EG|ewallet|opay": "https://media.haiyihy.com/admin/payment/mifapay/logos/eg/ewallet-opay.png", "EG|ewallet|orange": "https://media.haiyihy.com/admin/payment/mifapay/logos/eg/ewallet-orange.png", "EG|ewallet|vodafone": "https://media.haiyihy.com/admin/payment/mifapay/logos/eg/ewallet-vodafone.png", "GLOBAL|banktransfer|unionpay": "https://media.haiyihy.com/admin/payment/mifapay/logos/global/banktransfer-unionpay.png", "GLOBAL|card|creditcard": "https://media.haiyihy.com/admin/payment/mifapay/logos/global/card-creditcard.png", "GLOBAL|ewallet|applepay": "https://media.haiyihy.com/admin/payment/mifapay/logos/global/ewallet-applepay.png", "GLOBAL|ewallet|googlepay": "https://media.haiyihy.com/admin/payment/mifapay/logos/global/ewallet-googlepay.png", "ID|banktransfer|bca": "https://media.haiyihy.com/admin/payment/mifapay/logos/id/banktransfer-bca.png", "ID|banktransfer|bni": "https://media.haiyihy.com/admin/payment/mifapay/logos/id/banktransfer-bni.png", "ID|banktransfer|bri": "https://media.haiyihy.com/admin/payment/mifapay/logos/id/banktransfer-bri.png", "ID|banktransfer|mandiri": "https://media.haiyihy.com/admin/payment/mifapay/logos/id/banktransfer-mandiri.png", "ID|banktransfer|permata": "https://media.haiyihy.com/admin/payment/mifapay/logos/id/banktransfer-permata.png", "ID|banktransfer|qris": "https://media.haiyihy.com/admin/payment/mifapay/logos/id/banktransfer-qris.png", "ID|ewallet|dana": "https://media.haiyihy.com/admin/payment/mifapay/logos/id/ewallet-dana.png", "ID|ewallet|linkaja": "https://media.haiyihy.com/admin/payment/mifapay/logos/id/ewallet-linkaja.png", "ID|ewallet|ovo": "https://media.haiyihy.com/admin/payment/mifapay/logos/id/ewallet-ovo.png", "ID|ewallet|shopeepay": "https://media.haiyihy.com/admin/payment/mifapay/logos/id/ewallet-shopeepay.png", "ID|qr|qris": "https://media.haiyihy.com/admin/payment/mifapay/logos/id/qr-qris.png", "IN|ewallet|bhim": "https://media.haiyihy.com/admin/payment/mifapay/logos/in/ewallet-bhim.png", "IN|ewallet|googlepay": "https://media.haiyihy.com/admin/payment/mifapay/logos/in/ewallet-googlepay.png", "IN|ewallet|mobikwik": "https://media.haiyihy.com/admin/payment/mifapay/logos/in/ewallet-mobikwik.png", "IN|ewallet|paytm": "https://media.haiyihy.com/admin/payment/mifapay/logos/in/ewallet-paytm.png", "IN|ewallet|phonepe": "https://media.haiyihy.com/admin/payment/mifapay/logos/in/ewallet-phonepe.png", "IN|ewallet|upi": "https://media.haiyihy.com/admin/payment/mifapay/logos/in/ewallet-upi.png", "KW|card|kent": "https://media.haiyihy.com/admin/payment/mifapay/logos/kw/card-kent.png", "KW|card|knet": "https://media.haiyihy.com/admin/payment/mifapay/logos/kw/card-knet.png", "MY|banktransfer|fpx": "https://media.haiyihy.com/admin/payment/mifapay/logos/my/banktransfer-fpx.png", "MY|ewallet|tng": "https://media.haiyihy.com/admin/payment/mifapay/logos/my/ewallet-tng.png", "OM|card|creditcard": "https://media.haiyihy.com/admin/payment/mifapay/logos/om/card-creditcard.png", "PH|banktransfer|qrph": "https://media.haiyihy.com/admin/payment/mifapay/logos/ph/banktransfer-qrph.png", "PH|ewallet|gcash": "https://media.haiyihy.com/admin/payment/mifapay/logos/ph/ewallet-gcash.png", "PH|ewallet|paymaya": "https://media.haiyihy.com/admin/payment/mifapay/logos/ph/ewallet-paymaya.png", "PH|qr|qrph": "https://media.haiyihy.com/admin/payment/mifapay/logos/ph/qr-qrph.png", "PK|ewallet|easypaisa": "https://media.haiyihy.com/admin/payment/mifapay/logos/pk/ewallet-easypaisa.png", "PK|ewallet|jazzcash": "https://media.haiyihy.com/admin/payment/mifapay/logos/pk/ewallet-jazzcash.png", "QA|card|creditcard": "https://media.haiyihy.com/admin/payment/mifapay/logos/qa/card-creditcard.png", "SA|card|mada": "https://media.haiyihy.com/admin/payment/mifapay/logos/sa/card-mada.png", "SA|ewallet|applepay": "https://media.haiyihy.com/admin/payment/mifapay/logos/sa/ewallet-applepay.png", "SA|ewallet|stcpay": "https://media.haiyihy.com/admin/payment/mifapay/logos/sa/ewallet-stcpay.png", "TH|banktransfer|promptpay": "https://media.haiyihy.com/admin/payment/mifapay/logos/th/banktransfer-promptpay.png", "TH|ewallet|truemoney": "https://media.haiyihy.com/admin/payment/mifapay/logos/th/ewallet-truemoney.png", "VN|banktransfer|vn_banktransfer": "https://media.haiyihy.com/admin/payment/mifapay/logos/vn/banktransfer-vn-banktransfer.png", "VN|qr|vietqr": "https://media.haiyihy.com/admin/payment/mifapay/logos/vn/qr-vietqr.png", } key := strings.ToUpper(strings.TrimSpace(countryCode)) + "|" + strings.ToLower(strings.TrimSpace(payWay)) + "|" + strings.ToLower(strings.TrimSpace(payType)) return logos[key] } func seedThirdPartyPaymentDefaults(ctx context.Context, db *sql.DB) error { nowMS := time.Now().UnixMilli() if _, err := db.ExecContext(ctx, ` INSERT INTO third_party_payment_channels ( app_code, provider_code, provider_name, status, sort_order, created_at_ms, updated_at_ms ) VALUES ('lalu', 'mifapay', 'MiFaPay', 'active', 10, ?, ?) ON DUPLICATE KEY UPDATE provider_name = VALUES(provider_name), status = VALUES(status), sort_order = VALUES(sort_order), updated_at_ms = VALUES(updated_at_ms)`, nowMS, nowMS); err != nil { return err } if _, err := db.ExecContext(ctx, ` INSERT INTO third_party_payment_channels ( app_code, provider_code, provider_name, status, sort_order, created_at_ms, updated_at_ms ) VALUES ('lalu', 'v5pay', 'V5Pay', 'active', 20, ?, ?) ON DUPLICATE KEY UPDATE provider_name = VALUES(provider_name), status = VALUES(status), sort_order = VALUES(sort_order), updated_at_ms = VALUES(updated_at_ms)`, nowMS, nowMS); err != nil { return err } methods := []seedPaymentMethod{ {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "BankTransfer", PayType: "BCA", MethodName: "BCA Bank", Rate: "1.00000000", SortOrder: 110}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "BankTransfer", PayType: "BNI", MethodName: "BNI Bank", Rate: "1.00000000", SortOrder: 120}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "BankTransfer", PayType: "BRI", MethodName: "BRI Bank", Rate: "1.00000000", SortOrder: 130}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "BankTransfer", PayType: "Mandiri", MethodName: "Mandiri Bank", Rate: "1.00000000", SortOrder: 140}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "BankTransfer", PayType: "Permata", MethodName: "Permata Bank", Rate: "1.00000000", SortOrder: 150}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "Ewallet", PayType: "DANA", MethodName: "DANA", Rate: "1.00000000", SortOrder: 160}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "Ewallet", PayType: "LinkAja", MethodName: "LinkAja", Rate: "1.00000000", SortOrder: 170}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "Ewallet", PayType: "OVO", MethodName: "OVO", Rate: "1.00000000", SortOrder: 180}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "Ewallet", PayType: "ShopeePay", MethodName: "ShopeePay", Rate: "1.00000000", SortOrder: 190}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "QR", PayType: "QRIS", MethodName: "QRIS", Rate: "1.00000000", SortOrder: 200}, {CountryCode: "VN", CountryName: "Vietnam", CurrencyCode: "VND", PayWay: "BankTransfer", PayType: "VN_BankTransfer", MethodName: "Vietnam Bank Transfer", Rate: "1.00000000", SortOrder: 210}, {CountryCode: "VN", CountryName: "Vietnam", CurrencyCode: "VND", PayWay: "QR", PayType: "VietQR", MethodName: "VietQR", Rate: "1.00000000", SortOrder: 220}, {CountryCode: "BH", CountryName: "Bahrain", CurrencyCode: "BHD", PayWay: "Card", PayType: "CreditCard", MethodName: "Bahrain Credit Card", Rate: "1.00000000", SortOrder: 310}, {CountryCode: "QA", CountryName: "Qatar", CurrencyCode: "QAR", PayWay: "Card", PayType: "CreditCard", MethodName: "Qatar Credit Card", Rate: "1.00000000", SortOrder: 410}, {CountryCode: "OM", CountryName: "Oman", CurrencyCode: "OMR", PayWay: "Card", PayType: "CreditCard", MethodName: "Oman Credit Card", Rate: "1.00000000", SortOrder: 510}, {CountryCode: "AE", CountryName: "United Arab Emirates", CurrencyCode: "AED", PayWay: "Card", PayType: "CreditCard", MethodName: "UAE Credit Card", Rate: "1.00000000", SortOrder: 610}, {CountryCode: "KW", CountryName: "Kuwait", CurrencyCode: "KWD", PayWay: "Card", PayType: "Knet", MethodName: "KNET", Rate: "1.00000000", SortOrder: 710}, {CountryCode: "SA", CountryName: "Saudi Arabia", CurrencyCode: "SAR", PayWay: "Card", PayType: "MADA", MethodName: "MADA", Rate: "1.00000000", SortOrder: 810}, {CountryCode: "SA", CountryName: "Saudi Arabia", CurrencyCode: "SAR", PayWay: "Ewallet", PayType: "ApplePay", MethodName: "ApplePay", Rate: "1.00000000", SortOrder: 820}, {CountryCode: "SA", CountryName: "Saudi Arabia", CurrencyCode: "SAR", PayWay: "Ewallet", PayType: "STCPay", MethodName: "STCPay", Rate: "1.00000000", SortOrder: 830}, {CountryCode: "IN", CountryName: "India", CurrencyCode: "INR", PayWay: "Ewallet", PayType: "BHIM", MethodName: "BHIM", Rate: "1.00000000", SortOrder: 910}, {CountryCode: "IN", CountryName: "India", CurrencyCode: "INR", PayWay: "Ewallet", PayType: "GooglePay", MethodName: "GooglePay", Rate: "1.00000000", SortOrder: 920}, {CountryCode: "IN", CountryName: "India", CurrencyCode: "INR", PayWay: "Ewallet", PayType: "Mobikwik", MethodName: "Mobikwik", Rate: "1.00000000", SortOrder: 930}, {CountryCode: "IN", CountryName: "India", CurrencyCode: "INR", PayWay: "Ewallet", PayType: "Paytm", MethodName: "Paytm", Rate: "1.00000000", SortOrder: 940}, {CountryCode: "IN", CountryName: "India", CurrencyCode: "INR", PayWay: "Ewallet", PayType: "PhonePe", MethodName: "PhonePe", Rate: "1.00000000", SortOrder: 950}, {CountryCode: "IN", CountryName: "India", CurrencyCode: "INR", PayWay: "Ewallet", PayType: "UPI", MethodName: "UPI", Rate: "1.00000000", SortOrder: 960}, {CountryCode: "BD", CountryName: "Bangladesh", CurrencyCode: "BDT", PayWay: "Ewallet", PayType: "bKash", MethodName: "bKash", Rate: "1.00000000", SortOrder: 1010}, {CountryCode: "PK", CountryName: "Pakistan", CurrencyCode: "PKR", PayWay: "Ewallet", PayType: "Easypaisa", MethodName: "Easypaisa", Rate: "1.00000000", SortOrder: 1110}, {CountryCode: "PK", CountryName: "Pakistan", CurrencyCode: "PKR", PayWay: "Ewallet", PayType: "JazzCash", MethodName: "JazzCash", Rate: "1.00000000", SortOrder: 1120}, {CountryCode: "EG", CountryName: "Egypt", CurrencyCode: "EGP", PayWay: "Ewallet", PayType: "FawryPay", MethodName: "FawryPay", Rate: "1.00000000", SortOrder: 1210}, {CountryCode: "EG", CountryName: "Egypt", CurrencyCode: "EGP", PayWay: "Ewallet", PayType: "Meeza", MethodName: "Meeza", Rate: "1.00000000", SortOrder: 1220}, {CountryCode: "EG", CountryName: "Egypt", CurrencyCode: "EGP", PayWay: "Ewallet", PayType: "Orange", MethodName: "Orange", Rate: "1.00000000", SortOrder: 1230}, {CountryCode: "EG", CountryName: "Egypt", CurrencyCode: "EGP", PayWay: "Ewallet", PayType: "Vodafone", MethodName: "Vodafone", Rate: "1.00000000", SortOrder: 1240}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "Ewallet", PayType: "Gcash", MethodName: "GCash", Rate: "1.00000000", SortOrder: 1310}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "Ewallet", PayType: "PayMaya", MethodName: "PayMaya", Rate: "1.00000000", SortOrder: 1320}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "QR", PayType: "QRPH", MethodName: "QRPH", Rate: "1.00000000", SortOrder: 1330}, } for _, method := range methods { rate := strings.TrimSpace(method.Rate) if rate == "" { rate = "1.00000000" } if _, err := db.ExecContext(ctx, ` INSERT INTO third_party_payment_methods ( app_code, provider_code, country_code, country_name, currency_code, pay_way, pay_type, method_name, logo_url, status, usd_to_currency_rate, sort_order, created_at_ms, updated_at_ms ) VALUES ('lalu', 'mifapay', ?, ?, ?, ?, ?, ?, ?, 'active', ?, ?, ?, ?) ON DUPLICATE KEY UPDATE country_name = VALUES(country_name), currency_code = VALUES(currency_code), method_name = VALUES(method_name), logo_url = CASE WHEN logo_url = '' THEN VALUES(logo_url) WHEN logo_url LIKE 'https://placehold.co/%' THEN VALUES(logo_url) WHEN logo_url LIKE '%/image-preview' THEN VALUES(logo_url) ELSE logo_url END, sort_order = VALUES(sort_order), usd_to_currency_rate = IF(usd_to_currency_rate <= 0, VALUES(usd_to_currency_rate), usd_to_currency_rate), updated_at_ms = VALUES(updated_at_ms)`, strings.ToUpper(method.CountryCode), method.CountryName, strings.ToUpper(method.CurrencyCode), method.PayWay, method.PayType, method.MethodName, defaultMifaPayLogoURL(method.CountryCode, method.PayWay, method.PayType), rate, method.SortOrder, nowMS, nowMS, ); err != nil { return err } } v5Methods := []seedPaymentMethod{ {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "BankTransfer", PayType: "UB_ONLINE", MethodName: "UnionBank Online", Rate: "1.00000000", SortOrder: 2010}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "BankTransfer", PayType: "INSTAPAY", MethodName: "InstaPay", Rate: "1.00000000", SortOrder: 2020}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "BankTransfer", PayType: "PESONET", MethodName: "PESONet", Rate: "1.00000000", SortOrder: 2030}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "Ewallet", PayType: "GCASH_ONLINE", MethodName: "GCash Online", Rate: "1.00000000", SortOrder: 2040}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "Ewallet", PayType: "COINS_ONLINE", MethodName: "Coins.ph Online", Rate: "1.00000000", SortOrder: 2050}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "BankTransfer", PayType: "BPI_ONLINE", MethodName: "BPI Online", Rate: "1.00000000", SortOrder: 2060}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "BankTransfer", PayType: "RCBC_ONLINE", MethodName: "RCBC Online", Rate: "1.00000000", SortOrder: 2070}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "BankTransfer", PayType: "UCPB_ONLINE", MethodName: "UCPB Online", Rate: "1.00000000", SortOrder: 2080}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "BankTransfer", PayType: "ROBINSONSBANK_ONLINE", MethodName: "Robinsons Bank Online", Rate: "1.00000000", SortOrder: 2090}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "BankTransfer", PayType: "PSBANK_ONLINE", MethodName: "PSBank Online", Rate: "1.00000000", SortOrder: 2100}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "BankTransfer", PayType: "METROBANK_ONLINE", MethodName: "Metrobank Online", Rate: "1.00000000", SortOrder: 2110}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "BankTransfer", PayType: "LANDBANK_ONLINE", MethodName: "Landbank Online", Rate: "1.00000000", SortOrder: 2120}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "BankTransfer", PayType: "CHINABANK_ONLINE", MethodName: "China Bank Online", Rate: "1.00000000", SortOrder: 2130}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "BankTransfer", PayType: "BDO_ONLINE", MethodName: "BDO Online", Rate: "1.00000000", SortOrder: 2140}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "BankTransfer", PayType: "BOC_ONLINE", MethodName: "Bank of Commerce Online", Rate: "1.00000000", SortOrder: 2150}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "Ewallet", PayType: "GRABPAY_ONLINE", MethodName: "GrabPay Online", Rate: "1.00000000", SortOrder: 2160}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "QR", PayType: "INSTAPAY_QR", MethodName: "InstaPay QR", Rate: "1.00000000", SortOrder: 2170}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "QR", PayType: "ALIPAY_QR", MethodName: "Alipay QR", Rate: "1.00000000", SortOrder: 2180}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "Ewallet", PayType: "ALIPAY_PLUS", MethodName: "Alipay+", Rate: "1.00000000", SortOrder: 2190}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "Billing", PayType: "BILL", MethodName: "Bills Payment", Rate: "1.00000000", SortOrder: 2200}, {CountryCode: "PH", CountryName: "Philippines", CurrencyCode: "PHP", PayWay: "QR", PayType: "QRPH_GCASH", MethodName: "QRPh GCash", Rate: "1.00000000", SortOrder: 2210}, {CountryCode: "SA", CountryName: "Saudi Arabia", CurrencyCode: "SAR", PayWay: "Ewallet", PayType: "STCPAY", MethodName: "STC Pay", Rate: "1.00000000", SortOrder: 2310}, {CountryCode: "SA", CountryName: "Saudi Arabia", CurrencyCode: "SAR", PayWay: "Card", PayType: "MADA", MethodName: "MADA", Rate: "1.00000000", SortOrder: 2320}, {CountryCode: "SA", CountryName: "Saudi Arabia", CurrencyCode: "SAR", PayWay: "Ewallet", PayType: "APPLEPAY", MethodName: "Apple Pay", Rate: "1.00000000", SortOrder: 2330}, {CountryCode: "EG", CountryName: "Egypt", CurrencyCode: "EGP", PayWay: "Card", PayType: "CARD", MethodName: "Egypt Card", Rate: "1.00000000", SortOrder: 2410}, {CountryCode: "AE", CountryName: "United Arab Emirates", CurrencyCode: "AED", PayWay: "Card", PayType: "CARD", MethodName: "UAE Card", Rate: "1.00000000", SortOrder: 2510}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "BankTransfer", PayType: "BNI_VA", MethodName: "BNI Virtual Account", Rate: "1.00000000", SortOrder: 2610}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "BankTransfer", PayType: "BRI_VA", MethodName: "BRI Virtual Account", Rate: "1.00000000", SortOrder: 2620}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "BankTransfer", PayType: "CIMB_VA", MethodName: "CIMB Virtual Account", Rate: "1.00000000", SortOrder: 2630}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "BankTransfer", PayType: "MANDIRI_VA", MethodName: "Mandiri Virtual Account", Rate: "1.00000000", SortOrder: 2640}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "BankTransfer", PayType: "MAYBANK_VA", MethodName: "Maybank Virtual Account", Rate: "1.00000000", SortOrder: 2650}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "QR", PayType: "NOBU_BANK_QRIS", MethodName: "Nobu Bank QRIS", Rate: "1.00000000", SortOrder: 2660}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "Ewallet", PayType: "OVO", MethodName: "OVO", Rate: "1.00000000", SortOrder: 2670}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "BankTransfer", PayType: "PERMATA_VA", MethodName: "Permata Virtual Account", Rate: "1.00000000", SortOrder: 2680}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "Ewallet", PayType: "SHOPEEPAY_JUMPAPP", MethodName: "ShopeePay Jump App", Rate: "1.00000000", SortOrder: 2690}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "Ewallet", PayType: "GOPAY", MethodName: "GoPay", Rate: "1.00000000", SortOrder: 2700}, {CountryCode: "ID", CountryName: "Indonesia", CurrencyCode: "IDR", PayWay: "Ewallet", PayType: "ALIPAY_CN_ALIPAYPLUS", MethodName: "Alipay+ Indonesia", Rate: "1.00000000", SortOrder: 2710}, {CountryCode: "IN", CountryName: "India", CurrencyCode: "INR", PayWay: "BankTransfer", PayType: "BANK_ONLINE", MethodName: "Bank Online", Rate: "1.00000000", SortOrder: 2810}, {CountryCode: "IN", CountryName: "India", CurrencyCode: "INR", PayWay: "UPI", PayType: "UPI", MethodName: "UPI", Rate: "1.00000000", SortOrder: 2820}, {CountryCode: "IN", CountryName: "India", CurrencyCode: "INR", PayWay: "BankTransfer", PayType: "ONLINE_BANKING", MethodName: "Online Banking", Rate: "1.00000000", SortOrder: 2830}, {CountryCode: "PK", CountryName: "Pakistan", CurrencyCode: "PKR", PayWay: "Ewallet", PayType: "EASYPAISA", MethodName: "Easypaisa", Rate: "1.00000000", SortOrder: 2910}, {CountryCode: "PK", CountryName: "Pakistan", CurrencyCode: "PKR", PayWay: "Ewallet", PayType: "JAZZCASH", MethodName: "JazzCash", Rate: "1.00000000", SortOrder: 2920}, {CountryCode: "PK", CountryName: "Pakistan", CurrencyCode: "PKR", PayWay: "BankTransfer", PayType: "ALFA", MethodName: "Bank Alfalah", Rate: "1.00000000", SortOrder: 2930}, {CountryCode: "PK", CountryName: "Pakistan", CurrencyCode: "PKR", PayWay: "Ewallet", PayType: "HBL_KONNECT", MethodName: "HBL Konnect", Rate: "1.00000000", SortOrder: 2940}, {CountryCode: "PK", CountryName: "Pakistan", CurrencyCode: "PKR", PayWay: "Billing", PayType: "BILL_PK", MethodName: "Pakistan Bill Payment", Rate: "1.00000000", SortOrder: 2950}, } for _, method := range v5Methods { rate := strings.TrimSpace(method.Rate) if rate == "" { rate = "1.00000000" } if _, err := db.ExecContext(ctx, ` INSERT INTO third_party_payment_methods ( app_code, provider_code, country_code, country_name, currency_code, pay_way, pay_type, method_name, logo_url, status, usd_to_currency_rate, sort_order, created_at_ms, updated_at_ms ) VALUES ('lalu', 'v5pay', ?, ?, ?, ?, ?, ?, '', 'active', ?, ?, ?, ?) ON DUPLICATE KEY UPDATE country_name = VALUES(country_name), currency_code = VALUES(currency_code), method_name = VALUES(method_name), sort_order = VALUES(sort_order), usd_to_currency_rate = IF(usd_to_currency_rate <= 0, VALUES(usd_to_currency_rate), usd_to_currency_rate), updated_at_ms = VALUES(updated_at_ms)`, strings.ToUpper(method.CountryCode), method.CountryName, strings.ToUpper(method.CurrencyCode), method.PayWay, method.PayType, method.MethodName, rate, method.SortOrder, nowMS, nowMS, ); err != nil { return err } } return nil }