react-native-fpay 0.3.5 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/lib/module/FountainPayProvider.js +108 -18
  2. package/lib/module/FountainPayProvider.js.map +1 -1
  3. package/lib/module/core/api/client.js +13 -1
  4. package/lib/module/core/api/client.js.map +1 -1
  5. package/lib/module/core/api/index.js +66 -24
  6. package/lib/module/core/api/index.js.map +1 -1
  7. package/lib/module/engine/BLEReceiverService.js.map +1 -1
  8. package/lib/module/engine/BLESenderService.js.map +1 -1
  9. package/lib/module/engine/FPEngine.js +164 -43
  10. package/lib/module/engine/FPEngine.js.map +1 -1
  11. package/lib/module/engine/NearbyUsersService.js +1 -1
  12. package/lib/module/engine/NearbyUsersService.js.map +1 -1
  13. package/lib/module/index.js +1 -0
  14. package/lib/module/index.js.map +1 -1
  15. package/lib/module/store/FPStore.js +155 -0
  16. package/lib/module/store/FPStore.js.map +1 -0
  17. package/lib/module/ui/components/AnimatedDots.js +3 -3
  18. package/lib/module/ui/components/AnimatedDots.js.map +1 -1
  19. package/lib/module/ui/components/ConfirmScreen.js +137 -123
  20. package/lib/module/ui/components/ConfirmScreen.js.map +1 -1
  21. package/lib/module/ui/components/FPButton.js.map +1 -1
  22. package/lib/module/ui/components/LoadingAnimation/InLoading.js +3 -3
  23. package/lib/module/ui/components/LoadingAnimation/InLoading.js.map +1 -1
  24. package/lib/module/ui/components/LoadingAnimation/index.js +3 -3
  25. package/lib/module/ui/components/LoadingAnimation/index.js.map +1 -1
  26. package/lib/module/ui/components/OtpInput/OTPInputView.js +11 -11
  27. package/lib/module/ui/components/OtpInput/OTPInputView.js.map +1 -1
  28. package/lib/module/ui/components/OtpInput/Styles.js +1 -1
  29. package/lib/module/ui/components/OtpInput/helpers/codeToArray.js +1 -1
  30. package/lib/module/ui/components/OtpInput/helpers/device.js.map +1 -1
  31. package/lib/module/ui/components/OtpInput/helpers/styles.js.map +1 -1
  32. package/lib/module/ui/components/OtpInput/index.js +3 -1
  33. package/lib/module/ui/components/OtpInput/index.js.map +1 -1
  34. package/lib/module/ui/components/PulseAnimation.js +2 -2
  35. package/lib/module/ui/components/PulseAnimation.js.map +1 -1
  36. package/lib/module/ui/modals/FPPaymentRequestModal.js +8 -7
  37. package/lib/module/ui/modals/FPPaymentRequestModal.js.map +1 -1
  38. package/lib/module/ui/modals/FPShell.js +2 -0
  39. package/lib/module/ui/modals/FPShell.js.map +1 -1
  40. package/lib/module/ui/screens/ReceiveScreen.js +8 -9
  41. package/lib/module/ui/screens/ReceiveScreen.js.map +1 -1
  42. package/lib/module/ui/screens/SendScreen.js +43 -94
  43. package/lib/module/ui/screens/SendScreen.js.map +1 -1
  44. package/lib/module/ui/screens/styles.js +15 -3
  45. package/lib/module/ui/screens/styles.js.map +1 -1
  46. package/lib/module/ui/screens/sub/receivePayment/Nfc/index.js +4 -4
  47. package/lib/module/ui/screens/sub/receivePayment/Nfc/index.js.map +1 -1
  48. package/lib/module/ui/screens/sub/receivePayment/Qr/index.js +5 -5
  49. package/lib/module/ui/screens/sub/receivePayment/Qr/index.js.map +1 -1
  50. package/lib/module/ui/screens/sub/receivePayment/Transfer/index.js +10 -11
  51. package/lib/module/ui/screens/sub/receivePayment/Transfer/index.js.map +1 -1
  52. package/lib/module/ui/screens/sub/sendPayment/BluetoothSubScreen.js +31 -8
  53. package/lib/module/ui/screens/sub/sendPayment/BluetoothSubScreen.js.map +1 -1
  54. package/lib/module/ui/screens/sub/sendPayment/NFCSubScreen.js +12 -8
  55. package/lib/module/ui/screens/sub/sendPayment/NFCSubScreen.js.map +1 -1
  56. package/lib/module/ui/screens/sub/sendPayment/NQRSubScreen.js +17 -5
  57. package/lib/module/ui/screens/sub/sendPayment/NQRSubScreen.js.map +1 -1
  58. package/lib/module/ui/screens/sub/sendPayment/ProximitySubScreen.js +67 -35
  59. package/lib/module/ui/screens/sub/sendPayment/ProximitySubScreen.js.map +1 -1
  60. package/lib/module/ui/screens/sub/sendPayment/TransferSubScreen.js +110 -34
  61. package/lib/module/ui/screens/sub/sendPayment/TransferSubScreen.js.map +1 -1
  62. package/lib/module/ui/theme/index.js.map +1 -1
  63. package/lib/typescript/src/FountainPayProvider.d.ts +1 -1
  64. package/lib/typescript/src/FountainPayProvider.d.ts.map +1 -1
  65. package/lib/typescript/src/core/api/client.d.ts.map +1 -1
  66. package/lib/typescript/src/core/api/index.d.ts +42 -26
  67. package/lib/typescript/src/core/api/index.d.ts.map +1 -1
  68. package/lib/typescript/src/core/types/index.d.ts +53 -28
  69. package/lib/typescript/src/core/types/index.d.ts.map +1 -1
  70. package/lib/typescript/src/engine/BLEReceiverService.d.ts +2 -0
  71. package/lib/typescript/src/engine/BLEReceiverService.d.ts.map +1 -1
  72. package/lib/typescript/src/engine/BLESenderService.d.ts.map +1 -1
  73. package/lib/typescript/src/engine/FPEngine.d.ts +5 -3
  74. package/lib/typescript/src/engine/FPEngine.d.ts.map +1 -1
  75. package/lib/typescript/src/engine/useIsForeground.d.ts.map +1 -1
  76. package/lib/typescript/src/index.d.ts +2 -1
  77. package/lib/typescript/src/index.d.ts.map +1 -1
  78. package/lib/typescript/src/store/FPStore.d.ts +60 -0
  79. package/lib/typescript/src/store/FPStore.d.ts.map +1 -0
  80. package/lib/typescript/src/ui/components/AnimatedDots.d.ts.map +1 -1
  81. package/lib/typescript/src/ui/components/ConfirmScreen.d.ts +5 -5
  82. package/lib/typescript/src/ui/components/ConfirmScreen.d.ts.map +1 -1
  83. package/lib/typescript/src/ui/components/FPButton.d.ts +1 -1
  84. package/lib/typescript/src/ui/components/FPButton.d.ts.map +1 -1
  85. package/lib/typescript/src/ui/components/LoadingAnimation/InLoading.d.ts.map +1 -1
  86. package/lib/typescript/src/ui/components/LoadingAnimation/index.d.ts.map +1 -1
  87. package/lib/typescript/src/ui/components/OtpInput/OTPInputView.d.ts.map +1 -1
  88. package/lib/typescript/src/ui/components/OtpInput/helpers/codeToArray.d.ts.map +1 -1
  89. package/lib/typescript/src/ui/components/OtpInput/helpers/device.d.ts.map +1 -1
  90. package/lib/typescript/src/ui/components/OtpInput/helpers/styles.d.ts.map +1 -1
  91. package/lib/typescript/src/ui/components/OtpInput/helpers/types.d.ts +1 -2
  92. package/lib/typescript/src/ui/components/OtpInput/helpers/types.d.ts.map +1 -1
  93. package/lib/typescript/src/ui/components/OtpInput/index.d.ts +3 -1
  94. package/lib/typescript/src/ui/components/OtpInput/index.d.ts.map +1 -1
  95. package/lib/typescript/src/ui/components/PulseAnimation.d.ts.map +1 -1
  96. package/lib/typescript/src/ui/modals/FPPaymentRequestModal.d.ts.map +1 -1
  97. package/lib/typescript/src/ui/modals/FPShell.d.ts.map +1 -1
  98. package/lib/typescript/src/ui/screens/ReceiveScreen.d.ts +1 -1
  99. package/lib/typescript/src/ui/screens/ReceiveScreen.d.ts.map +1 -1
  100. package/lib/typescript/src/ui/screens/SendScreen.d.ts +1 -1
  101. package/lib/typescript/src/ui/screens/SendScreen.d.ts.map +1 -1
  102. package/lib/typescript/src/ui/screens/styles.d.ts +197 -0
  103. package/lib/typescript/src/ui/screens/styles.d.ts.map +1 -1
  104. package/lib/typescript/src/ui/screens/sub/receivePayment/Nfc/index.d.ts.map +1 -1
  105. package/lib/typescript/src/ui/screens/sub/receivePayment/Qr/index.d.ts.map +1 -1
  106. package/lib/typescript/src/ui/screens/sub/receivePayment/Transfer/index.d.ts.map +1 -1
  107. package/lib/typescript/src/ui/screens/sub/sendPayment/BluetoothSubScreen.d.ts.map +1 -1
  108. package/lib/typescript/src/ui/screens/sub/sendPayment/NFCSubScreen.d.ts +1 -1
  109. package/lib/typescript/src/ui/screens/sub/sendPayment/NFCSubScreen.d.ts.map +1 -1
  110. package/lib/typescript/src/ui/screens/sub/sendPayment/NQRSubScreen.d.ts +1 -1
  111. package/lib/typescript/src/ui/screens/sub/sendPayment/NQRSubScreen.d.ts.map +1 -1
  112. package/lib/typescript/src/ui/screens/sub/sendPayment/ProximitySubScreen.d.ts +1 -1
  113. package/lib/typescript/src/ui/screens/sub/sendPayment/ProximitySubScreen.d.ts.map +1 -1
  114. package/lib/typescript/src/ui/screens/sub/sendPayment/TransferSubScreen.d.ts +1 -1
  115. package/lib/typescript/src/ui/screens/sub/sendPayment/TransferSubScreen.d.ts.map +1 -1
  116. package/lib/typescript/src/ui/theme/index.d.ts.map +1 -1
  117. package/package.json +4 -4
  118. package/src/FountainPayProvider.tsx +163 -24
  119. package/src/core/api/client.ts +26 -4
  120. package/src/core/api/index.ts +170 -49
  121. package/src/core/types/index.ts +81 -48
  122. package/src/engine/BLEReceiverService.ts +86 -28
  123. package/src/engine/BLESenderService.ts +133 -69
  124. package/src/engine/FPEngine.ts +316 -97
  125. package/src/engine/NearbyUsersService.ts +6 -6
  126. package/src/engine/useIsForeground.ts +12 -12
  127. package/src/index.ts +10 -4
  128. package/src/store/FPStore.ts +216 -0
  129. package/src/ui/components/AnimatedDots.tsx +4 -5
  130. package/src/ui/components/ConfirmScreen.tsx +182 -169
  131. package/src/ui/components/FPButton.tsx +50 -9
  132. package/src/ui/components/LoadingAnimation/InLoading.tsx +23 -27
  133. package/src/ui/components/LoadingAnimation/index.tsx +3 -7
  134. package/src/ui/components/OtpInput/OTPInputView.tsx +254 -205
  135. package/src/ui/components/OtpInput/Styles.ts +1 -1
  136. package/src/ui/components/OtpInput/helpers/codeToArray.ts +2 -2
  137. package/src/ui/components/OtpInput/helpers/device.ts +4 -3
  138. package/src/ui/components/OtpInput/helpers/styles.ts +13 -14
  139. package/src/ui/components/OtpInput/helpers/types.ts +83 -79
  140. package/src/ui/components/OtpInput/index.tsx +18 -15
  141. package/src/ui/components/PulseAnimation.tsx +3 -5
  142. package/src/ui/modals/FPPaymentRequestModal.tsx +111 -28
  143. package/src/ui/modals/FPShell.tsx +60 -34
  144. package/src/ui/screens/ReceiveScreen.tsx +245 -84
  145. package/src/ui/screens/SendScreen.tsx +419 -167
  146. package/src/ui/screens/styles.ts +17 -5
  147. package/src/ui/screens/sub/receivePayment/Nfc/index.tsx +17 -25
  148. package/src/ui/screens/sub/receivePayment/Qr/index.tsx +21 -20
  149. package/src/ui/screens/sub/receivePayment/Transfer/index.tsx +34 -28
  150. package/src/ui/screens/sub/sendPayment/BluetoothSubScreen.tsx +135 -67
  151. package/src/ui/screens/sub/sendPayment/NFCSubScreen.tsx +188 -112
  152. package/src/ui/screens/sub/sendPayment/NQRSubScreen.tsx +102 -69
  153. package/src/ui/screens/sub/sendPayment/ProximitySubScreen.tsx +225 -99
  154. package/src/ui/screens/sub/sendPayment/TransferSubScreen.tsx +209 -89
  155. package/src/ui/theme/index.ts +14 -2
