@gmisoftware/react-native-pay 0.0.7 → 0.0.8

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.
@@ -1,6 +1,7 @@
1
1
  import type { PaymentRequest, PaymentResult, PaymentItem, GooglePayEnvironment } from '../types';
2
2
  export interface UsePaymentCheckoutConfig {
3
3
  merchantIdentifier: string;
4
+ merchantName?: string;
4
5
  countryCode?: string;
5
6
  currencyCode?: string;
6
7
  supportedNetworks?: string[];
@@ -67,16 +67,12 @@ const utils_1 = require("../utils");
67
67
  * ```
68
68
  */
69
69
  function usePaymentCheckout(config) {
70
- // Payment status state
71
70
  const [status, setStatus] = (0, react_1.useState)(null);
72
71
  const [isCheckingStatus, setIsCheckingStatus] = (0, react_1.useState)(true);
73
- // Cart state
74
72
  const [items, setItems] = (0, react_1.useState)([]);
75
- // Payment state
76
73
  const [isProcessing, setIsProcessing] = (0, react_1.useState)(false);
77
74
  const [result, setResult] = (0, react_1.useState)(null);
78
75
  const [error, setError] = (0, react_1.useState)(null);
79
- // Check payment status on mount
80
76
  (0, react_1.useEffect)(() => {
81
77
  try {
82
78
  const paymentStatus = HybridPaymentHandler.payServiceStatus();
@@ -90,14 +86,13 @@ function usePaymentCheckout(config) {
90
86
  setIsCheckingStatus(false);
91
87
  }
92
88
  }, []);
93
- // Calculate total
94
89
  const total = (0, react_1.useMemo)(() => (0, utils_1.calculateTotal)(items), [items]);
95
- // Build payment request
96
90
  const paymentRequest = (0, react_1.useMemo)(() => {
97
- const { merchantIdentifier, countryCode = 'US', currencyCode = 'USD', supportedNetworks = ['visa', 'mastercard', 'amex', 'discover'], merchantCapabilities = ['3DS'], googlePayEnvironment, googlePayGateway, googlePayGatewayMerchantId, } = config;
91
+ const { merchantIdentifier, merchantName, countryCode = 'US', currencyCode = 'USD', supportedNetworks = ['visa', 'mastercard', 'amex', 'discover'], merchantCapabilities = ['3DS'], googlePayEnvironment, googlePayGateway, googlePayGatewayMerchantId, } = config;
98
92
  return {
99
93
  merchantIdentifier,
100
94
  countryCode,
95
+ merchantName,
101
96
  currencyCode,
102
97
  supportedNetworks,
103
98
  merchantCapabilities,
@@ -125,7 +120,6 @@ function usePaymentCheckout(config) {
125
120
  const clearItems = (0, react_1.useCallback)(() => {
126
121
  setItems([]);
127
122
  }, []);
128
- // Start payment
129
123
  const startPayment = (0, react_1.useCallback)(async () => {
130
124
  if (items.length === 0) {
131
125
  const emptyCartError = new Error('Cart is empty');
@@ -152,7 +146,6 @@ function usePaymentCheckout(config) {
152
146
  setIsProcessing(false);
153
147
  }
154
148
  }, [items, paymentRequest]);
155
- // Reset all state
156
149
  const reset = (0, react_1.useCallback)(() => {
157
150
  setIsProcessing(false);
158
151
  setResult(null);
@@ -41,6 +41,7 @@ export interface PaymentToken {
41
41
  }
42
42
  export interface PaymentRequest {
43
43
  merchantIdentifier: string;
44
+ merchantName?: string;
44
45
  countryCode: string;
45
46
  currencyCode: string;
46
47
  paymentItems: PaymentItem[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmisoftware/react-native-pay",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "author": "gmi.software",
5
5
  "repository": {
6
6
  "type": "git",