react-native-fpay 0.3.4 → 0.3.6

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 +106 -16
  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 -5
  118. package/src/FountainPayProvider.tsx +164 -23
  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
@@ -1,14 +1,24 @@
1
1
  import React, { useState, useEffect, useRef } from 'react';
2
2
  import styled from 'styled-components/native';
3
- import Svg, { Path } from "react-native-svg";
4
- import { View, Text, TouchableOpacity, StyleSheet, Animated, Easing } from 'react-native';
5
- import { C, R, S, F, shadow } from '../../../theme';
6
- import type { FPError, Props, FPSendPaymentRequest } from '../../../../core/types';
7
- import NearbyUsersService from '../../../../engine/NearbyUsersService';
3
+ import Svg, { Path } from 'react-native-svg';
4
+ import {
5
+ View,
6
+ Text,
7
+ TouchableOpacity,
8
+ StyleSheet,
9
+ Animated,
10
+ Easing,
11
+ } from 'react-native';
12
+ import type {
13
+ FPError,
14
+ Props,
15
+ FPSendPaymentRequest,
16
+ FPSendWalletPaymentRequest,
17
+ } from '../../../../core/types';
8
18
  import { PulseAnimation } from '../../../components/PulseAnimation';
9
19
  import Ionicons from 'react-native-vector-icons/Ionicons';
10
- import LoadingAnimation from '../../../components/LoadingAnimation';
11
-
20
+ import { proximityAPI } from '../../../../core/api';
21
+ import Geolocation from '@react-native-community/geolocation';
12
22
 
13
23
  const Container = styled(View)`
14
24
  flex: 1;
@@ -148,7 +158,7 @@ const LCIconContainer = styled(Animated.View)`
148
158
  width: 140px;
149
159
  height: 140px;
150
160
  border-radius: 90px;
151
- background-color: #E8F5F1;
161
+ background-color: #e8f5f1;
152
162
  align-items: center;
153
163
  justify-content: center;
154
164
  margin-top: 24px;
@@ -179,7 +189,7 @@ const StatusSubText = styled.Text`
179
189
  `;
180
190
 
181
191
  const ConnectionStatusBadge = styled.View<{ connected: boolean }>`
182
- background-color: ${props => props.connected ? '#0a3d2e' : '#E0E0E0'};
192
+ background-color: ${(props) => (props.connected ? '#0a3d2e' : '#E0E0E0')};
183
193
  border-radius: 20px;
184
194
  padding: 8px 16px;
185
195
  margin-top: 16px;
@@ -188,44 +198,120 @@ const ConnectionStatusBadge = styled.View<{ connected: boolean }>`
188
198
  const ConnectionStatusText = styled.Text<{ connected: boolean }>`
189
199
  font-size: 12px;
190
200
  font-weight: 600;
191
- color: ${props => props.connected ? '#ffffff' : '#666666'};
201
+ color: ${(props) => (props.connected ? '#ffffff' : '#666666')};
192
202
  `;
193
203
 
