arky-sdk 0.3.53 → 0.3.55

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.cjs CHANGED
@@ -373,6 +373,14 @@ var createBusinessApi = (apiConfig) => {
373
373
  payload,
374
374
  options
375
375
  );
376
+ },
377
+ async processRefund(params, options) {
378
+ const { id, ...payload } = params;
379
+ return apiConfig.httpClient.post(
380
+ `/v1/businesses/${id}/refund`,
381
+ payload,
382
+ options
383
+ );
376
384
  }
377
385
  };
378
386
  };
@@ -1293,7 +1301,8 @@ function formatPayment(payment, options = {}) {
1293
1301
  if (showBreakdown) {
1294
1302
  const subtotal = formatMinor(payment.subtotal, payment.currency, { showSymbols, decimalPlaces });
1295
1303
  const discount = (payment.discount ?? 0) > 0 ? formatMinor(payment.discount, payment.currency, { showSymbols, decimalPlaces }) : null;
1296
- const tax = (payment.tax ?? 0) > 0 ? formatMinor(payment.tax, payment.currency, { showSymbols, decimalPlaces }) : null;
1304
+ const taxAmount = payment.tax?.amount ?? 0;
1305
+ const tax = taxAmount > 0 ? formatMinor(taxAmount, payment.currency, { showSymbols, decimalPlaces }) : null;
1297
1306
  const total = formatMinor(payment.total, payment.currency, { showSymbols, decimalPlaces });
1298
1307
  let result = `Subtotal: ${subtotal}`;
1299
1308
  if (discount) result += `, Discount: -${discount}`;
@@ -1361,18 +1370,24 @@ function getPriceAmount(prices, marketId, fallbackMarket) {
1361
1370
  return price?.amount || 0;
1362
1371
  }
1363
1372
  function createPaymentForCheckout(subtotalMinor, marketId, currency, paymentMethod, options = {}) {
1364
- const { discount = 0, tax = 0, promoCodeId } = options;
1365
- const total = subtotalMinor - discount + tax;
1373
+ const { discount = 0, taxAmount = 0, taxRateBps = 0, promoCode } = options;
1374
+ const total = subtotalMinor - discount + taxAmount;
1366
1375
  return {
1367
1376
  currency,
1368
1377
  market: marketId,
1369
1378
  subtotal: subtotalMinor,
1370
1379
  shipping: 0,
1371
1380
  discount,
1372
- tax,
1373
1381
  total,
1374
- promoCodeId,
1375
- type: paymentMethod
1382
+ type: paymentMethod,
1383
+ ...taxAmount > 0 && {
1384
+ tax: {
1385
+ amount: taxAmount,
1386
+ rateBps: taxRateBps,
1387
+ lines: []
1388
+ }
1389
+ },
1390
+ ...promoCode && { promoCode }
1376
1391
  };
1377
1392
  }
1378
1393