diff --git a/components/OTPBindUI.tsx b/components/OTPBindUI.tsx index 1531f47..8ae6d16 100644 --- a/components/OTPBindUI.tsx +++ b/components/OTPBindUI.tsx @@ -87,10 +87,33 @@ export const OTPBindUI: React.FC = ({ {showOtp && ( <> - 验证码已发送至 {state.mobile} + + {state.needPassword + ? `验证码已发送至 ${state.mobile},该账号需输入密码` + : `验证码已发送至 ${state.mobile}`} + {!!state.errorMessage && ( {state.errorMessage} )} + {state.needPassword && ( + <> + Amazon 密码 + { + actions.setPassword(t); + if (state.errorMessage) actions.clearError(); + }} + editable={!isLoading} + /> + + )} 验证码 B{最后一次查单结果
是否成功?} + B -- 失败 --> C[标记: 接口异常/待重试] + B -- 成功 --> D{系统内是否有
匹配记录?} + + D -- 有记录 --> E[按正常流程处理] + D -- 无记录 --> F[查询当天整天流水] + + F --> G{当天是否有
其它成功流水?} + G -- 有流水 --> H[结论: 没付
原因: 流水正常/该单未付] + G -- 无流水 --> I[查询前1-2天流水] + + I --> J{前1-2天是否有
成功流水?} + J -- 有流水 --> H + J -- 无流水 --> K[结论: 判定为异常或死卡
原因: 持续无数据,需检查通道] + + %% 样式定义 + style H fill:#f96,stroke:#333,stroke-width:2px + style K fill:#ff9,stroke:#333,stroke-width:2px + style C fill:#ccc,stroke:#333 \ No newline at end of file diff --git a/docs/流程图.png b/docs/流程图.png new file mode 100644 index 0000000..e7540e4 Binary files /dev/null and b/docs/流程图.png differ diff --git a/测试结果.md b/docs/测试结果.md similarity index 100% rename from 测试结果.md rename to docs/测试结果.md diff --git a/说明.txt b/docs/说明.txt similarity index 100% rename from 说明.txt rename to docs/说明.txt diff --git a/hooks/useOTPBind.ts b/hooks/useOTPBind.ts index 04bb842..2ed3918 100644 --- a/hooks/useOTPBind.ts +++ b/hooks/useOTPBind.ts @@ -12,6 +12,8 @@ export interface OTPBindCallbacks { export interface OTPBindState { mobile: string; otp: string; + password: string; + needPassword: boolean; step: 'mobile' | 'otp' | 'processing'; loading: boolean; otpData: any; @@ -21,6 +23,7 @@ export interface OTPBindState { export interface OTPBindActions { setMobile: (mobile: string) => void; setOtp: (otp: string) => void; + setPassword: (password: string) => void; requestOTP: () => Promise; verifyOTP: () => Promise; resetToMobile: () => void; @@ -39,6 +42,8 @@ export function useOTPBind( ): [OTPBindState, OTPBindActions] { const [mobile, setMobile] = useState(''); const [otp, setOtp] = useState(''); + const [password, setPassword] = useState(''); + const [needPassword, setNeedPassword] = useState(false); const [step, setStep] = useState<'mobile' | 'otp' | 'processing'>('mobile'); const [loading, setLoading] = useState(false); const [otpData, setOtpData] = useState(null); @@ -82,6 +87,7 @@ export function useOTPBind( if (response.success) { setOtpData(response.data); + setNeedPassword(!!response.data?.needPassword); setStep('otp'); setErrorMessage(''); } else { @@ -107,6 +113,12 @@ export function useOTPBind( onError(msg); return; } + if (needPassword && !password.trim()) { + const msg = '请输入 Amazon 账号密码'; + setErrorMessage(msg); + onError(msg); + return; + } setLoading(true); setErrorMessage(''); @@ -117,6 +129,7 @@ export function useOTPBind( const response = await onVerifyOTP(walletType, { mobile, otp, + password: needPassword ? password : undefined, ...additionalParams, ...(otpData || {}), }); @@ -144,11 +157,13 @@ export function useOTPBind( const resetToMobile = () => { setStep('mobile'); setOtp(''); + setPassword(''); + setNeedPassword(false); setErrorMessage(''); }; return [ - { mobile, otp, step, loading, otpData, errorMessage }, - { setMobile, setOtp, requestOTP, verifyOTP, resetToMobile, clearError }, + { mobile, otp, password, needPassword, step, loading, otpData, errorMessage }, + { setMobile, setOtp, setPassword, requestOTP, verifyOTP, resetToMobile, clearError }, ]; } diff --git a/screens/HomeScreen.tsx b/screens/HomeScreen.tsx index 6d90dd2..a626440 100644 --- a/screens/HomeScreen.tsx +++ b/screens/HomeScreen.tsx @@ -801,7 +801,10 @@ export default class HomeScreen extends Component { return this.wrapOtpCall(() => Api.instance.requestOTP(wt, p.mobile, {})); }} onVerifyOTP={async (wt, p) => { - return this.wrapOtpCall(() => Api.instance.verifyOTP(wt, p.mobile, p.otp, { sessionId: p.sessionId })); + return this.wrapOtpCall(() => Api.instance.verifyOTP(wt, p.mobile, p.otp, { + sessionId: p.sessionId, + ...(p.password ? { password: p.password } : {}), + })); }} onSuccess={this.onOtpBindSuccess('showAmazonPayPersonalBind', 'Amazon Pay bound successfully')} onError={() => {}} @@ -1054,10 +1057,6 @@ export default class HomeScreen extends Component { bounces={false} > {groups.map(({ walletType, items }) => { - if (items.length === 1) { - return this.renderWalletItem(items[0]); - } - const expanded = !!expandedBoundWalletGroups[walletType]; const color = WALLET_TYPE_COLORS[walletType] ?? '#888'; @@ -1079,7 +1078,7 @@ export default class HomeScreen extends Component { {formatWalletTypeLabel(walletType)} - {items.length} accounts + {items.length} account{items.length > 1 ? 's' : ''} {expanded ? '▼' : '▶'} diff --git a/screens/TestScreen.tsx b/screens/TestScreen.tsx index 26edf44..e206908 100644 --- a/screens/TestScreen.tsx +++ b/screens/TestScreen.tsx @@ -7,6 +7,7 @@ import { openMobikwikPayToBank, openPhonePePayToBank, openFreechargePayToBank, + openAmazonPayPayToBank, } from 'rnwalletman'; export default function TestScreen() { @@ -51,6 +52,12 @@ export default function TestScreen() { .catch((err: unknown) => Alert.alert('Error', String(err))); }; + const handleAmazonPayPayToBank = () => { + openAmazonPayPayToBank() + .then((result: boolean) => console.log('Amazon Pay To Bank', result ? 'Success' : 'Failed')) + .catch((err: unknown) => Alert.alert('Error', String(err))); + }; + return ( Test Tools @@ -67,6 +74,9 @@ export default function TestScreen() { Freecharge Pay To Bank Test + + Amazon Pay To Bank Test + Echo Test