Closed yokrysty closed 1 year ago
sure thing! it will be ready soon
added setParams
method in 0.7.0
. Please test it and re-open this issue if the problem is not solved. Thanks for your change request :+1:
thanks for the quick response, but it's what i was expected
i wanted to pass and object and then the library should to the mapping
i migrated from this library https://github.com/florintimbuc/mobilpay-node because it's too old with high risk dependencies highlighted by npm
as a hacky fix i did:
netopia.paymentData.order.params = Object.entries(data.params).map(el => ({ param: { name: el[0], value: el[1] } }));
after setPaymentData method
can you please give me an example of how you imagined the implementation? From your example above I'm deducing you can just write it like so:
const params = data.params; // an array of key/value objects
netopia.setParams(params); // call it before setPaymentData
i used the hacky fix that i was referring before you implemented it's not a problem how you implemented, i just expected like the other libraries out there so i would not need to create that array of objects
netopia.setParams({
test1: 'test param 1',
test2: 'test param 2'
});
ref: https://github.com/robi-richter/mobilpay-node
i use params to put some ids to identify the account, user and what subscription plan was selected when i get the response in the confirm url, but they can be anything (string, number, null, empty string) and returned as is
anyway you can keep the implemention like it is, just remove from validation:
if (params.some((param) => typeof param.value === 'undefined')) {
throw new Error('PARAMS_MISSING_VALUE');
}
https://support.netopia-payments.com/en-us/article/39-care-este-structura-unui-request-de-plata-prin-card
at the end of the xml there is a list for custom params