@@ -20,13 +20,22 @@ import Ionicons from 'react-native-vector-icons/Ionicons';
20
20
  import { transferAPI } from '../../../../core/api';
21
21
  import { FPButton } from '../../../components/FPButton';
22
22
  import { C, R, S, F, shadow } from '../../../theme';
23
- import type { FPCurrency, FPError, FPSendPaymentRequest, FPTransaction, FintechDevice, Props } from '../../../../core/types';
23
+ import type {
24
+ FPCurrency,
25
+ FPError,
26
+ FPSendPaymentRequest,
27
+ FPSendWalletPaymentRequest,
28
+ FPTransaction,
29
+ FPUserInfo,
30
+ FintechDevice,
31
+ Props,
32
+ } from '../../../../core/types';
24
33
 
25
34
  import { FPEngine } from '../../../../engine/FPEngine';
26
35
 
27
36
  import { PulseAnimation } from '../../../components/PulseAnimation';
28
37
  import InLoading from '../../../components/LoadingAnimation/InLoading';
29
-
38
+ import { getFPStore } from '../../../../store/FPStore';
30
39
 
31
40
  const Container = styled(View)`
32
41
  flex: 1;
@@ -158,55 +167,100 @@ const BluetoothIconContainer = styled(View)`
158
167
  // ── SVG Icons — your originals, unchanged ────────────────────────────────────
