@gmisoftware/react-native-pay 0.0.6 → 0.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmisoftware/react-native-pay",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "author": "gmi.software",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,6 +15,7 @@ import { createPaymentItem, calculateTotal } from '../utils'
15
15
 
16
16
  export interface UsePaymentCheckoutConfig {
17
17
  merchantIdentifier: string
18
+ merchantName?: string
18
19
  countryCode?: string
19
20
  currencyCode?: string
20
21
  supportedNetworks?: string[]
@@ -116,19 +117,15 @@ export interface UsePaymentCheckoutReturn {
116
117
  export function usePaymentCheckout(
117
118
  config: UsePaymentCheckoutConfig
118
119
  ): UsePaymentCheckoutReturn {
119
- // Payment status state
120
120
  const [status, setStatus] = useState<PayServiceStatus | null>(null)
121
121
  const [isCheckingStatus, setIsCheckingStatus] = useState(true)
122
122
 
123
- // Cart state
124
123
  const [items, setItems] = useState<PaymentItem[]>([])
125
124
 
126
- // Payment state
127
125
  const [isProcessing, setIsProcessing] = useState(false)
128
126
  const [result, setResult] = useState<PaymentResult | null>(null)
129
127
  const [error, setError] = useState<Error | null>(null)
130
128
 
131
- // Check payment status on mount
132
129
  useEffect(() => {
133
130
  try {
134
131
  const paymentStatus = HybridPaymentHandler.payServiceStatus()
@@ -141,13 +138,12 @@ export function usePaymentCheckout(
141
138
  }
142
139
  }, [])
143
140
 
144
- // Calculate total
145
141
  const total = useMemo(() => calculateTotal(items), [items])
146
142
 
147
- // Build payment request
148
143
  const paymentRequest = useMemo<PaymentRequest>(() => {
149
144
  const {
150
145
  merchantIdentifier,
146
+ merchantName,
151
147
  countryCode = 'US',
152
148
  currencyCode = 'USD',
153
149
  supportedNetworks = ['visa', 'mastercard', 'amex', 'discover'],
@@ -160,6 +156,7 @@ export function usePaymentCheckout(
160
156
  return {
161
157
  merchantIdentifier,
162
158
  countryCode,
159
+ merchantName,
163
160
  currencyCode,
164
161
  supportedNetworks,
165
162
  merchantCapabilities,
@@ -213,7 +210,6 @@ export function usePaymentCheckout(
213
210
  setItems([])
214
211
  }, [])
215
212
 
216
- // Start payment
217
213
  const startPayment = useCallback(async (): Promise<PaymentResult | null> => {
218
214
  if (items.length === 0) {
219
215
  const emptyCartError = new Error('Cart is empty')
@@ -246,7 +242,6 @@ export function usePaymentCheckout(
246
242
  }
247
243
  }, [items, paymentRequest])
248
244
 
249
- // Reset all state
250
245
  const reset = useCallback(() => {
251
246
  setIsProcessing(false)
252
247
  setResult(null)