Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
70486bdc
authored
Sep 18, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
solved several issues
parent
2ff46548
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
sails/src/api/controllers/TPVController.js
sails/src/api/models/Student.js
sails/src/api/controllers/TPVController.js
View file @
70486bdc
...
...
@@ -7,7 +7,7 @@
const
moment
=
require
(
'moment'
);
//
//
-----------------------------------------------------------------------------
// RedSys Javascript API
//
const
cryptojs
=
require
(
"crypto-js"
);
...
...
@@ -28,7 +28,7 @@ function cipherMerchantKey(order, key) {
function
encodeMerchantParams
(
object
)
{
// Base64 encoding of parameters
var
merchantWordArray
=
cryptojs
.
enc
.
Utf8
.
parse
(
JSON
.
stringify
(
tpvdata
));
var
merchantWordArray
=
cryptojs
.
enc
.
Utf8
.
parse
(
JSON
.
stringify
(
object
));
return
merchantWordArray
.
toString
(
cryptojs
.
enc
.
Base64
);
}
...
...
@@ -43,6 +43,7 @@ function signMerchantParams(params, key) {
var
signature
=
cryptojs
.
HmacSHA256
(
params
,
key
);
return
signature
.
toString
(
cryptojs
.
enc
.
Base64
);
}
//-----------------------------------------------------------------------------
//
// TPV Controller
...
...
sails/src/api/models/Student.js
View file @
70486bdc
...
...
@@ -324,7 +324,7 @@ module.exports = {
// student is valid
var
supIdx
=
stuSups
.
findIndex
(
x
=>
x
.
supervisor
&&
x
.
supervisor
.
id
==
id_sup
);
if
(
supIdx
>=
0
)
return
([
stuSups
[
supIdx
].
supervisor
]);
// break
then
chain
return
([
stuSups
[
supIdx
].
supervisor
]);
// break
"then"
chain
throw
new
Error
(
"No supervisors related"
);
}
...
...
@@ -337,12 +337,14 @@ module.exports = {
// filter from the second list those found in the first list
var
sups
=
so
.
filter
(
a
=>
ss
.
findIndex
(
b
=>
b
.
id
==
a
.
id
)
>=
0
);
return
([
sups
,
Supervisor
.
find
(
id_sup
)]);
})
.
spread
((
sups
,
me
)
=>
{
// The requester is an office, so it has to be appended to the list of valid supervisors
sups
.
push
(
me
[
0
]);
return
sups
;
return
Promise
.
all
([
sups
,
Supervisor
.
find
(
id_sup
)])
.
then
((
arr
)
=>
{
// The requester is an office, so it has to be appended to the list of valid supervisors
// arr[0] is sups, arr[1] is the array of found supervisors (just one, the requester)
arr
[
0
].
push
(
arr
[
1
][
0
]);
return
(
arr
[
0
]);
})
.
catch
((
err
)
=>
{
throw
err
});
})
.
then
((
sups
)
=>
{
return
callback
(
null
,
sups
)})
.
catch
((
err
)
=>
{
return
callback
(
err
,
[])});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment