@munchi_oy/payments 1.4.9 → 1.5.0

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.
@@ -73,7 +73,9 @@ export interface RefundRequest {
73
73
  /**
74
74
  * The ID of the original payment transaction.
75
75
  * Maps to:
76
- * - Viva: parentSessionId
76
+ * - Viva app-to-app: the original transaction referenceId / clientTransactionId.
77
+ * If available at a higher layer, provider-specific identifiers such as
78
+ * orderCode, shortOrderCode, or referenceNumber may produce a more direct referenced refund.
77
79
  * - Nets: preAuthorizationInfo (or reference)
78
80
  */
79
81
  originalTransactionId: string;
package/src/types/sdk.ts CHANGED
@@ -31,6 +31,21 @@ export interface AutoResetOptions {
31
31
  failureDelayMs?: number;
32
32
  }
33
33
 
34
+ export type AppToAppScalar = boolean | number | string;
35
+
36
+ export interface AppToAppAdapter {
37
+ openUrl(url: string): Promise<void>;
38
+ subscribe(listener: (url: string) => void): () => void;
39
+ getInitialUrl?(): Promise<string | null>;
40
+ }
41
+
42
+ export interface AppToAppConfig {
43
+ enabled: boolean;
44
+ appId: string;
45
+ callbackUrl: string;
46
+ adapter: AppToAppAdapter;
47
+ }
48
+
34
49
  export interface SDKOptions {
35
50
  timeoutMs?: number;
36
51
  logger?: ILogger;
@@ -39,4 +54,5 @@ export interface SDKOptions {
39
54
  * If provided (even as an empty object), auto-reset is enabled.
40
55
  */
41
56
  autoResetOnPaymentComplete?: AutoResetOptions;
57
+ appToApp?: AppToAppConfig;
42
58
  }
@@ -0,0 +1,21 @@
1
+ export const parseInteger = (value?: string): number => {
2
+ if (!value) {
3
+ return 0;
4
+ }
5
+
6
+ const parsed = Number.parseInt(value, 10);
7
+ return Number.isFinite(parsed) ? parsed : 0;
8
+ };
9
+
10
+ export const normalizeTimestamp = (value?: string): string => {
11
+ if (!value) {
12
+ return new Date().toISOString();
13
+ }
14
+
15
+ const parsedDate = new Date(value);
16
+ if (Number.isNaN(parsedDate.getTime())) {
17
+ return new Date().toISOString();
18
+ }
19
+
20
+ return parsedDate.toISOString();
21
+ };
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is auto-generated. Do not edit manually.
2
2
  // Run 'pnpm version:sync' to update this file.
3
- export const VERSION = "1.4.9";
3
+ export const VERSION = "1.5.0";