@lina-openx/react-native-lina-pay-sdk 1.0.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.
- package/LinaPaySdk.podspec +20 -0
- package/README.md +522 -0
- package/android/build.gradle +77 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/linapaysdk/LinaPaySdkModule.kt +18 -0
- package/android/src/main/java/com/linapaysdk/LinaPaySdkPackage.kt +17 -0
- package/ios/LinaPaySdk.h +5 -0
- package/ios/LinaPaySdk.mm +16 -0
- package/lib/module/config/environment.js +61 -0
- package/lib/module/config/environment.js.map +1 -0
- package/lib/module/index.js +142 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/services/auth.service.js +73 -0
- package/lib/module/services/auth.service.js.map +1 -0
- package/lib/module/services/consent.service.js +49 -0
- package/lib/module/services/consent.service.js.map +1 -0
- package/lib/module/services/participants.service.js +71 -0
- package/lib/module/services/participants.service.js.map +1 -0
- package/lib/module/services/payment.service.js +39 -0
- package/lib/module/services/payment.service.js.map +1 -0
- package/lib/module/types/auth.types.js +2 -0
- package/lib/module/types/auth.types.js.map +1 -0
- package/lib/module/types/consent.types.js +2 -0
- package/lib/module/types/consent.types.js.map +1 -0
- package/lib/module/types/index.js +2 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/participants.types.js +2 -0
- package/lib/module/types/participants.types.js.map +1 -0
- package/lib/module/types/payment.types.js +2 -0
- package/lib/module/types/payment.types.js.map +1 -0
- package/lib/module/utils/consent.utils.js +168 -0
- package/lib/module/utils/consent.utils.js.map +1 -0
- package/lib/module/utils/http.utils.js +58 -0
- package/lib/module/utils/http.utils.js.map +1 -0
- package/lib/module/utils/payment.utils.js +27 -0
- package/lib/module/utils/payment.utils.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/config/environment.d.ts +38 -0
- package/lib/typescript/src/config/environment.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +108 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/services/auth.service.d.ts +13 -0
- package/lib/typescript/src/services/auth.service.d.ts.map +1 -0
- package/lib/typescript/src/services/consent.service.d.ts +9 -0
- package/lib/typescript/src/services/consent.service.d.ts.map +1 -0
- package/lib/typescript/src/services/participants.service.d.ts +9 -0
- package/lib/typescript/src/services/participants.service.d.ts.map +1 -0
- package/lib/typescript/src/services/payment.service.d.ts +9 -0
- package/lib/typescript/src/services/payment.service.d.ts.map +1 -0
- package/lib/typescript/src/types/auth.types.d.ts +23 -0
- package/lib/typescript/src/types/auth.types.d.ts.map +1 -0
- package/lib/typescript/src/types/consent.types.d.ts +129 -0
- package/lib/typescript/src/types/consent.types.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +9 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/lib/typescript/src/types/participants.types.d.ts +50 -0
- package/lib/typescript/src/types/participants.types.d.ts.map +1 -0
- package/lib/typescript/src/types/payment.types.d.ts +107 -0
- package/lib/typescript/src/types/payment.types.d.ts.map +1 -0
- package/lib/typescript/src/utils/consent.utils.d.ts +10 -0
- package/lib/typescript/src/utils/consent.utils.d.ts.map +1 -0
- package/lib/typescript/src/utils/http.utils.d.ts +21 -0
- package/lib/typescript/src/utils/http.utils.d.ts.map +1 -0
- package/lib/typescript/src/utils/payment.utils.d.ts +10 -0
- package/lib/typescript/src/utils/payment.utils.d.ts.map +1 -0
- package/package.json +169 -0
- package/src/config/environment.ts +58 -0
- package/src/index.tsx +178 -0
- package/src/services/auth.service.ts +88 -0
- package/src/services/consent.service.ts +63 -0
- package/src/services/participants.service.ts +89 -0
- package/src/services/payment.service.ts +49 -0
- package/src/types/auth.types.ts +24 -0
- package/src/types/consent.types.ts +152 -0
- package/src/types/index.ts +34 -0
- package/src/types/participants.types.ts +53 -0
- package/src/types/payment.types.ts +141 -0
- package/src/utils/consent.utils.ts +225 -0
- package/src/utils/http.utils.ts +80 -0
- package/src/utils/payment.utils.ts +32 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Consent utilities for payload validation
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { LinaPayError } from "./http.utils.js";
|
|
8
|
+
/**
|
|
9
|
+
* Validate CPF/CNPJ format (basic validation)
|
|
10
|
+
*/
|
|
11
|
+
function validateCpfCnpj(cpfCnpj, fieldName) {
|
|
12
|
+
// Remove non-numeric characters
|
|
13
|
+
const cleaned = cpfCnpj.replace(/\D/g, '');
|
|
14
|
+
|
|
15
|
+
// CPF must have 11 digits, CNPJ must have 14 digits
|
|
16
|
+
if (cleaned.length !== 11 && cleaned.length !== 14) {
|
|
17
|
+
throw new LinaPayError(`${fieldName} must be a valid CPF (11 digits) or CNPJ (14 digits)`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Validate URL format
|
|
23
|
+
*/
|
|
24
|
+
function validateUrl(url, fieldName) {
|
|
25
|
+
if (!url || url.trim() === '') {
|
|
26
|
+
throw new LinaPayError(`${fieldName} is required and cannot be empty`);
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const urlObj = new URL(url);
|
|
30
|
+
if (!urlObj.protocol.startsWith('http')) {
|
|
31
|
+
throw new Error('Invalid protocol');
|
|
32
|
+
}
|
|
33
|
+
} catch {
|
|
34
|
+
throw new LinaPayError(`${fieldName} must be a valid URL starting with http:// or https://`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Validate positive number
|
|
40
|
+
*/
|
|
41
|
+
function validatePositiveNumber(value, fieldName) {
|
|
42
|
+
if (typeof value !== 'number' || isNaN(value)) {
|
|
43
|
+
throw new LinaPayError(`${fieldName} must be a valid number`);
|
|
44
|
+
}
|
|
45
|
+
if (value <= 0) {
|
|
46
|
+
throw new LinaPayError(`${fieldName} must be greater than zero`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Validate date format (YYYY-MM-DD)
|
|
52
|
+
*/
|
|
53
|
+
function validateDateFormat(date, fieldName) {
|
|
54
|
+
const dateRegex = /^\d{4}-\d{2}-\d{2}$/;
|
|
55
|
+
if (!dateRegex.test(date)) {
|
|
56
|
+
throw new LinaPayError(`${fieldName} must be in format YYYY-MM-DD (e.g., 2024-09-01)`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Check if date is valid
|
|
60
|
+
const dateObj = new Date(date);
|
|
61
|
+
if (isNaN(dateObj.getTime())) {
|
|
62
|
+
throw new LinaPayError(`${fieldName} is not a valid date`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Validate required string field
|
|
68
|
+
*/
|
|
69
|
+
function validateRequiredString(value, fieldName) {
|
|
70
|
+
if (!value || value.trim() === '') {
|
|
71
|
+
throw new LinaPayError(`${fieldName} is required and cannot be empty`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Validate consent payload before sending to API
|
|
77
|
+
* Throws LinaPayError if validation fails
|
|
78
|
+
*/
|
|
79
|
+
export function validateConsentPayload(payload) {
|
|
80
|
+
// Validate main required fields
|
|
81
|
+
validateRequiredString(payload.organisationId, 'organisationId');
|
|
82
|
+
validateRequiredString(payload.authorisationServerId, 'authorisationServerId');
|
|
83
|
+
if (!payload.payment) {
|
|
84
|
+
throw new LinaPayError('payment is required');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Validate payment required fields
|
|
88
|
+
validateUrl(payload.payment.redirectUri, 'payment.redirectUri');
|
|
89
|
+
validatePositiveNumber(payload.payment.value, 'payment.value');
|
|
90
|
+
if (!payload.payment.creditor) {
|
|
91
|
+
throw new LinaPayError('payment.creditor is required');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Validate creditor required fields
|
|
95
|
+
const creditor = payload.payment.creditor;
|
|
96
|
+
validateRequiredString(creditor.name, 'payment.creditor.name');
|
|
97
|
+
validateRequiredString(creditor.personType, 'payment.creditor.personType');
|
|
98
|
+
validateCpfCnpj(creditor.cpfCnpj, 'payment.creditor.cpfCnpj');
|
|
99
|
+
validateRequiredString(creditor.accountNumber, 'payment.creditor.accountNumber');
|
|
100
|
+
validateRequiredString(creditor.accountIssuer, 'payment.creditor.accountIssuer');
|
|
101
|
+
validateRequiredString(creditor.accountPixKey, 'payment.creditor.accountPixKey');
|
|
102
|
+
validateRequiredString(creditor.accountIspb, 'payment.creditor.accountIspb');
|
|
103
|
+
validateRequiredString(creditor.accountType, 'payment.creditor.accountType');
|
|
104
|
+
|
|
105
|
+
// Validate optional CPF/CNPJ in payment
|
|
106
|
+
if (payload.payment.cpfCnpj) {
|
|
107
|
+
validateCpfCnpj(payload.payment.cpfCnpj, 'payment.cpfCnpj');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Validate schedule if present
|
|
111
|
+
if (payload.payment.schedule) {
|
|
112
|
+
validateSchedule(payload.payment.schedule);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Validate redirectUri if present at root level
|
|
116
|
+
if (payload.redirectUri) {
|
|
117
|
+
validateUrl(payload.redirectUri, 'redirectUri');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Validate schedule structure
|
|
123
|
+
*/
|
|
124
|
+
function validateSchedule(schedule) {
|
|
125
|
+
const scheduleTypes = ['single', 'daily', 'weekly', 'monthly', 'custom'];
|
|
126
|
+
const providedTypes = scheduleTypes.filter(type => schedule[type]);
|
|
127
|
+
if (providedTypes.length === 0) {
|
|
128
|
+
throw new LinaPayError('At least one schedule type must be provided (single, daily, weekly, monthly, or custom)');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Validate single schedule
|
|
132
|
+
if (schedule.single) {
|
|
133
|
+
validateDateFormat(schedule.single.date, 'schedule.single.date');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Validate daily schedule
|
|
137
|
+
if (schedule.daily) {
|
|
138
|
+
validateDateFormat(schedule.daily.startDate, 'schedule.daily.startDate');
|
|
139
|
+
validatePositiveNumber(schedule.daily.quantity, 'schedule.daily.quantity');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Validate weekly schedule
|
|
143
|
+
if (schedule.weekly) {
|
|
144
|
+
validateRequiredString(schedule.weekly.dayOfWeek, 'schedule.weekly.dayOfWeek');
|
|
145
|
+
validateDateFormat(schedule.weekly.startDate, 'schedule.weekly.startDate');
|
|
146
|
+
validatePositiveNumber(schedule.weekly.quantity, 'schedule.weekly.quantity');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Validate monthly schedule
|
|
150
|
+
if (schedule.monthly) {
|
|
151
|
+
if (typeof schedule.monthly.dayOfMonth !== 'number' || schedule.monthly.dayOfMonth < 1 || schedule.monthly.dayOfMonth > 31) {
|
|
152
|
+
throw new LinaPayError('schedule.monthly.dayOfMonth must be a number between 1 and 31');
|
|
153
|
+
}
|
|
154
|
+
validateDateFormat(schedule.monthly.startDate, 'schedule.monthly.startDate');
|
|
155
|
+
validatePositiveNumber(schedule.monthly.quantity, 'schedule.monthly.quantity');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Validate custom schedule
|
|
159
|
+
if (schedule.custom) {
|
|
160
|
+
if (!Array.isArray(schedule.custom.dates) || schedule.custom.dates.length === 0) {
|
|
161
|
+
throw new LinaPayError('schedule.custom.dates must be a non-empty array');
|
|
162
|
+
}
|
|
163
|
+
schedule.custom.dates.forEach((date, index) => {
|
|
164
|
+
validateDateFormat(date, `schedule.custom.dates[${index}]`);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=consent.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LinaPayError","validateCpfCnpj","cpfCnpj","fieldName","cleaned","replace","length","validateUrl","url","trim","urlObj","URL","protocol","startsWith","Error","validatePositiveNumber","value","isNaN","validateDateFormat","date","dateRegex","test","dateObj","Date","getTime","validateRequiredString","validateConsentPayload","payload","organisationId","authorisationServerId","payment","redirectUri","creditor","name","personType","accountNumber","accountIssuer","accountPixKey","accountIspb","accountType","schedule","validateSchedule","scheduleTypes","providedTypes","filter","type","single","daily","startDate","quantity","weekly","dayOfWeek","monthly","dayOfMonth","custom","Array","isArray","dates","forEach","index"],"sourceRoot":"../../../src","sources":["utils/consent.utils.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,SAASA,YAAY,QAAQ,iBAAc;AAG3C;AACA;AACA;AACA,SAASC,eAAeA,CAACC,OAAe,EAAEC,SAAiB,EAAQ;EACjE;EACA,MAAMC,OAAO,GAAGF,OAAO,CAACG,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;;EAE1C;EACA,IAAID,OAAO,CAACE,MAAM,KAAK,EAAE,IAAIF,OAAO,CAACE,MAAM,KAAK,EAAE,EAAE;IAClD,MAAM,IAAIN,YAAY,CACpB,GAAGG,SAAS,sDACd,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA,SAASI,WAAWA,CAACC,GAAW,EAAEL,SAAiB,EAAQ;EACzD,IAAI,CAACK,GAAG,IAAIA,GAAG,CAACC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;IAC7B,MAAM,IAAIT,YAAY,CAAC,GAAGG,SAAS,kCAAkC,CAAC;EACxE;EAEA,IAAI;IACF,MAAMO,MAAM,GAAG,IAAIC,GAAG,CAACH,GAAG,CAAC;IAC3B,IAAI,CAACE,MAAM,CAACE,QAAQ,CAACC,UAAU,CAAC,MAAM,CAAC,EAAE;MACvC,MAAM,IAAIC,KAAK,CAAC,kBAAkB,CAAC;IACrC;EACF,CAAC,CAAC,MAAM;IACN,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AAE,EAChC;MACA,MAAM,IAAIrD,YAAY,CACpB,+DACF,CAAC;IACH;IACAkB,kBAAkB,CAChBsB,QAAQ,CAACY,OAAO,CAACJ,SAAS,EAC1B,4BACF,CAAC;IACDjC,sBAAsB,CACpByB,QAAQ,CAACY,OAAO,CAACH,QAAQ,EACzB,2BACF,CAAC;EACH;;EAEA;EACA,IAAIT,QAAQ,CAACc,MAAM,EAAE;IACnB,IACE,CAACC,KAAK,CAACC,OAAO,CAAChB,QAAQ,CAACc,MAAM,CAACG,KAAK,CAAC,IACrCjB,QAAQ,CAACc,MAAM,CAACG,KAAK,CAACnD,MAAM,KAAK,CAAC,EAClC;MACA,MAAM,IAAIN,YAAY,CACpB,iDACF,CAAC;IACH;IAEAwC,QAAQ,CAACc,MAAM,CAACG,KAAK,CAACC,OAAO,CAAC,CAACvC,IAAY,EAAEwC,KAAa,KAAK;MAC7DzC,kBAAkB,CAACC,IAAI,EAAE,yBAAyBwC,KAAK,GAAG,CAAC;IAC7D,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* HTTP utilities for error handling and request management
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export class LinaPayError extends Error {
|
|
8
|
+
constructor(message, statusCode, originalError) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.statusCode = statusCode;
|
|
11
|
+
this.originalError = originalError;
|
|
12
|
+
this.name = 'LinaPayError';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Handle HTTP response errors
|
|
18
|
+
*/
|
|
19
|
+
export async function handleHttpError(response) {
|
|
20
|
+
let errorMessage = `HTTP ${response.status}: ${response.statusText}`;
|
|
21
|
+
try {
|
|
22
|
+
const errorBody = await response.json();
|
|
23
|
+
if (errorBody && typeof errorBody === 'object' && 'error_description' in errorBody) {
|
|
24
|
+
errorMessage = String(errorBody.error_description);
|
|
25
|
+
} else if (errorBody && typeof errorBody === 'object' && 'message' in errorBody) {
|
|
26
|
+
errorMessage = String(errorBody.message);
|
|
27
|
+
} else if (errorBody && typeof errorBody === 'object' && 'error' in errorBody) {
|
|
28
|
+
errorMessage = String(errorBody.error);
|
|
29
|
+
}
|
|
30
|
+
} catch {
|
|
31
|
+
// If response is not JSON, use default message
|
|
32
|
+
}
|
|
33
|
+
throw new LinaPayError(errorMessage, response.status);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Validate credentials before making requests
|
|
38
|
+
*/
|
|
39
|
+
export function validateCredentials(subtenantId, subtenantSecret) {
|
|
40
|
+
if (!subtenantId || subtenantId.trim() === '') {
|
|
41
|
+
throw new LinaPayError('subtenantId is required and cannot be empty');
|
|
42
|
+
}
|
|
43
|
+
if (!subtenantSecret || subtenantSecret.trim() === '') {
|
|
44
|
+
throw new LinaPayError('subtenantSecret is required and cannot be empty');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Handle network errors
|
|
50
|
+
*/
|
|
51
|
+
export function handleNetworkError(error) {
|
|
52
|
+
if (error instanceof LinaPayError) {
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
const message = error instanceof Error ? `Network error: ${error.message}` : 'Unknown network error occurred';
|
|
56
|
+
throw new LinaPayError(message, undefined, error);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=http.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LinaPayError","Error","constructor","message","statusCode","originalError","name","handleHttpError","response","errorMessage","status","statusText","errorBody","json","String","error_description","error","validateCredentials","subtenantId","subtenantSecret","trim","handleNetworkError","undefined"],"sourceRoot":"../../../src","sources":["utils/http.utils.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,OAAO,MAAMA,YAAY,SAASC,KAAK,CAAC;EACtCC,WAAWA,C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AAI,CAAC,CAAC,KAAK,EAAE,EAAE;IACrD,MAAM,IAAIpB,YAAY,CAAC,iDAAiD,CAAC;EAC3E;AACF;;AAEA;AACA;AACA;AACA,OAAO,SAASqB,kBAAkBA,CAACL,KAAc,EAAS;EACxD,IAAIA,KAAK,YAAYhB,YAAY,EAAE;IACjC,MAAMgB,KAAK;EACb;EAEA,MAAMb,OAAO,GACXa,KAAK,YAAYf,KAAK,GAClB,kBAAkBe,KAAK,CAACb,OAAO,EAAE,GACjC,gCAAgC;EAEtC,MAAM,IAAIH,YAAY,CAACG,OAAO,EAAEmB,SAAS,EAAEN,KAAK,CAAC;AACnD","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Payment utilities for payload validation
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { LinaPayError } from "./http.utils.js";
|
|
8
|
+
/**
|
|
9
|
+
* Validate required string field
|
|
10
|
+
*/
|
|
11
|
+
function validateRequiredString(value, fieldName) {
|
|
12
|
+
if (!value || value.trim() === '') {
|
|
13
|
+
throw new LinaPayError(`${fieldName} is required and cannot be empty`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Validate payment payload before sending to API
|
|
19
|
+
* Throws LinaPayError if validation fails
|
|
20
|
+
*/
|
|
21
|
+
export function validatePaymentPayload(payload) {
|
|
22
|
+
validateRequiredString(payload.state, 'state');
|
|
23
|
+
validateRequiredString(payload.code, 'code');
|
|
24
|
+
validateRequiredString(payload.idToken, 'idToken');
|
|
25
|
+
validateRequiredString(payload.tenantId, 'tenantId');
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=payment.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LinaPayError","validateRequiredString","value","fieldName","trim","validatePaymentPayload","payload","state","code","idToken","tenantId"],"sourceRoot":"../../../src","sources":["utils/payment.utils.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,SAASA,YAAY,QAAQ,iBAAc;AAG3C;AACA;AACA;AACA,SAASC,sBAAsBA,CAC7BC,KAAyB,EACzBC,SAAiB,EACX;EACN,IAAI,CAACD,KAAK,IAAIA,KAAK,CAACE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;IACjC,MAAM,IAAIJ,YAAY,CAAC,GAAGG,SAAS,kCAAkC,CAAC;EACxE;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASE,sBAAsBA,CACpCC,OAA6B,EACvB;EACNL,sBAAsB,CAACK,OAAO,CAACC,KAAK,EAAE,OAAO,CAAC;EAC9CN,sBAAsB,CAACK,OAAO,CAACE,IAAI,EAAE,MAAM,CAAC;EAC5CP,sBAAsB,CAACK,OAAO,CAACG,OAAO,EAAE,SAAS,CAAC;EAClDR,sBAAsB,CAACK,OAAO,CAACI,QAAQ,EAAE,UAAU,CAAC;AACtD","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment configuration for Lina Pay SDK
|
|
3
|
+
* Allows configuration of base URLs for different environments (HML, Production)
|
|
4
|
+
*/
|
|
5
|
+
export interface LinaPayConfig {
|
|
6
|
+
iamBaseUrl: string;
|
|
7
|
+
apiBaseUrl: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Configure SDK with custom environment URLs
|
|
11
|
+
* @param config Partial configuration to override defaults
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* LinaPaySdk.configure({
|
|
15
|
+
* iamBaseUrl: 'https://iam.prod.linaob.com.br',
|
|
16
|
+
* apiBaseUrl: 'https://embedded-payment-manager.prod.linaob.com.br'
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function configure(config: Partial<LinaPayConfig>): void;
|
|
21
|
+
/**
|
|
22
|
+
* Get current configuration
|
|
23
|
+
*/
|
|
24
|
+
export declare function getConfig(): LinaPayConfig;
|
|
25
|
+
/**
|
|
26
|
+
* Reset configuration to defaults (useful for testing)
|
|
27
|
+
*/
|
|
28
|
+
export declare function resetConfig(): void;
|
|
29
|
+
/**
|
|
30
|
+
* API Endpoints
|
|
31
|
+
*/
|
|
32
|
+
export declare const ENDPOINTS: {
|
|
33
|
+
readonly TOKEN: "/realms/ob-epp/protocol/openid-connect/token";
|
|
34
|
+
readonly PARTICIPANTS: "/api/v1/open-integration/participants/registered";
|
|
35
|
+
readonly CONSENTS: "/api/v1/open-integration/consents";
|
|
36
|
+
readonly PAYMENTS: "/api/v1/open-integration/payments";
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../../src/config/environment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AASD;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAK9D;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,aAAa,CAEzC;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;CAKZ,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lina Pay SDK - React Native SDK for Open Finance Payments
|
|
3
|
+
*/
|
|
4
|
+
import type { LinaPayCredentials, Participant, LinaPayConfig, CreateConsentRequest, CreateConsentResponse, CreatePaymentRequest, CreatePaymentResponse } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Get list of registered participants from Lina Open Finance
|
|
7
|
+
*
|
|
8
|
+
* @param credentials Subtenant credentials (subtenantId and subtenantSecret)
|
|
9
|
+
* @returns Promise with array of participants
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const participants = await LinaPaySdk.getParticipants({
|
|
14
|
+
* subtenantId: 'your-subtenant-id',
|
|
15
|
+
* subtenantSecret: 'your-subtenant-secret'
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function getParticipants(credentials: LinaPayCredentials): Promise<Participant[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Create payment consent
|
|
22
|
+
*
|
|
23
|
+
* @param credentials Subtenant credentials (subtenantId and subtenantSecret)
|
|
24
|
+
* @param payload Consent creation payload with payment details
|
|
25
|
+
* @returns Promise with consent creation response including consentId and status
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const consent = await LinaPaySdk.createConsent(
|
|
30
|
+
* {
|
|
31
|
+
* subtenantId: 'your-subtenant-id',
|
|
32
|
+
* subtenantSecret: 'your-subtenant-secret'
|
|
33
|
+
* },
|
|
34
|
+
* {
|
|
35
|
+
* organisationId: 'c8f0bf49-4744-4933-8960-7add6e590841',
|
|
36
|
+
* authorisationServerId: 'c8f0bf49-4744-4933-8960-7add6e590841',
|
|
37
|
+
* payment: {
|
|
38
|
+
* redirectUri: 'http://example.com/redirect',
|
|
39
|
+
* value: 1500.50,
|
|
40
|
+
* creditor: {
|
|
41
|
+
* name: 'John Doe',
|
|
42
|
+
* personType: 'PESSOA_NATURAL',
|
|
43
|
+
* cpfCnpj: '12345678901234',
|
|
44
|
+
* accountNumber: '1234567890',
|
|
45
|
+
* accountIssuer: '0001',
|
|
46
|
+
* accountPixKey: 'email@example.com',
|
|
47
|
+
* accountIspb: '12345678',
|
|
48
|
+
* accountType: 'CACC'
|
|
49
|
+
* }
|
|
50
|
+
* },
|
|
51
|
+
* platform: 'APP'
|
|
52
|
+
* }
|
|
53
|
+
* );
|
|
54
|
+
* console.log('Consent ID:', consent.consentId);
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function createConsent(credentials: LinaPayCredentials, payload: CreateConsentRequest): Promise<CreateConsentResponse>;
|
|
58
|
+
/**
|
|
59
|
+
* Create payment
|
|
60
|
+
*
|
|
61
|
+
* @param credentials Subtenant credentials (subtenantId and subtenantSecret)
|
|
62
|
+
* @param payload Payment creation payload with state, code, idToken, and tenantId
|
|
63
|
+
* @returns Promise with payment creation response including payment details
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* const payment = await LinaPaySdk.createPayment(
|
|
68
|
+
* {
|
|
69
|
+
* subtenantId: 'your-subtenant-id',
|
|
70
|
+
* subtenantSecret: 'your-subtenant-secret'
|
|
71
|
+
* },
|
|
72
|
+
* {
|
|
73
|
+
* state: 'rumUP',
|
|
74
|
+
* code: '1RDYVFQnPn721',
|
|
75
|
+
* idToken: 'eyJhbGciOiJQUz',
|
|
76
|
+
* tenantId: 'tenantId'
|
|
77
|
+
* }
|
|
78
|
+
* );
|
|
79
|
+
* console.log('Payment ID:', payment.id);
|
|
80
|
+
* console.log('Status:', payment.status);
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function createPayment(credentials: LinaPayCredentials, payload: CreatePaymentRequest): Promise<CreatePaymentResponse>;
|
|
84
|
+
/**
|
|
85
|
+
* Configure SDK environment (base URLs)
|
|
86
|
+
*
|
|
87
|
+
* @param config Partial configuration to override defaults
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* // Configure for production
|
|
92
|
+
* LinaPaySdk.configure({
|
|
93
|
+
* iamBaseUrl: 'https://iam.prod.linaob.com.br',
|
|
94
|
+
* apiBaseUrl: 'https://embedded-payment-manager.prod.linaob.com.br'
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare function configure(config: Partial<LinaPayConfig>): void;
|
|
99
|
+
export type { LinaPayCredentials, Participant, LinaPayConfig, CreateConsentRequest, CreateConsentResponse, CreatePaymentRequest, CreatePaymentResponse, Payment, Creditor, Debitor, Schedule, PersonType, AccountType, Platform, PaymentItem, PaymentCreditor, PaymentDebitor, PaymentType, PaymentStatus, } from './types';
|
|
100
|
+
export { LinaPayError } from './utils/http.utils';
|
|
101
|
+
declare const _default: {
|
|
102
|
+
getParticipants: typeof getParticipants;
|
|
103
|
+
createConsent: typeof createConsent;
|
|
104
|
+
createPayment: typeof createPayment;
|
|
105
|
+
configure: typeof configure;
|
|
106
|
+
};
|
|
107
|
+
export default _default;
|
|
108
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;GAaG;AACH,wBAAsB,eAAe,CACnC,WAAW,EAAE,kBAAkB,GAC9B,OAAO,CAAC,WAAW,EAAE,CAAC,CAMxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,aAAa,CACjC,WAAW,EAAE,kBAAkB,EAC/B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CAMhC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,aAAa,CACjC,WAAW,EAAE,kBAAkB,EAC/B,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CAMhC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAE9D;AAGD,YAAY,EACV,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,OAAO,EACP,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,UAAU,EACV,WAAW,EACX,QAAQ,EACR,WAAW,EACX,eAAe,EACf,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;;;;;;;AAGlD,wBAKE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication service for OAuth2 token management
|
|
3
|
+
*/
|
|
4
|
+
import type { LinaPayCredentials } from '../types/auth.types';
|
|
5
|
+
/**
|
|
6
|
+
* Get access token from cache or request new one
|
|
7
|
+
*/
|
|
8
|
+
export declare function getAccessToken(credentials: LinaPayCredentials): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Clear token cache (useful for testing or manual logout)
|
|
11
|
+
*/
|
|
12
|
+
export declare function clearTokenCache(): void;
|
|
13
|
+
//# sourceMappingURL=auth.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../../../src/services/auth.service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,kBAAkB,EAGnB,MAAM,qBAAqB,CAAC;AAW7B;;GAEG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,kBAAkB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAWjB;AA8CD;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAEtC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consent service for creating payment consents
|
|
3
|
+
*/
|
|
4
|
+
import type { CreateConsentRequest, CreateConsentResponse } from '../types/consent.types';
|
|
5
|
+
/**
|
|
6
|
+
* Create payment consent
|
|
7
|
+
*/
|
|
8
|
+
export declare function createConsent(accessToken: string, payload: CreateConsentRequest): Promise<CreateConsentResponse>;
|
|
9
|
+
//# sourceMappingURL=consent.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent.service.d.ts","sourceRoot":"","sources":["../../../../src/services/consent.service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EAEtB,MAAM,wBAAwB,CAAC;AAIhC;;GAEG;AACH,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CA0ChC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Participants service for fetching and transforming participant data
|
|
3
|
+
*/
|
|
4
|
+
import type { Participant } from '../types/participants.types';
|
|
5
|
+
/**
|
|
6
|
+
* Fetch participants list from API
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchParticipants(accessToken: string): Promise<Participant[]>;
|
|
9
|
+
//# sourceMappingURL=participants.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"participants.service.d.ts","sourceRoot":"","sources":["../../../../src/services/participants.service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,WAAW,EAIZ,MAAM,6BAA6B,CAAC;AAGrC;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,WAAW,EAAE,CAAC,CAwBxB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payment service for creating payments
|
|
3
|
+
*/
|
|
4
|
+
import type { CreatePaymentRequest, CreatePaymentResponse } from '../types/payment.types';
|
|
5
|
+
/**
|
|
6
|
+
* Create payment
|
|
7
|
+
*/
|
|
8
|
+
export declare function createPayment(accessToken: string, payload: CreatePaymentRequest): Promise<CreatePaymentResponse>;
|
|
9
|
+
//# sourceMappingURL=payment.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment.service.d.ts","sourceRoot":"","sources":["../../../../src/services/payment.service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EAEtB,MAAM,wBAAwB,CAAC;AAIhC;;GAEG;AACH,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CA4BhC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credentials for Lina Pay SDK authentication
|
|
3
|
+
*/
|
|
4
|
+
export interface LinaPayCredentials {
|
|
5
|
+
subtenantId: string;
|
|
6
|
+
subtenantSecret: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* OAuth2 token response from IAM
|
|
10
|
+
*/
|
|
11
|
+
export interface TokenResponse {
|
|
12
|
+
access_token: string;
|
|
13
|
+
token_type: string;
|
|
14
|
+
expires_in: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Cached token with expiration tracking
|
|
18
|
+
*/
|
|
19
|
+
export interface CachedToken {
|
|
20
|
+
accessToken: string;
|
|
21
|
+
expiresAt: number;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=auth.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.types.d.ts","sourceRoot":"","sources":["../../../../src/types/auth.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consent types for payment consent creation
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Person type for creditor
|
|
6
|
+
*/
|
|
7
|
+
export type PersonType = 'PESSOA_NATURAL' | 'PESSOA_JURIDICA';
|
|
8
|
+
/**
|
|
9
|
+
* Account type
|
|
10
|
+
*/
|
|
11
|
+
export type AccountType = 'CACC' | 'SLRY' | 'SVGS' | 'TRAN';
|
|
12
|
+
/**
|
|
13
|
+
* Day of week for weekly schedule
|
|
14
|
+
*/
|
|
15
|
+
export type DayOfWeek = 'SEGUNDA_FEIRA' | 'TERCA_FEIRA' | 'QUARTA_FEIRA' | 'QUINTA_FEIRA' | 'SEXTA_FEIRA' | 'SABADO' | 'DOMINGO';
|
|
16
|
+
/**
|
|
17
|
+
* Platform type
|
|
18
|
+
*/
|
|
19
|
+
export type Platform = 'APP' | 'WEB';
|
|
20
|
+
/**
|
|
21
|
+
* Creditor information (payment recipient)
|
|
22
|
+
*/
|
|
23
|
+
export interface Creditor {
|
|
24
|
+
name: string;
|
|
25
|
+
personType: PersonType;
|
|
26
|
+
cpfCnpj: string;
|
|
27
|
+
accountNumber: string;
|
|
28
|
+
accountIssuer: string;
|
|
29
|
+
accountPixKey: string;
|
|
30
|
+
accountIspb: string;
|
|
31
|
+
accountType: AccountType;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Debitor information (payment sender)
|
|
35
|
+
*/
|
|
36
|
+
export interface Debitor {
|
|
37
|
+
accountNumber?: string;
|
|
38
|
+
accountIssuer?: string;
|
|
39
|
+
accountIspb?: string;
|
|
40
|
+
accountType?: AccountType;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Single payment schedule
|
|
44
|
+
*/
|
|
45
|
+
export interface SingleSchedule {
|
|
46
|
+
date: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Daily recurring payment schedule
|
|
50
|
+
*/
|
|
51
|
+
export interface DailySchedule {
|
|
52
|
+
startDate: string;
|
|
53
|
+
quantity: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Weekly recurring payment schedule
|
|
57
|
+
*/
|
|
58
|
+
export interface WeeklySchedule {
|
|
59
|
+
dayOfWeek: DayOfWeek;
|
|
60
|
+
startDate: string;
|
|
61
|
+
quantity: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Monthly recurring payment schedule
|
|
65
|
+
*/
|
|
66
|
+
export interface MonthlySchedule {
|
|
67
|
+
dayOfMonth: number;
|
|
68
|
+
startDate: string;
|
|
69
|
+
quantity: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Custom payment schedule with specific dates
|
|
73
|
+
*/
|
|
74
|
+
export interface CustomSchedule {
|
|
75
|
+
dates: string[];
|
|
76
|
+
additionalInformation?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Payment schedule (only one type should be provided)
|
|
80
|
+
*/
|
|
81
|
+
export interface Schedule {
|
|
82
|
+
single?: SingleSchedule;
|
|
83
|
+
daily?: DailySchedule;
|
|
84
|
+
weekly?: WeeklySchedule;
|
|
85
|
+
monthly?: MonthlySchedule;
|
|
86
|
+
custom?: CustomSchedule;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Payment information
|
|
90
|
+
*/
|
|
91
|
+
export interface Payment {
|
|
92
|
+
details?: string;
|
|
93
|
+
externalId?: string;
|
|
94
|
+
redirectUri: string;
|
|
95
|
+
cpfCnpj?: string;
|
|
96
|
+
value: number;
|
|
97
|
+
creditor: Creditor;
|
|
98
|
+
debitor?: Debitor;
|
|
99
|
+
originalRecurringPaymentId?: string;
|
|
100
|
+
schedule?: Schedule;
|
|
101
|
+
txId?: string | string[];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Request payload for consent creation
|
|
105
|
+
*/
|
|
106
|
+
export interface CreateConsentRequest {
|
|
107
|
+
organisationId: string;
|
|
108
|
+
authorisationServerId: string;
|
|
109
|
+
payment: Payment;
|
|
110
|
+
redirectUri?: string;
|
|
111
|
+
platform?: Platform;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Response from consent creation API
|
|
115
|
+
*/
|
|
116
|
+
export interface CreateConsentResponse {
|
|
117
|
+
consentId: string;
|
|
118
|
+
redirectUrl: string;
|
|
119
|
+
id: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* API response wrapper
|
|
123
|
+
*/
|
|
124
|
+
export interface CreateConsentApiResponse {
|
|
125
|
+
data: CreateConsentResponse;
|
|
126
|
+
message: string;
|
|
127
|
+
type: 'success' | 'error';
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=consent.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent.types.d.ts","sourceRoot":"","sources":["../../../../src/types/consent.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,eAAe,GACf,aAAa,GACb,cAAc,GACd,cAAc,GACd,aAAa,GACb,QAAQ,GACR,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,UAAU,CA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