@reevit/react 0.4.4 → 0.4.5

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/dist/index.mjs CHANGED
@@ -210,12 +210,14 @@ var ReevitAPIClient = class {
210
210
  const request = {
211
211
  amount: config.amount,
212
212
  currency: config.currency,
213
- method: this.mapPaymentMethod(method),
214
213
  country,
215
214
  customer_id: config.email || config.metadata?.customerId,
216
215
  phone: config.phone,
217
216
  metadata
218
217
  };
218
+ if (method) {
219
+ request.method = this.mapPaymentMethod(method);
220
+ }
219
221
  if (options?.preferredProviders?.length || options?.allowedProviders?.length) {
220
222
  request.policy = {
221
223
  prefer: options?.preferredProviders,
@@ -422,7 +424,8 @@ function useReevit(options) {
422
424
  }
423
425
  const reference = config.reference || generateReference();
424
426
  const country = detectCountryFromCurrency(config.currency);
425
- const paymentMethod = method || config.paymentMethods?.[0] || "card";
427
+ const defaultMethod = config.paymentMethods && config.paymentMethods.length === 1 ? config.paymentMethods[0] : void 0;
428
+ const paymentMethod = method ?? defaultMethod;
426
429
  let data;
427
430
  let error;
428
431
  if (config.paymentLinkCode) {