Update folder structure & remove unecessary redundant directory
This commit is contained in:
32
int_recaptcha/cartridge/scripts/services/recaptcha.js
Normal file
32
int_recaptcha/cartridge/scripts/services/recaptcha.js
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
var LocalServiceRegistry = require('dw/svc/LocalServiceRegistry');
|
||||
|
||||
var recaptchaService = LocalServiceRegistry.createService('recaptcha.http.post', {
|
||||
createRequest: function(svc, params) {
|
||||
svc.setRequestMethod('POST');
|
||||
// You can perform other operations, such as adding request headers
|
||||
svc.addHeader('Content-Type', 'application/json');
|
||||
// Add properties to the request body
|
||||
svc.addParam('secret', params.secret);
|
||||
svc.addParam('response', params.response);
|
||||
},
|
||||
parseResponse: function(svc, responseObject) {
|
||||
return JSON.parse(response.text);
|
||||
},
|
||||
// mockCall: function(svc, requestObject) {
|
||||
// // Return a mocked response
|
||||
// // If configuration set to MOCK mode
|
||||
// return {
|
||||
// success: true,
|
||||
// 'challenge_ts': Date.now(),
|
||||
// hostname: 'MOCK EXAMPLE'
|
||||
// };
|
||||
// }
|
||||
// If dealing with any sensitive information
|
||||
// You should filter it out before it hits the logs
|
||||
// filterLogMessage: function() {}
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
recaptchaService: recaptchaService
|
||||
};
|
Reference in New Issue
Block a user