iubenda-consent-solution-api
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -81,3 +81,3 @@ export interface ConsentsQueryParameters { | ||
*/ | ||
ip_address?: null; | ||
ip_address?: string; | ||
/** | ||
@@ -84,0 +84,0 @@ * Default `true`, Considered only when using a `public` key. Enables or disables (true, false) the IP address autedetection. Default true |
@@ -113,9 +113,6 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, _b; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
_b = (_a = IubendaConsentSolution).sendRequest; | ||
return [4 /*yield*/, IubendaConsentSolution.sendRequest(this.addHeaders((0, superagent_1.post)(this.generateUrl('consent')).send(consent)))]; | ||
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])]; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, IubendaConsentSolution.sendRequest(this.addHeaders((0, superagent_1.post)(this.generateUrl('consent')).send(consent)))]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
@@ -122,0 +119,0 @@ }); |
{ | ||
"name": "iubenda-consent-solution-api", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "API client to implement Iubenda Consent Solution in backend service", | ||
@@ -47,4 +47,2 @@ "main": "dist/index.js", | ||
"hooks": { | ||
"pre-commit": "lint-staged", | ||
"post-commit": "git update-index --again" | ||
} | ||
@@ -51,0 +49,0 @@ }, |
@@ -51,3 +51,38 @@ import {expect} from 'chai'; | ||
//ToDo implements createConsent() | ||
it('Add Consent', async function () { | ||
const client = new IubendaConsentSolution({apiKey: validApiKey}); | ||
const result = await client.createConsent({ | ||
autodetect_ip_address: 'false', | ||
subject: { | ||
id: '1', | ||
email: 'test@test.it', | ||
first_name: 'John', | ||
last_name: 'Fix', | ||
}, | ||
legal_notices: [ | ||
{identifier: 'privacy_policy',version: '1'}, | ||
{identifier: 'terms_and_conditions',version: '1'}, | ||
{identifier: 'cookie_policy',version: '1'}, | ||
], | ||
proofs: [ | ||
{ | ||
content: '{}', | ||
form: '<form></form>', | ||
}, | ||
], | ||
preferences: { | ||
privacy_policy: 'true', | ||
terms_and_conditions: 'true', | ||
cookie_policy: 'true', | ||
newsletter_subscription: 'false', | ||
}, | ||
ip_address: '', | ||
}); | ||
if ('error' in result) { | ||
console.log(result); | ||
expect.fail('Response error! ' + result.message); | ||
} | ||
else | ||
expect(true); | ||
}); | ||
}); | ||
@@ -54,0 +89,0 @@ describe('Subjects', function () { |
@@ -85,3 +85,3 @@ import {get, post, put, SuperAgentRequest} from 'superagent'; | ||
*/ | ||
ip_address?: null; | ||
ip_address?: string; | ||
/** | ||
@@ -303,3 +303,3 @@ * Default `true`, Considered only when using a `public` key. Enables or disables (true, false) the IP address autedetection. Default true | ||
async createConsent(consent: ConsentExtended): Promise<ResponseError | ConsentPostResponse> { | ||
return IubendaConsentSolution.sendRequest(await IubendaConsentSolution.sendRequest(this.addHeaders(post(this.generateUrl('consent')).send(consent)))); | ||
return await IubendaConsentSolution.sendRequest(this.addHeaders(post(this.generateUrl('consent')).send(consent))); | ||
} | ||
@@ -306,0 +306,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
44709
938
0