159
168
 
160
169
  const BluetoothIcon = ({ color = '#111', size = 22 }) => (
161
- <Svg width={size} height={size} strokeWidth="0.9" viewBox="0 0 24 24" fill="none">
162
- <Path d="M6 19.0007C3.57111 17.1763 2 14.2716 2 11C2 5.47715 6.47715 1 12 1C17.5228 1 22 5.47715 22 11C22 14.2716 20.4289 17.1763 18 19.0007" stroke="#fff" strokeWidth="0.9" strokeLinecap="round" strokeLinejoin="round" />
163
- <Path d="M6 19.0007C3.57111 17.1763 2 14.2716 2 11C2 5.47715 6.47715 1 12 1C17.5228 1 22 5.47715 22 11C22 14.2716 20.4289 17.1763 18 19.0007" stroke="#fff" strokeWidth="0.9" strokeLinecap="round" strokeLinejoin="round" />
164
- <Path d="M7.52779 15C6.57771 13.9385 6 12.5367 6 11C6 7.68629 8.68629 5 12 5C15.3137 5 18 7.68629 18 11C18 12.5367 17.4223 13.9385 16.4722 15" stroke="#fff" strokeWidth="0.9" strokeLinecap="round" strokeLinejoin="round" />
165
- <Path fillRule="evenodd" clipRule="evenodd" d="M9.25 11C9.25 9.48122 10.4812 8.25 12 8.25C13.5188 8.25 14.75 9.48122 14.75 11C14.75 12.5188 13.5188 13.75 12 13.75C10.4812 13.75 9.25 12.5188 9.25 11Z" fill="#fff" />
166
- <Path d="M15.0776 21.4865C14.8566 22.8126 13.7093 23.7844 12.365 23.7844H11.7536C10.4093 23.7844 9.262 22.8126 9.041 21.4865L8.53213 18.4333C8.29232 16.9946 9.43086 15.8854 10.5339 15.15C11.9123 14.231 12.3864 14.3406 13.5847 15.1396C14.6421 15.8445 15.8263 16.9946 15.5865 18.4333L15.0776 21.4865Z" fill="#fff" />
170
+ <Svg
171
+ width={size}
172
+ height={size}
173
+ strokeWidth="0.9"
174
+ viewBox="0 0 24 24"
175
+ fill="none"
176
+ >
177
+ <Path
178
+ d="M6 19.0007C3.57111 17.1763 2 14.2716 2 11C2 5.47715 6.47715 1 12 1C17.5228 1 22 5.47715 22 11C22 14.2716 20.4289 17.1763 18 19.0007"
179
+ stroke="#fff"
180
+ strokeWidth="0.9"
181
+ strokeLinecap="round"
182
+ strokeLinejoin="round"
183
+ />
184
+ <Path
185
+ d="M6 19.0007C3.57111 17.1763 2 14.2716 2 11C2 5.47715 6.47715 1 12 1C17.5228 1 22 5.47715 22 11C22 14.2716 20.4289 17.1763 18 19.0007"
186
+ stroke="#fff"
187
+ strokeWidth="0.9"
188
+ strokeLinecap="round"
189
+ strokeLinejoin="round"
190
+ />
191
+ <Path
192
+ d="M7.52779 15C6.57771 13.9385 6 12.5367 6 11C6 7.68629 8.68629 5 12 5C15.3137 5 18 7.68629 18 11C18 12.5367 17.4223 13.9385 16.4722 15"
193
+ stroke="#fff"
194
+ strokeWidth="0.9"
195
+ strokeLinecap="round"
196
+ strokeLinejoin="round"
197
+ />
198
+ <Path
199
+ fillRule="evenodd"
200
+ clipRule="evenodd"
201
+ d="M9.25 11C9.25 9.48122 10.4812 8.25 12 8.25C13.5188 8.25 14.75 9.48122 14.75 11C14.75 12.5188 13.5188 13.75 12 13.75C10.4812 13.75 9.25 12.5188 9.25 11Z"
202
+ fill="#fff"
203
+ />
204
+ <Path
205
+ d="M15.0776 21.4865C14.8566 22.8126 13.7093 23.7844 12.365 23.7844H11.7536C10.4093 23.7844 9.262 22.8126 9.041 21.4865L8.53213 18.4333C8.29232 16.9946 9.43086 15.8854 10.5339 15.15C11.9123 14.231 12.3864 14.3406 13.5847 15.1396C14.6421 15.8445 15.8263 16.9946 15.5865 18.4333L15.0776 21.4865Z"
206
+ fill="#fff"
207
+ />
167
208
  </Svg>
168
209
  );
