@pixelpay/capacitor-plugin 0.0.1

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.
@@ -0,0 +1,113 @@
1
+ import Response from '@pixelpay/sdk-core/lib/base/Response';
2
+ import type Settings from '@pixelpay/sdk-core/lib/models/Settings';
3
+ import type AuthTransaction from '@pixelpay/sdk-core/lib/requests/AuthTransaction';
4
+ import type CaptureTransaction from '@pixelpay/sdk-core/lib/requests/CaptureTransaction';
5
+ import type CardTokenization from '@pixelpay/sdk-core/lib/requests/CardTokenization';
6
+ import type SaleTransaction from '@pixelpay/sdk-core/lib/requests/SaleTransaction';
7
+ import type StatusTransaction from '@pixelpay/sdk-core/lib/requests/StatusTransaction';
8
+ import type VoidTransaction from '@pixelpay/sdk-core/lib/requests/VoidTransaction';
9
+ declare class ServiceBehaviour {
10
+ _settings: Settings;
11
+ constructor(settings: Settings);
12
+ getSettings(): string;
13
+ parseResult(result: {
14
+ status: number;
15
+ response: string;
16
+ }): Response;
17
+ }
18
+ declare class Transaction extends ServiceBehaviour {
19
+ /**
20
+ * Send and proccesing SALE transaction
21
+ *
22
+ * @param transaction
23
+ * @return
24
+ * @throws InvalidCredentialsException
25
+ */
26
+ doSale(transaction: SaleTransaction): Promise<Response>;
27
+ /**
28
+ * Send and proccesing AUTH transaction
29
+ *
30
+ * @param transaction
31
+ * @return
32
+ * @throws InvalidCredentialsException
33
+ */
34
+ doAuth(transaction: AuthTransaction): Promise<Response>;
35
+ /**
36
+ * Send and proccesing CAPTURE transaction
37
+ *
38
+ * @param transaction
39
+ * @return
40
+ * @throws InvalidCredentialsException
41
+ */
42
+ doCapture(transaction: CaptureTransaction): Promise<Response>;
43
+ /**
44
+ * Send and proccesing VOID transaction
45
+ *
46
+ * @param transaction
47
+ * @return
48
+ * @throws InvalidCredentialsException
49
+ */
50
+ doVoid(transaction: VoidTransaction): Promise<Response>;
51
+ /**
52
+ * Send and proccesing SALE transaction
53
+ *
54
+ * @param transaction
55
+ * @return
56
+ * @throws InvalidCredentialsException
57
+ */
58
+ getStatus(transaction: StatusTransaction): Promise<Response>;
59
+ /**
60
+ * Verify a payment hash and returns true if payment response is not modified
61
+ *
62
+ * @param hash
63
+ * @param order_id
64
+ * @param secret
65
+ * @return
66
+ */
67
+ verifyPaymentHash(hash: string, order_id: string, secret: string): boolean;
68
+ }
69
+ declare class Tokenization extends ServiceBehaviour {
70
+ /**
71
+ * Vault credit/debit card and obtain a token card identifier (T-* format)
72
+ *
73
+ * @param card
74
+ * @return
75
+ * @throws InvalidCredentialsException
76
+ */
77
+ vaultCard(card: CardTokenization): Promise<Response>;
78
+ /**
79
+ * Update credit/debit card by token card identifier
80
+ *
81
+ * @param token
82
+ * @param card
83
+ * @return
84
+ * @throws InvalidCredentialsException
85
+ */
86
+ updateCard(token: string, card: CardTokenization): Promise<Response>;
87
+ /**
88
+ * Show credit/debit card metadata by token card identifier
89
+ *
90
+ * @param token
91
+ * @return
92
+ * @throws InvalidCredentialsException
93
+ */
94
+ showCard(token: string): Promise<Response>;
95
+ /**
96
+ * Show credit/debit card metadata by token card identifier
97
+ *
98
+ * @param token
99
+ * @return
100
+ * @throws InvalidCredentialsException
101
+ */
102
+ showCards(tokens: string[]): Promise<Response>;
103
+ /**
104
+ * Delete credit/debit card metadata by token card identifier
105
+ *
106
+ * @param token
107
+ * @return
108
+ * @throws InvalidCredentialsException
109
+ */
110
+ deleteCard(token: string): Promise<Response>;
111
+ }
112
+ export * from './definitions';
113
+ export { Transaction, Tokenization };
@@ -0,0 +1,227 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ import Response from '@pixelpay/sdk-core/lib/base/Response';
3
+ import ErrorResponse from '@pixelpay/sdk-core/lib/responses/ErrorResponse';
4
+ import FailureResponse from '@pixelpay/sdk-core/lib/responses/FailureResponse';
5
+ import InputErrorResponse from '@pixelpay/sdk-core/lib/responses/InputErrorResponse';
6
+ import NetworkFailureResponse from '@pixelpay/sdk-core/lib/responses/NetworkFailureResponse';
7
+ import NoAccessResponse from '@pixelpay/sdk-core/lib/responses/NoAccessResponse';
8
+ import NotFoundResponse from '@pixelpay/sdk-core/lib/responses/NotFoundResponse';
9
+ import PayloadResponse from '@pixelpay/sdk-core/lib/responses/PayloadResponse';
10
+ import PaymentDeclinedResponse from '@pixelpay/sdk-core/lib/responses/PaymentDeclinedResponse';
11
+ import PreconditionalResponse from '@pixelpay/sdk-core/lib/responses/PreconditionalResponse';
12
+ import SuccessResponse from '@pixelpay/sdk-core/lib/responses/SuccessResponse';
13
+ import TimeoutResponse from '@pixelpay/sdk-core/lib/responses/TimeoutResponse';
14
+ import BaseTransaction from '@pixelpay/sdk-core/lib/services/Transaction';
15
+ const PixelPaySDK = registerPlugin('PixelPaySDK', {
16
+ web: () => import('./web').then(m => new m.PixelPaySDKWeb()),
17
+ });
18
+ class ServiceBehaviour {
19
+ constructor(settings) {
20
+ this._settings = settings;
21
+ }
22
+ getSettings() {
23
+ return JSON.stringify(this._settings);
24
+ }
25
+ parseResult(result) {
26
+ let response = new Response();
27
+ const data = JSON.parse(result.response);
28
+ switch (result.status) {
29
+ case 200:
30
+ response = new SuccessResponse();
31
+ break;
32
+ case 202:
33
+ response = new PayloadResponse();
34
+ break;
35
+ case 400:
36
+ response = new ErrorResponse();
37
+ break;
38
+ case 401:
39
+ case 403:
40
+ response = new NoAccessResponse();
41
+ break;
42
+ case 402:
43
+ response = new PaymentDeclinedResponse();
44
+ break;
45
+ case 404:
46
+ case 405:
47
+ case 406:
48
+ response = new NotFoundResponse();
49
+ break;
50
+ case 408:
51
+ response = new TimeoutResponse();
52
+ break;
53
+ case 412:
54
+ case 418:
55
+ response = new PreconditionalResponse();
56
+ break;
57
+ case 422:
58
+ response = new InputErrorResponse();
59
+ break;
60
+ case 500:
61
+ response = new FailureResponse();
62
+ break;
63
+ default:
64
+ if (result.status > 500) {
65
+ response = new NetworkFailureResponse();
66
+ }
67
+ break;
68
+ }
69
+ response.setStatus(result.status);
70
+ response.action = (data === null || data === void 0 ? void 0 : data.action) || null;
71
+ response.success = (data === null || data === void 0 ? void 0 : data.success) || false;
72
+ response.message = (data === null || data === void 0 ? void 0 : data.message) || null;
73
+ response.data = (data === null || data === void 0 ? void 0 : data.data) || null;
74
+ response.errors = (data === null || data === void 0 ? void 0 : data.errors) || null;
75
+ return response;
76
+ }
77
+ }
78
+ class Transaction extends ServiceBehaviour {
79
+ /**
80
+ * Send and proccesing SALE transaction
81
+ *
82
+ * @param transaction
83
+ * @return
84
+ * @throws InvalidCredentialsException
85
+ */
86
+ async doSale(transaction) {
87
+ return this.parseResult(await PixelPaySDK.transactionDoSale({
88
+ settings: this.getSettings(),
89
+ request: transaction.toJson()
90
+ }));
91
+ }
92
+ /**
93
+ * Send and proccesing AUTH transaction
94
+ *
95
+ * @param transaction
96
+ * @return
97
+ * @throws InvalidCredentialsException
98
+ */
99
+ async doAuth(transaction) {
100
+ return this.parseResult(await PixelPaySDK.transactionDoAuth({
101
+ settings: this.getSettings(),
102
+ request: transaction.toJson()
103
+ }));
104
+ }
105
+ /**
106
+ * Send and proccesing CAPTURE transaction
107
+ *
108
+ * @param transaction
109
+ * @return
110
+ * @throws InvalidCredentialsException
111
+ */
112
+ async doCapture(transaction) {
113
+ return this.parseResult(await PixelPaySDK.transactionDoCapture({
114
+ settings: this.getSettings(),
115
+ request: transaction.toJson()
116
+ }));
117
+ }
118
+ /**
119
+ * Send and proccesing VOID transaction
120
+ *
121
+ * @param transaction
122
+ * @return
123
+ * @throws InvalidCredentialsException
124
+ */
125
+ async doVoid(transaction) {
126
+ return this.parseResult(await PixelPaySDK.transactionDoVoid({
127
+ settings: this.getSettings(),
128
+ request: transaction.toJson()
129
+ }));
130
+ }
131
+ /**
132
+ * Send and proccesing SALE transaction
133
+ *
134
+ * @param transaction
135
+ * @return
136
+ * @throws InvalidCredentialsException
137
+ */
138
+ async getStatus(transaction) {
139
+ return this.parseResult(await PixelPaySDK.transactionGetStatus({
140
+ settings: this.getSettings(),
141
+ request: transaction.toJson()
142
+ }));
143
+ }
144
+ /**
145
+ * Verify a payment hash and returns true if payment response is not modified
146
+ *
147
+ * @param hash
148
+ * @param order_id
149
+ * @param secret
150
+ * @return
151
+ */
152
+ verifyPaymentHash(hash, order_id, secret) {
153
+ return (new BaseTransaction(this._settings)).verifyPaymentHash(hash, order_id, secret);
154
+ }
155
+ }
156
+ class Tokenization extends ServiceBehaviour {
157
+ /**
158
+ * Vault credit/debit card and obtain a token card identifier (T-* format)
159
+ *
160
+ * @param card
161
+ * @return
162
+ * @throws InvalidCredentialsException
163
+ */
164
+ async vaultCard(card) {
165
+ return this.parseResult(await PixelPaySDK.tokenizationVaultCard({
166
+ settings: this.getSettings(),
167
+ request: card.toJson()
168
+ }));
169
+ }
170
+ /**
171
+ * Update credit/debit card by token card identifier
172
+ *
173
+ * @param token
174
+ * @param card
175
+ * @return
176
+ * @throws InvalidCredentialsException
177
+ */
178
+ async updateCard(token, card) {
179
+ return this.parseResult(await PixelPaySDK.tokenizationUpdateCard({
180
+ settings: this.getSettings(),
181
+ token: token,
182
+ request: card.toJson()
183
+ }));
184
+ }
185
+ /**
186
+ * Show credit/debit card metadata by token card identifier
187
+ *
188
+ * @param token
189
+ * @return
190
+ * @throws InvalidCredentialsException
191
+ */
192
+ async showCard(token) {
193
+ return this.parseResult(await PixelPaySDK.tokenizationShowCard({
194
+ settings: this.getSettings(),
195
+ token: token
196
+ }));
197
+ }
198
+ /**
199
+ * Show credit/debit card metadata by token card identifier
200
+ *
201
+ * @param token
202
+ * @return
203
+ * @throws InvalidCredentialsException
204
+ */
205
+ async showCards(tokens) {
206
+ return this.parseResult(await PixelPaySDK.tokenizationShowCards({
207
+ settings: this.getSettings(),
208
+ tokens: tokens.join('|')
209
+ }));
210
+ }
211
+ /**
212
+ * Delete credit/debit card metadata by token card identifier
213
+ *
214
+ * @param token
215
+ * @return
216
+ * @throws InvalidCredentialsException
217
+ */
218
+ async deleteCard(token) {
219
+ return this.parseResult(await PixelPaySDK.tokenizationDeleteCard({
220
+ settings: this.getSettings(),
221
+ token: token
222
+ }));
223
+ }
224
+ }
225
+ export * from './definitions';
226
+ export { Transaction, Tokenization };
227
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,QAAQ,MAAM,sCAAsC,CAAC;AAQ5D,OAAO,aAAa,MAAM,gDAAgD,CAAC;AAC3E,OAAO,eAAe,MAAM,kDAAkD,CAAC;AAC/E,OAAO,kBAAkB,MAAM,qDAAqD,CAAC;AACrF,OAAO,sBAAsB,MAAM,yDAAyD,CAAC;AAC7F,OAAO,gBAAgB,MAAM,mDAAmD,CAAC;AACjF,OAAO,gBAAgB,MAAM,mDAAmD,CAAC;AACjF,OAAO,eAAe,MAAM,kDAAkD,CAAC;AAC/E,OAAO,uBAAuB,MAAM,0DAA0D,CAAC;AAC/F,OAAO,sBAAsB,MAAM,yDAAyD,CAAC;AAC7F,OAAO,eAAe,MAAM,kDAAkD,CAAC;AAC/E,OAAO,eAAe,MAAM,kDAAkD,CAAC;AAC/E,OAAO,eAAe,MAAM,6CAA6C,CAAC;AAI1E,MAAM,WAAW,GAAG,cAAc,CAAoB,aAAa,EAAE;IACpE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;CAC5D,CAAC,CAAC;AAEH,MAAM,gBAAgB;IAGrB,YAAY,QAAkB;QAC7B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,WAAW;QACV,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,WAAW,CAAC,MAA4C;QACvD,IAAI,QAAQ,GAA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import { registerPlugin } from '@capacitor/core';\nimport Response from '@pixelpay/sdk-core/lib/base/Response';\nimport type Settings from '@pixelpay/sdk-core/lib/models/Settings';\nimport type AuthTransaction from '@pixelpay/sdk-core/lib/requests/AuthTransaction';\nimport type CaptureTransaction from '@pixelpay/sdk-core/lib/requests/CaptureTransaction';\nimport type CardTokenization from '@pixelpay/sdk-core/lib/requests/CardTokenization';\nimport type SaleTransaction from '@pixelpay/sdk-core/lib/requests/SaleTransaction';\nimport type StatusTransaction from '@pixelpay/sdk-core/lib/requests/StatusTransaction';\nimport type VoidTransaction from '@pixelpay/sdk-core/lib/requests/VoidTransaction';\nimport ErrorResponse from '@pixelpay/sdk-core/lib/responses/ErrorResponse';\nimport FailureResponse from '@pixelpay/sdk-core/lib/responses/FailureResponse';\nimport InputErrorResponse from '@pixelpay/sdk-core/lib/responses/InputErrorResponse';\nimport NetworkFailureResponse from '@pixelpay/sdk-core/lib/responses/NetworkFailureResponse';\nimport NoAccessResponse from '@pixelpay/sdk-core/lib/responses/NoAccessResponse';\nimport NotFoundResponse from '@pixelpay/sdk-core/lib/responses/NotFoundResponse';\nimport PayloadResponse from '@pixelpay/sdk-core/lib/responses/PayloadResponse';\nimport PaymentDeclinedResponse from '@pixelpay/sdk-core/lib/responses/PaymentDeclinedResponse';\nimport PreconditionalResponse from '@pixelpay/sdk-core/lib/responses/PreconditionalResponse';\nimport SuccessResponse from '@pixelpay/sdk-core/lib/responses/SuccessResponse';\nimport TimeoutResponse from '@pixelpay/sdk-core/lib/responses/TimeoutResponse';\nimport BaseTransaction from '@pixelpay/sdk-core/lib/services/Transaction';\n\nimport type { PixelPaySDKPlugin } from './definitions';\n\nconst PixelPaySDK = registerPlugin<PixelPaySDKPlugin>('PixelPaySDK', {\n\tweb: () => import('./web').then(m => new m.PixelPaySDKWeb()),\n});\n\nclass ServiceBehaviour {\n\t_settings: Settings;\n\n\tconstructor(settings: Settings) {\n\t\tthis._settings = settings;\n\t}\n\n\tgetSettings(): string {\n\t\treturn JSON.stringify(this._settings);\n\t}\n\n\tparseResult(result: { status: number, response: string }): Response {\n\t\tlet response = new Response();\n\t\tconst data = JSON.parse(result.response);\n\n\t\tswitch (result.status) {\n\t\t\tcase 200:\n\t\t\t\tresponse = new SuccessResponse();\n\t\t\t\tbreak;\n\t\t\tcase 202:\n\t\t\t\tresponse = new PayloadResponse();\n\t\t\t\tbreak;\n\t\t\tcase 400:\n\t\t\t\tresponse = new ErrorResponse();\n\t\t\t\tbreak;\n\t\t\tcase 401:\n\t\t\tcase 403:\n\t\t\t\tresponse = new NoAccessResponse();\n\t\t\t\tbreak;\n\t\t\tcase 402:\n\t\t\t\tresponse = new PaymentDeclinedResponse();\n\t\t\t\tbreak;\n\t\t\tcase 404:\n\t\t\tcase 405:\n\t\t\tcase 406:\n\t\t\t\tresponse = new NotFoundResponse();\n\t\t\t\tbreak;\n\t\t\tcase 408:\n\t\t\t\tresponse = new TimeoutResponse();\n\t\t\t\tbreak;\n\t\t\tcase 412:\n\t\t\tcase 418:\n\t\t\t\tresponse = new PreconditionalResponse();\n\t\t\t\tbreak;\n\t\t\tcase 422:\n\t\t\t\tresponse = new InputErrorResponse();\n\t\t\t\tbreak;\n\t\t\tcase 500:\n\t\t\t\tresponse = new FailureResponse();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (result.status > 500) {\n\t\t\t\t\tresponse = new NetworkFailureResponse();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\n\t\tresponse.setStatus(result.status);\n\t\tresponse.action = (data === null || data === void 0 ? void 0 : data.action) || null;\n\t\tresponse.success = (data === null || data === void 0 ? void 0 : data.success) || false;\n\t\tresponse.message = (data === null || data === void 0 ? void 0 : data.message) || null;\n\t\tresponse.data = (data === null || data === void 0 ? void 0 : data.data) || null;\n\t\tresponse.errors = (data === null || data === void 0 ? void 0 : data.errors) || null;\n\n\t\treturn response;\n\t}\n}\n\nclass Transaction extends ServiceBehaviour {\n\t/**\n\t * Send and proccesing SALE transaction\n\t *\n\t * @param transaction\n\t * @return\n\t * @throws InvalidCredentialsException\n\t */\n\tasync doSale(transaction: SaleTransaction): Promise<Response> {\n\t\treturn this.parseResult(await PixelPaySDK.transactionDoSale({\n\t\t\tsettings: this.getSettings(),\n\t\t\trequest: transaction.toJson()\n\t\t}));\n\t}\n\n\t/**\n\t * Send and proccesing AUTH transaction\n\t *\n\t * @param transaction\n\t * @return\n\t * @throws InvalidCredentialsException\n\t */\n\tasync doAuth(transaction: AuthTransaction): Promise<Response> {\n\t\treturn this.parseResult(await PixelPaySDK.transactionDoAuth({\n\t\t\tsettings: this.getSettings(),\n\t\t\trequest: transaction.toJson()\n\t\t}));\n\t}\n\n\t/**\n\t * Send and proccesing CAPTURE transaction\n\t *\n\t * @param transaction\n\t * @return\n\t * @throws InvalidCredentialsException\n\t */\n\tasync doCapture(transaction: CaptureTransaction): Promise<Response> {\n\t\treturn this.parseResult(await PixelPaySDK.transactionDoCapture({\n\t\t\tsettings: this.getSettings(),\n\t\t\trequest: transaction.toJson()\n\t\t}));\n\t}\n\n\t/**\n\t * Send and proccesing VOID transaction\n\t *\n\t * @param transaction\n\t * @return\n\t * @throws InvalidCredentialsException\n\t */\n\tasync doVoid(transaction: VoidTransaction): Promise<Response> {\n\t\treturn this.parseResult(await PixelPaySDK.transactionDoVoid({\n\t\t\tsettings: this.getSettings(),\n\t\t\trequest: transaction.toJson()\n\t\t}));\n\t}\n\n\t/**\n\t * Send and proccesing SALE transaction\n\t *\n\t * @param transaction\n\t * @return\n\t * @throws InvalidCredentialsException\n\t */\n\tasync getStatus(transaction: StatusTransaction): Promise<Response> {\n\t\treturn this.parseResult(await PixelPaySDK.transactionGetStatus({\n\t\t\tsettings: this.getSettings(),\n\t\t\trequest: transaction.toJson()\n\t\t}));\n\t}\n\n\t/**\n\t * Verify a payment hash and returns true if payment response is not modified\n\t *\n\t * @param hash\n\t * @param order_id\n\t * @param secret\n\t * @return\n\t */\n\tverifyPaymentHash(hash: string, order_id: string, secret: string): boolean {\n\t\treturn (new BaseTransaction(this._settings)).verifyPaymentHash(hash, order_id, secret);\n\t}\n}\n\nclass Tokenization extends ServiceBehaviour {\n\t/**\n\t * Vault credit/debit card and obtain a token card identifier (T-* format)\n\t *\n\t * @param card\n\t * @return\n\t * @throws InvalidCredentialsException\n\t */\n\tasync vaultCard(card: CardTokenization): Promise<Response> {\n\t\treturn this.parseResult(await PixelPaySDK.tokenizationVaultCard({\n\t\t\tsettings: this.getSettings(),\n\t\t\trequest: card.toJson()\n\t\t}));\n\t}\n\n\t/**\n\t * Update credit/debit card by token card identifier\n\t *\n\t * @param token\n\t * @param card\n\t * @return\n\t * @throws InvalidCredentialsException\n\t */\n\tasync updateCard(token: string, card: CardTokenization): Promise<Response> {\n\t\treturn this.parseResult(await PixelPaySDK.tokenizationUpdateCard({\n\t\t\tsettings: this.getSettings(),\n\t\t\ttoken: token,\n\t\t\trequest: card.toJson()\n\t\t}));\n\t}\n\n\t/**\n\t * Show credit/debit card metadata by token card identifier\n\t *\n\t * @param token\n\t * @return\n\t * @throws InvalidCredentialsException\n\t */\n\tasync showCard(token: string): Promise<Response> {\n\t\treturn this.parseResult(await PixelPaySDK.tokenizationShowCard({\n\t\t\tsettings: this.getSettings(),\n\t\t\ttoken: token\n\t\t}));\n\t}\n\n\t/**\n\t * Show credit/debit card metadata by token card identifier\n\t *\n\t * @param token\n\t * @return\n\t * @throws InvalidCredentialsException\n\t */\n\tasync showCards(tokens: string[]): Promise<Response> {\n\t\treturn this.parseResult(await PixelPaySDK.tokenizationShowCards({\n\t\t\tsettings: this.getSettings(),\n\t\t\ttokens: tokens.join('|')\n\t\t}));\n\t}\n\n\t/**\n\t * Delete credit/debit card metadata by token card identifier\n\t *\n\t * @param token\n\t * @return\n\t * @throws InvalidCredentialsException\n\t */\n\tasync deleteCard(token: string): Promise<Response> {\n\t\treturn this.parseResult(await PixelPaySDK.tokenizationDeleteCard({\n\t\t\tsettings: this.getSettings(),\n\t\t\ttoken: token\n\t\t}));\n\t}\n}\n\nexport * from './definitions';\nexport { Transaction, Tokenization };\n"]}
@@ -0,0 +1,75 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { PixelPaySDKPlugin } from './definitions';
3
+ export declare class PixelPaySDKWeb extends WebPlugin implements PixelPaySDKPlugin {
4
+ transactionDoSale(options: {
5
+ settings: string;
6
+ request: string;
7
+ }): Promise<{
8
+ status: number;
9
+ response: string;
10
+ }>;
11
+ transactionDoAuth(options: {
12
+ settings: string;
13
+ request: string;
14
+ }): Promise<{
15
+ status: number;
16
+ response: string;
17
+ }>;
18
+ transactionDoCapture(options: {
19
+ settings: string;
20
+ request: string;
21
+ }): Promise<{
22
+ status: number;
23
+ response: string;
24
+ }>;
25
+ transactionDoVoid(options: {
26
+ settings: string;
27
+ request: string;
28
+ }): Promise<{
29
+ status: number;
30
+ response: string;
31
+ }>;
32
+ transactionGetStatus(options: {
33
+ settings: string;
34
+ request: string;
35
+ }): Promise<{
36
+ status: number;
37
+ response: string;
38
+ }>;
39
+ tokenizationVaultCard(options: {
40
+ settings: string;
41
+ request: string;
42
+ }): Promise<{
43
+ status: number;
44
+ response: string;
45
+ }>;
46
+ tokenizationUpdateCard(options: {
47
+ settings: string;
48
+ token: string;
49
+ request: string;
50
+ }): Promise<{
51
+ status: number;
52
+ response: string;
53
+ }>;
54
+ tokenizationShowCard(options: {
55
+ settings: string;
56
+ token: string;
57
+ }): Promise<{
58
+ status: number;
59
+ response: string;
60
+ }>;
61
+ tokenizationShowCards(options: {
62
+ settings: string;
63
+ tokens: string;
64
+ }): Promise<{
65
+ status: number;
66
+ response: string;
67
+ }>;
68
+ tokenizationDeleteCard(options: {
69
+ settings: string;
70
+ token: string;
71
+ }): Promise<{
72
+ status: number;
73
+ response: string;
74
+ }>;
75
+ }
@@ -0,0 +1,110 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import Settings from '@pixelpay/sdk-core/lib/models/Settings';
3
+ import AuthTransaction from '@pixelpay/sdk-core/lib/requests/AuthTransaction';
4
+ import CaptureTransaction from '@pixelpay/sdk-core/lib/requests/CaptureTransaction';
5
+ import CardTokenization from '@pixelpay/sdk-core/lib/requests/CardTokenization';
6
+ import SaleTransaction from '@pixelpay/sdk-core/lib/requests/SaleTransaction';
7
+ import StatusTransaction from '@pixelpay/sdk-core/lib/requests/StatusTransaction';
8
+ import VoidTransaction from '@pixelpay/sdk-core/lib/requests/VoidTransaction';
9
+ import Tokenization from '@pixelpay/sdk-core/lib/services/Tokenization';
10
+ import Transaction from '@pixelpay/sdk-core/lib/services/Transaction';
11
+ export class PixelPaySDKWeb extends WebPlugin {
12
+ async transactionDoSale(options) {
13
+ const settings = Object.assign(new Settings(), JSON.parse(options.settings));
14
+ const request = Object.assign(new SaleTransaction(), JSON.parse(options.request));
15
+ const service = new Transaction(settings);
16
+ const response = await service.doSale(request);
17
+ return {
18
+ status: response.getStatus(),
19
+ response: response.toJson(),
20
+ };
21
+ }
22
+ async transactionDoAuth(options) {
23
+ const settings = Object.assign(new Settings(), JSON.parse(options.settings));
24
+ const request = Object.assign(new AuthTransaction(), JSON.parse(options.request));
25
+ const service = new Transaction(settings);
26
+ const response = await service.doAuth(request);
27
+ return {
28
+ status: response.getStatus(),
29
+ response: response.toJson(),
30
+ };
31
+ }
32
+ async transactionDoCapture(options) {
33
+ const settings = Object.assign(new Settings(), JSON.parse(options.settings));
34
+ const request = Object.assign(new CaptureTransaction(), JSON.parse(options.request));
35
+ const service = new Transaction(settings);
36
+ const response = await service.doCapture(request);
37
+ return {
38
+ status: response.getStatus(),
39
+ response: response.toJson(),
40
+ };
41
+ }
42
+ async transactionDoVoid(options) {
43
+ const settings = Object.assign(new Settings(), JSON.parse(options.settings));
44
+ const request = Object.assign(new VoidTransaction(), JSON.parse(options.request));
45
+ const service = new Transaction(settings);
46
+ const response = await service.doVoid(request);
47
+ return {
48
+ status: response.getStatus(),
49
+ response: response.toJson(),
50
+ };
51
+ }
52
+ async transactionGetStatus(options) {
53
+ const settings = Object.assign(new Settings(), JSON.parse(options.settings));
54
+ const request = Object.assign(new StatusTransaction(), JSON.parse(options.request));
55
+ const service = new Transaction(settings);
56
+ const response = await service.getStatus(request);
57
+ return {
58
+ status: response.getStatus(),
59
+ response: response.toJson(),
60
+ };
61
+ }
62
+ async tokenizationVaultCard(options) {
63
+ const settings = Object.assign(new Settings(), JSON.parse(options.settings));
64
+ const request = Object.assign(new CardTokenization(), JSON.parse(options.request));
65
+ const service = new Tokenization(settings);
66
+ const response = await service.vaultCard(request);
67
+ return {
68
+ status: response.getStatus(),
69
+ response: response.toJson(),
70
+ };
71
+ }
72
+ async tokenizationUpdateCard(options) {
73
+ const settings = Object.assign(new Settings(), JSON.parse(options.settings));
74
+ const request = Object.assign(new CardTokenization(), JSON.parse(options.request));
75
+ const service = new Tokenization(settings);
76
+ const response = await service.updateCard(options.token, request);
77
+ return {
78
+ status: response.getStatus(),
79
+ response: response.toJson(),
80
+ };
81
+ }
82
+ async tokenizationShowCard(options) {
83
+ const settings = Object.assign(new Settings(), JSON.parse(options.settings));
84
+ const service = new Tokenization(settings);
85
+ const response = await service.showCard(options.token);
86
+ return {
87
+ status: response.getStatus(),
88
+ response: response.toJson(),
89
+ };
90
+ }
91
+ async tokenizationShowCards(options) {
92
+ const settings = Object.assign(new Settings(), JSON.parse(options.settings));
93
+ const service = new Tokenization(settings);
94
+ const response = await service.showCards(options.tokens.split('|'));
95
+ return {
96
+ status: response.getStatus(),
97
+ response: response.toJson(),
98
+ };
99
+ }
100
+ async tokenizationDeleteCard(options) {
101
+ const settings = Object.assign(new Settings(), JSON.parse(options.settings));
102
+ const service = new Tokenization(settings);
103
+ const response = await service.deleteCard(options.token);
104
+ return {
105
+ status: response.getStatus(),
106
+ response: response.toJson(),
107
+ };
108
+ }
109
+ }
110
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAA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CAAC,OAA8C;QACzE,MAAM,QAAQ,GAAa,MAAM,CAAC,MAAM,CAAC,IAAI,QAAQ,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvF,MAAM,OAAO,GAAiB,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEzD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QAEpE,OAAO;YACN,MAAM,EAAE,QAAQ,CAAC,SAAS,EAAE;YAC5B,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE;SAC3B,CAAC;IACH,CAAC;IAED,KAAK,CAAC,sBAAsB,CAAC,OAA6C;QACzE,MAAM,QAAQ,GAAa,MAAM,CAAC,MAAM,CAAC,IAAI,QAAQ,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvF,MAAM,OAAO,GAAiB,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEzD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAEzD,OAAO;YACN,MAAM,EAAE,QAAQ,CAAC,SAAS,EAAE;YAC5B,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE;SAC3B,CAAC;IACH,CAAC;CACD","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport Settings from '@pixelpay/sdk-core/lib/models/Settings';\nimport AuthTransaction from '@pixelpay/sdk-core/lib/requests/AuthTransaction';\nimport CaptureTransaction from '@pixelpay/sdk-core/lib/requests/CaptureTransaction';\nimport CardTokenization from '@pixelpay/sdk-core/lib/requests/CardTokenization';\nimport SaleTransaction from '@pixelpay/sdk-core/lib/requests/SaleTransaction';\nimport StatusTransaction from '@pixelpay/sdk-core/lib/requests/StatusTransaction';\nimport VoidTransaction from '@pixelpay/sdk-core/lib/requests/VoidTransaction';\nimport Tokenization from '@pixelpay/sdk-core/lib/services/Tokenization';\nimport Transaction from '@pixelpay/sdk-core/lib/services/Transaction';\n\nimport type { PixelPaySDKPlugin } from './definitions';\n\nexport class PixelPaySDKWeb extends WebPlugin implements PixelPaySDKPlugin {\n\tasync transactionDoSale(options: { settings: string; request: string; }): Promise<{ status: number; response: string; }> {\n\t\tconst settings: Settings = Object.assign(new Settings(), JSON.parse(options.settings));\n\t\tconst request: SaleTransaction = Object.assign(new SaleTransaction(), JSON.parse(options.request));\n\t\tconst service: Transaction = new Transaction(settings);\n\n\t\tconst response = await service.doSale(request);\n\n\t\treturn {\n\t\t\tstatus: response.getStatus(),\n\t\t\tresponse: response.toJson(),\n\t\t};\n\t}\n\n\tasync transactionDoAuth(options: { settings: string; request: string; }): Promise<{ status: number; response: string; }> {\n\t\tconst settings: Settings = Object.assign(new Settings(), JSON.parse(options.settings));\n\t\tconst request: AuthTransaction = Object.assign(new AuthTransaction(), JSON.parse(options.request));\n\t\tconst service: Transaction = new Transaction(settings);\n\n\t\tconst response = await service.doAuth(request);\n\n\t\treturn {\n\t\t\tstatus: response.getStatus(),\n\t\t\tresponse: response.toJson(),\n\t\t};\n\t}\n\n\tasync transactionDoCapture(options: { settings: string; request: string; }): Promise<{ status: number; response: string; }> {\n\t\tconst settings: Settings = Object.assign(new Settings(), JSON.parse(options.settings));\n\t\tconst request: CaptureTransaction = Object.assign(new CaptureTransaction(), JSON.parse(options.request));\n\t\tconst service: Transaction = new Transaction(settings);\n\n\t\tconst response = await service.doCapture(request);\n\n\t\treturn {\n\t\t\tstatus: response.getStatus(),\n\t\t\tresponse: response.toJson(),\n\t\t};\n\t}\n\n\tasync transactionDoVoid(options: { settings: string; request: string; }): Promise<{ status: number; response: string; }> {\n\t\tconst settings: Settings = Object.assign(new Settings(), JSON.parse(options.settings));\n\t\tconst request: VoidTransaction = Object.assign(new VoidTransaction(), JSON.parse(options.request));\n\t\tconst service: Transaction = new Transaction(settings);\n\n\t\tconst response = await service.doVoid(request);\n\n\t\treturn {\n\t\t\tstatus: response.getStatus(),\n\t\t\tresponse: response.toJson(),\n\t\t};\n\t}\n\n\tasync transactionGetStatus(options: { settings: string; request: string; }): Promise<{ status: number; response: string; }> {\n\t\tconst settings: Settings = Object.assign(new Settings(), JSON.parse(options.settings));\n\t\tconst request: StatusTransaction = Object.assign(new StatusTransaction(), JSON.parse(options.request));\n\t\tconst service: Transaction = new Transaction(settings);\n\n\t\tconst response = await service.getStatus(request);\n\n\t\treturn {\n\t\t\tstatus: response.getStatus(),\n\t\t\tresponse: response.toJson(),\n\t\t};\n\t}\n\n\tasync tokenizationVaultCard(options: { settings: string; request: string; }): Promise<{ status: number; response: string; }> {\n\t\tconst settings: Settings = Object.assign(new Settings(), JSON.parse(options.settings));\n\t\tconst request: CardTokenization = Object.assign(new CardTokenization(), JSON.parse(options.request));\n\t\tconst service: Tokenization = new Tokenization(settings);\n\n\t\tconst response = await service.vaultCard(request);\n\n\t\treturn {\n\t\t\tstatus: response.getStatus(),\n\t\t\tresponse: response.toJson(),\n\t\t};\n\t}\n\n\tasync tokenizationUpdateCard(options: { settings: string; token: string; request: string; }): Promise<{ status: number; response: string; }> {\n\t\tconst settings: Settings = Object.assign(new Settings(), JSON.parse(options.settings));\n\t\tconst request: CardTokenization = Object.assign(new CardTokenization(), JSON.parse(options.request));\n\t\tconst service: Tokenization = new Tokenization(settings);\n\n\t\tconst response = await service.updateCard(options.token, request);\n\n\t\treturn {\n\t\t\tstatus: response.getStatus(),\n\t\t\tresponse: response.toJson(),\n\t\t};\n\t}\n\n\tasync tokenizationShowCard(options: { settings: string; token: string; }): Promise<{ status: number; response: string; }> {\n\t\tconst settings: Settings = Object.assign(new Settings(), JSON.parse(options.settings));\n\t\tconst service: Tokenization = new Tokenization(settings);\n\n\t\tconst response = await service.showCard(options.token);\n\n\t\treturn {\n\t\t\tstatus: response.getStatus(),\n\t\t\tresponse: response.toJson(),\n\t\t};\n\t}\n\n\tasync tokenizationShowCards(options: { settings: string; tokens: string; }): Promise<{ status: number; response: string; }> {\n\t\tconst settings: Settings = Object.assign(new Settings(), JSON.parse(options.settings));\n\t\tconst service: Tokenization = new Tokenization(settings);\n\n\t\tconst response = await service.showCards(options.tokens.split('|'));\n\n\t\treturn {\n\t\t\tstatus: response.getStatus(),\n\t\t\tresponse: response.toJson(),\n\t\t};\n\t}\n\n\tasync tokenizationDeleteCard(options: { settings: string; token: string; }): Promise<{ status: number; response: string; }> {\n\t\tconst settings: Settings = Object.assign(new Settings(), JSON.parse(options.settings));\n\t\tconst service: Tokenization = new Tokenization(settings);\n\n\t\tconst response = await service.deleteCard(options.token);\n\n\t\treturn {\n\t\t\tstatus: response.getStatus(),\n\t\t\tresponse: response.toJson(),\n\t\t};\n\t}\n}\n"]}