194
-
195
- const BluetoothIcon =({ color = "#111", size = 22 })=>(
196
- <Svg width={size} height={size} strokeWidth="0.9" viewBox="0 0 24 24" fill="none" color={color}>
197
- <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" />
198
- <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" />
199
- <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" />
200
- <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" />
201
- <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" />
202
- </Svg>
204
+ const BluetoothIcon = ({ color = '#111', size = 22 }) => (
205
+ <Svg
206
+ width={size}
207
+ height={size}
208
+ strokeWidth="0.9"
209
+ viewBox="0 0 24 24"
210
+ fill="none"
211
+ color={color}
212
+ >
213
+ <Path
214
+ 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"
215
+ stroke="#fff"
216
+ strokeWidth="0.9"
217
+ strokeLinecap="round"
218
+ strokeLinejoin="round"
219
+ />
220
+ <Path
221
+ 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"
222
+ stroke="#fff"
223
+ strokeWidth="0.9"
224
+ strokeLinecap="round"
225
+ strokeLinejoin="round"
226
+ />
227
+ <Path
228
+ 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"
229
+ stroke="#fff"
230
+ strokeWidth="0.9"
231
+ strokeLinecap="round"
232
+ strokeLinejoin="round"
233
+ />
234
+ <Path
235
+ fillRule="evenodd"
236
+ clipRule="evenodd"
237
+ 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"
238
+ fill="#fff"
239
+ />
240
+ <Path
241
+ 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"
242
+ fill="#fff"
243
+ />
244
+ </Svg>
203
245
  );
204
246
 
205
-
206
- const BluetoothScanningIcon = ({ color = "#111", size = 22})=>(
207
- <Svg width={size} height={size} strokeWidth="0.9" viewBox="0 0 24 24" fill="none" color={color}>
208
- <Path d="M6.75 8L17.25 16.5L11.75 22V2L17.25 7.5L6.75 16" stroke={color} strokeWidth="0.9" strokeLinecap="round" strokeLinejoin="round" />
247
+ const BluetoothScanningIcon = ({ color = '#111', size = 22 }) => (
248
+ <Svg
249
+ width={size}
250
+ height={size}
251
+ strokeWidth="0.9"
252
+ viewBox="0 0 24 24"
253
+ fill="none"
254
+ color={color}
255
+ >
256
+ <Path
257
+ d="M6.75 8L17.25 16.5L11.75 22V2L17.25 7.5L6.75 16"
258
+ stroke={color}
259
+ strokeWidth="0.9"
260
+ strokeLinecap="round"
261
+ strokeLinejoin="round"
262
+ />
209
263
  </Svg>
210
- )
211
-
212
- const ProximityIcon =({ color = "#111", size = 22 })=>(
213
- <Svg width={size} height={size} strokeWidth="0.9" viewBox="0 0 24 24" fill="none" color={color}>
214
- <Path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" stroke={color} strokeWidth="0.9" strokeLinecap="round" strokeLinejoin="round"/>
215
- <Path d="M12 13C12.5523 13 13 12.5523 13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12C11 12.5523 11.4477 13 12 13Z" fill={color} stroke={color} strokeWidth="0.9" strokeLinecap="round" strokeLinejoin="round"/>
216
- <Path d="M19 19L17.5 17.5" stroke={color} strokeWidth="0.9" strokeLinecap="round" strokeLinejoin="round"/>
217
- <Path d="M15.5 15.5L14.5 14.5" stroke={color} strokeWidth="0.9" strokeLinecap="round" strokeLinejoin="round"/>
218
- </Svg>
219
- )
264
+ );
220
265
 
266
+ const ProximityIcon = ({ color = '#111', size = 22 }) => (
267
+ <Svg
268
+ width={size}
269
+ height={size}
270
+ strokeWidth="0.9"
271
+ viewBox="0 0 24 24"
272
+ fill="none"
273
+ color={color}
274
+ >
275
+ <Path
276
+ d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"
277
+ stroke={color}
278
+ strokeWidth="0.9"
279
+ strokeLinecap="round"
280
+ strokeLinejoin="round"
281
+ />
282
+ <Path
283
+ d="M12 13C12.5523 13 13 12.5523 13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12C11 12.5523 11.4477 13 12 13Z"
284
+ fill={color}
285
+ stroke={color}
286
+ strokeWidth="0.9"
287
+ strokeLinecap="round"
288
+ strokeLinejoin="round"
289
+ />
290
+ <Path
291
+ d="M19 19L17.5 17.5"
292
+ stroke={color}
293
+ strokeWidth="0.9"
294
+ strokeLinecap="round"
295
+ strokeLinejoin="round"
296
+ />
297
+ <Path
298
+ d="M15.5 15.5L14.5 14.5"
299
+ stroke={color}
300
+ strokeWidth="0.9"
301
+ strokeLinecap="round"
302
+ strokeLinejoin="round"
303
+ />
304
+ </Svg>
305
+ );
221
306
 
222
- export function ProximitySubScreen({
223
- amount,
307
+ export function ProximitySubScreen({
308
+ psspId,
309
+ amount,
224
310
  currency,
225
- onClose,
226
- onProcessTransaction,
227
- onError }: Props) {
228
-
311
+ onClose,
312
+ onProcessTransaction,
313
+ onError,
314
+ }: Props) {
229
315
  const [nearbyUsers, setNearbyUsers] = useState([]);
230
316
  const [loading, setLoading] = useState(false);
231
317
  const [scanning, setScanning] = useState(false);
@@ -233,29 +319,70 @@ export function ProximitySubScreen({
233
319
  const animationRef = useRef<Animated.CompositeAnimation | null>(null);
234
320
 
235
321
  const handleScan = async () => {
236
- try {
237
- const users: any = await NearbyUsersService.getNearbyUsers();
238
- setNearbyUsers(users);
239
- } catch (error) {
240
- console.error('Error fetching nearby users:', error);
241
- } finally {
322
+ if (!psspId) {
323
+ console.warn('No psspId user not initialized');
324
+ return;
325
+ }
326
+
327
+ setScanning(true);
328
+ Geolocation.getCurrentPosition(
329
+ async (position) => {
330
+ try {
331
+ const { latitude, longitude } = position.coords;
332
+ const users: any = await proximityAPI.discover(
333
+ psspId,
334
+ latitude,
335
+ longitude,
336
+ 1000
337
+ );
338
+ if (users.status) {
339
+ setNearbyUsers(users.payload || []);
340
+ }
341
+ } catch (err) {
342
+ console.error('Discover error:', err);
343
+ } finally {
242
344
  setScanning(false);
243
- }
345
+ }
346
+ },
347
+ (error) => {
348
+ console.error('Location error:', error);
349
+ setScanning(false);
350
+ },
351
+ { enableHighAccuracy: true, timeout: 20000, maximumAge: 1000 }
352
+ );
244
353
  };
245
354
 
246
355
  const handlePayment = async (selected: any) => {
247
356
  if (!selected) return;
248
357
  try {
249
- const payload: FPSendPaymentRequest = {
250
- amount: amount,
251
- currency: currency,
252
- channel: 'proximity',
358
+ const payload: FPSendWalletPaymentRequest = {
359
+ sender_id: psspId || '',
360
+ sender_type: 'USER',
361
+ recipient: {
362
+ accountNumber: selected.accountNumber || '',
363
+ type: selected.userType === 'VIRTUAL_ACCOUNT_USER' ? 'USER' : 'AGENT',
364
+ accountName: selected.displayName || '',
365
+ agentId:
366
+ selected.userType === 'VIRTUAL_ACCOUNT_USER'
367
+ ? undefined
368
+ : selected.userId,
369
+ userId:
370
+ selected.userType === 'VIRTUAL_ACCOUNT_USER'
371
+ ? selected.userId
372
+ : undefined,
373
+ },
374
+ amount: Number(amount).toString(),
375
+ reference: `SEND_${Date.now()}`,
253
376
  narration: `Send ${currency}${amount} to ${selected.displayName}`,
254
- recipient: selected
255
- }
377
+ currency,
378
+ isBank: false,
379
+ channel: 'transfer',
380
+ };
256
381
 
257
382
  onProcessTransaction?.(payload);
258
- } catch (e) { onError?.(e as FPError); }
383
+ } catch (e) {
384
+ onError?.(e as FPError);
385
+ }
259
386
  };
260
387
 
261
388
  useEffect(() => {
@@ -287,7 +414,7 @@ export function ProximitySubScreen({
287
414
  }
288
415
 
289
416
  return () => {
290
- animationRef.current?.stop();
417
+ animationRef.current?.stop();
291
418
  };
292
419
  }, [scanning]);
293
420
 
@@ -298,75 +425,74 @@ export function ProximitySubScreen({
298
425
  <Ionicons name="close" size={24} />
299
426
  </HeaderButton>
300
427
  <HeaderCenter>
301
- <Text style={{ fontWeight: 'bold', fontSize: 16, color:'#FFF' }}>Proximity</Text>
428
+ <Text style={{ fontWeight: 'bold', fontSize: 16, color: '#FFF' }}>
429
+ Proximity
430
+ </Text>
302
431
  <Text style={{ fontSize: 10, color: '#FFF' }}>Transfer</Text>
303
432
  </HeaderCenter>
304
-
433
+
305
434
  <HeaderRight>
306
435
  <HeaderButton>
307
- <Ionicons name="ellipsis-vertical" size={22} />
436
+ <Ionicons name="ellipsis-vertical" size={22} />
308
437
  </HeaderButton>
309
438
  </HeaderRight>
310
439
  </Header>
311
440
 
312
- {!scanning && !nearbyUsers.length && (
313
- <QuickLinksContainer>
314
- <QuickLinksIcon onPress={()=>setScanning(true)}>
315
- <ProximityIcon size={60} color="#FFF" />
316
- </QuickLinksIcon>
317
- <QuickLinksText>Tap to Pay</QuickLinksText>
318
- <Text style={{ fontSize: 16, color: '#999' }}>
319
- No nearby users found
320
- </Text>
321
- </QuickLinksContainer>
322
- )}
323
-
324
441
  {scanning && (
325
442
  <LCAnimationContainer>
326
443
  <PulseAnimation />
327
- <LCIconContainer style={{ transform: [{ scale: iconScale }], marginTop: 64 }}>
328
- <LCIcon>📡</LCIcon>
444
+ <LCIconContainer
445
+ style={{ transform: [{ scale: iconScale }], marginTop: 64 }}
446
+ >
447
+ <LCIcon>📡</LCIcon>
329
448
  </LCIconContainer>
330
449
 
331
450
  <StatusTextContainer>
332
- <StatusText>
333
- Searching for nearby users
334
- </StatusText>
335
- {/* <StatusSubText>Hold devices back-to-back</StatusSubText> */}
451
+ <StatusText>Searching for nearby users</StatusText>
452
+ {/* <StatusSubText>Hold devices back-to-back</StatusSubText> */}
336
453
  </StatusTextContainer>
337
454
  </LCAnimationContainer>
338
-
339
455
  )}
340
456
 
341
- {!scanning && nearbyUsers.length > 0 && (
342
- <ScrollContainer showsVerticalScrollIndicator={false}>
343
- <ContentContainer>
344
- <QuickLinksContainerWithDevices>
345
- <QuickLinksText>Found {nearbyUsers.length} user(s)</QuickLinksText>
346
- </QuickLinksContainerWithDevices>
347
- {nearbyUsers.map((user: any) => (
348
- <DeviceCard key={user.userId}>
457
+ {!scanning && !nearbyUsers.length && (
458
+ <QuickLinksContainer>
459
+ <QuickLinksIcon onPress={() => setScanning(true)}>
460
+ <ProximityIcon size={60} color="#FFF" />
461
+ </QuickLinksIcon>
462
+ <QuickLinksText>Tap to Pay</QuickLinksText>
463
+ <Text style={{ fontSize: 16, color: '#999' }}>
464
+ No nearby users found
465
+ </Text>
466
+ </QuickLinksContainer>
467
+ )}
468
+
469
+ {!scanning && nearbyUsers.length > 0 && (
470
+ <ScrollContainer showsVerticalScrollIndicator={false}>
471
+ <ContentContainer>
472
+ <QuickLinksContainerWithDevices>
473
+ <QuickLinksText>
474
+ Found {nearbyUsers.length} user(s)
475
+ </QuickLinksText>
476
+ </QuickLinksContainerWithDevices>
477
+ {nearbyUsers.map((user: any) => (
478
+ <DeviceCard key={user.userId}>
349
479
  <DeviceInfo>
350
- <DeviceName>
351
- {user.userName || user.name}
352
- {user.appName}
353
- </DeviceName>
480
+ <DeviceName>{user.displayName}</DeviceName>
354
481
  <DeviceSignal>
355
- Signal: {Math.round(user.distance)}m away
482
+ Signal: {Math.round(user.distance)}m away
356
483
  </DeviceSignal>
357
484
  </DeviceInfo>
358
- <PayButton
359
- onPress={() => handlePayment(user)}
360
- activeOpacity={0.8}
485
+ <PayButton
486
+ onPress={() => handlePayment(user)}
487
+ activeOpacity={0.8}
361
488
  >
362
- <PayButtonText>Pay</PayButtonText>
489
+ <PayButtonText>Pay</PayButtonText>
363
490
  </PayButton>
364
- </DeviceCard>
365
- ))}
366
- </ContentContainer>
367
- </ScrollContainer>
368
-
369
- )}
491
+ </DeviceCard>
492
+ ))}
493
+ </ContentContainer>
494
+ </ScrollContainer>
495
+ )}
370
496
  </Container>
371
497
  );
372
498
  }