169
210
 
170
211
  const BluetoothScanningIcon = ({ color = '#111', size = 22 }) => (
171
- <Svg width={size} height={size} strokeWidth="0.9" viewBox="0 0 24 24" fill="none">
172
- <Path d="M6.75 8L17.25 16.5L11.75 22V2L17.25 7.5L6.75 16" stroke={color} strokeWidth="0.9" strokeLinecap="round" strokeLinejoin="round" />
212
+ <Svg
213
+ width={size}
214
+ height={size}
215
+ strokeWidth="0.9"
216
+ viewBox="0 0 24 24"
217
+ fill="none"
218
+ >
219
+ <Path
220
+ d="M6.75 8L17.25 16.5L11.75 22V2L17.25 7.5L6.75 16"
221
+ stroke={color}
222
+ strokeWidth="0.9"
223
+ strokeLinecap="round"
224
+ strokeLinejoin="round"
225
+ />
173
226
  </Svg>
174
227
  );
175
228
 
176
-
177
229
  type Phase =
178
- | 'idle' // nothing happening
179
- | 'scanning' // BLE scan running
180
- | 'selected' // device chosen, ready to send
181
- | 'requesting' // request sent, waiting for receiver
182
- | 'transferring' // BLE accepted, calling transfer API
230
+ | 'idle' // nothing happening
231
+ | 'scanning' // BLE scan running
232
+ | 'selected' // device chosen, ready to send
233
+ | 'requesting' // request sent, waiting for receiver
234
+ | 'transferring' // BLE accepted, calling transfer API
183
235
  | 'done'
184
236
  | 'declined'
185
237
  | 'error';
186
238
 
187
239
  const PHASE_LABEL: Record<Phase, string> = {
188
- idle: 'Ready',
189
- scanning: 'Scanning for nearby FPay devices...',
190
- selected: 'Device selected — ready to send',
191
- requesting: 'Waiting for receiver to respond...',
240
+ idle: 'Ready',
241
+ scanning: 'Scanning for nearby FPay devices...',
242
+ selected: 'Device selected — ready to send',
243
+ requesting: 'Waiting for receiver to respond...',
192
244
  transferring: 'Processing transfer...',
193
- done: 'Payment sent!',
194
- declined: 'Request was declined',
195
- error: 'Something went wrong',
245
+ done: 'Payment sent!',
246
+ declined: 'Request was declined',
247
+ error: 'Something went wrong',
196
248
  };
197
249
 
198
250
  export function BluetoothSubScreen({
199
- amount,
251
+ amount,
200
252
  currency,
201
- onClose,
202
- onProcessTransaction,
253
+ onClose,
254
+ onProcessTransaction,
203
255
  onError,
204
256
  }: Props) {
205
257
  const [devices, setDevices] = useState<FintechDevice[]>([]);
206
258
  const [scanning, setScanning] = useState(false);
207
259
  const [status, setStatus] = useState('Ready to scan');
208
- const [currentDevice, setCurrentDevice] = useState<FintechDevice | null>(null);
209
-
260
+ const [currentDevice, setCurrentDevice] = useState<FintechDevice | null>(
261
+ null
262
+ );
263
+
210
264
  // ── 1. Scan ───────────────────────────────────────────────
211
265
 
212
266
  const handleScan = async () => {
@@ -219,14 +273,14 @@ export function BluetoothSubScreen({
219
273
  (device) => {
220
274
  setDevices((prevDevices) => {
221
275
  // Avoid duplicates
222
- const exists = prevDevices.find(d => d.id === device.id);
276
+ const exists = prevDevices.find((d) => d.id === device.id);
223
277
  if (exists) return prevDevices;
224
278
  return [...prevDevices, device];
225
279
  });
226
280
  },
227
281
  5000 // Scan for 5 seconds
228
282
  );
229
-
283
+
230
284
  setScanning(false);
231
285
  setStatus(`Found ${devices.length} user(s) nearby`);
232
286
  } catch (error) {
@@ -234,7 +288,7 @@ export function BluetoothSubScreen({
234
288
  setScanning(false);
235
289
  setStatus('Scan failed');
236
290
  Alert.alert('Error', 'Failed to scan for devices');
237
- }finally{
291
+ } finally {
238
292
  setScanning(false);
239
293
  }
240
294
  };
@@ -256,35 +310,41 @@ export function BluetoothSubScreen({
256
310
  ]
257
311
  );
258
312
  };
259
-
313
+
314
+ const fullName = (user: FPUserInfo): string => {
315
+ if (!user) return '';
316
+ return `${user.firstName} ${user.lastName}`;
317
+ };
260
318
 
261
319
  const initiatePayment = async (device: FintechDevice) => {
262
320
  try {
263
321
  setCurrentDevice(device);
264
322
  // Connect to the device
265
- const user = FPEngine.getUser();
323
+ const user: any = FPEngine.getUser();
266
324
  await FPEngine.deviceConnection(device.id);
267
-
325
+
268
326
  // Create payment request
269
327
  const request: any = {
270
328
  amount,
271
329
  currency,
272
- senderId: user?.userId ?? 'unknown',
273
- senderName: user?.name ?? 'FountainPay User',
330
+ senderId: user?.userId ?? 'unknown',
331
+ senderName: fullName(user) ?? 'FountainPay User',
274
332
  senderPhone: user?.phone ?? 'unknown',
275
333
  senderEmail: user?.email ?? 'unknown',
276
- timestamp: Date.now(),
334
+ timestamp: Date.now(),
277
335
  };
278
336
 
279
337
  setStatus(`Sending payment request...`);
280
-
281
-
338
+
282
339
  // Send the payment request
283
- console.log("Payment Request: ", request)
284
- const response: any = await await FPEngine.sendBluetoothPaymentRequest(device.id, request);
340
+ console.log('Payment Request: ', request);
341
+ const response: any = await await FPEngine.sendBluetoothPaymentRequest(
342
+ device.id,
343
+ request
344
+ );
345
+
346
+ console.log('Component response: ', response);
285
347
 
286
- console.log("Component response: ", response)
287
-
288
348
  if (!response.accepted) {
289
349
  Alert.alert(
290
350
  'Payment Declined',
@@ -301,13 +361,30 @@ export function BluetoothSubScreen({
301
361
  } as FPError;
302
362
  }
303
363
 
304
- const payload: FPSendPaymentRequest = {
305
- amount: amount,
306
- currency: currency,
364
+ const payload: FPSendWalletPaymentRequest = {
365
+ sender_id: getFPStore().psspId ?? '',
366
+ sender_type: 'USER',
367
+ recipient: {
368
+ accountName: response.accountDetails.accountName,
369
+ accountNumber: response.accountDetails.accountNumber,
370
+ userId: response.accountDetails.userId,
371
+ type: response.accountDetails.receiverType ?? 'USER',
372
+ },
373
+ amount: request.amount.toString(),
374
+ reference: response.transactionId ?? `BT_${Date.now()}`,
375
+ narration: `Bluetooth payment to ${response.accountDetails.accountName}`,
376
+ currency: request.currency,
377
+ isBank: false,
307
378
  channel: 'bluetooth',
308
- narration: `Send ${currency}${amount} to ${response.accountDetails.accountName}`,
309
- recipient: response.accountDetails
310
- }
379
+ };
380
+
381
+ // const payload: FPSendPaymentRequest = {
382
+ // amount: amount,
383
+ // currency: currency,
384
+ // channel: 'bluetooth',
385
+ // narration: `Send ${currency}${amount} to ${response.accountDetails.accountName}`,
386
+ // recipient: response.accountDetails
387
+ // }
311
388
 
312
389
  onProcessTransaction?.(payload);
313
390
  setCurrentDevice(null);
@@ -328,7 +405,6 @@ export function BluetoothSubScreen({
328
405
  }
329
406
  };
330
407
 
331
-
332
408
  return (
333
409
  <Container>
334
410
  {/* Status Bar */}
@@ -338,12 +414,13 @@ export function BluetoothSubScreen({
338
414
  <Ionicons name="close" size={24} />
339
415
  </HeaderButton>
340
416
  <HeaderCenter>
341
- <Text style={{ fontWeight: 'bold', fontSize: 16, color:'#FFF' }}>Bluetooth</Text>
417
+ <Text style={{ fontWeight: 'bold', fontSize: 16, color: '#FFF' }}>
418
+ Bluetooth
419
+ </Text>
342
420
  <Text style={{ fontSize: 10, color: '#FFF' }}>Transfer</Text>
343
421
  </HeaderCenter>
344
-
422
+
345
423
  <HeaderRight>
346
-
347
424
  <HeaderButton>
348
425
  <Ionicons name="ellipsis-vertical" size={22} />
349
426
  </HeaderButton>
@@ -364,41 +441,34 @@ export function BluetoothSubScreen({
364
441
 
365
442
  {scanning && (
366
443
  <>
367
-
368
444
  <QuickLinksContainer>
369
445
  <PulseAnimation />
370
446
  <BluetoothIconContainer>
371
447
  <BluetoothScanningIcon size={40} color="#FFF" />
372
448
  <QuickLinksText>Scanning...</QuickLinksText>
373
449
  </BluetoothIconContainer>
374
-
375
450
  </QuickLinksContainer>
376
451
  </>
377
-
378
452
  )}
379
-
380
-
453
+
381
454
  {!scanning && devices.length > 0 && (
382
455
  <ScrollContainer showsVerticalScrollIndicator={false}>
383
456
  <ContentContainer>
384
457
  <QuickLinksContainerWithDevices>
385
458
  <QuickLinksText>Found {devices.length} user(s)</QuickLinksText>
386
459
  </QuickLinksContainerWithDevices>
387
- {devices.map(device => (
460
+ {devices.map((device) => (
388
461
  <DeviceCard key={device.id}>
389
462
  <DeviceInfo>
390
463
  <DeviceName>
391
464
  {device.appName}: {device.userName || device.name}
392
-
393
465
  </DeviceName>
394
- <DeviceSignal>
395
- Signal: {device.rssi} dBm
396
- </DeviceSignal>
466
+ <DeviceSignal>Signal: {device.rssi} dBm</DeviceSignal>
397
467
  </DeviceInfo>
398
468
  {currentDevice?.id === device.id ? (
399
469
  <InLoading size={40} text="" />
400
470
  ) : (
401
- <PayButton
471
+ <PayButton
402
472
  onPress={() => handlePayment(device)}
403
473
  activeOpacity={0.8}
404
474
  >
@@ -406,11 +476,9 @@ export function BluetoothSubScreen({
406
476
  </PayButton>
407
477
  )}
408
478
  </DeviceCard>
409
- ))}
479
+ ))}
410
480
  </ContentContainer>
411
-
412
481
  </ScrollContainer>
413
-
414
482
  )}
415
483
  </Container>
416
484
  );