Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hosted Solution : Getting payment 508 error in special cases of amount #10

Open
kuldeep-k opened this issue Mar 6, 2020 · 3 comments
Open

Comments

@kuldeep-k
Copy link

kuldeep-k commented Mar 6, 2020

When I am trying payment with decimal number line 70.1, 70.9, 1230.1, 1230.9. I am getting following payment error. It is working on all other cases.

"508 Invalid characters in AMOUNT field. Please contact the merchant."

This is current code for payment gateway integration.
`

 const PaymentService = require("globalpayments-api");    
 const config = new PaymentService.ServicesConfig();
 config.hostedPaymentConfig = new PaymentService.HostedPaymentConfig();
 config.hostedPaymentConfig.displaySavedCards = true;
 // config.hostedPaymentConfig.cardStorageEnabled = true;
 config.merchantId = conf.globalpayment.merchantId;
 config.channel = conf.globalpayment.channel;
 config.accountId = conf.globalpayment.accountId;
 config.sharedSecret = conf.globalpayment.sharedSecret;
 config.serviceUrl = conf.globalpayment.serviceUrl;
const hostedPaymentData = new PaymentService.HostedPaymentData();
hostedPaymentData.customerKey = consumerData.paymentGatewayId;
hostedPaymentData.customerExists = true;
hostedPaymentData.offerToSaveCard = true;
console.log(hostedPaymentData);
try {
    const service = new PaymentService.HostedService(config);
    console.log(service);
    var vv = service
        .authorize(1)
        .withCurrency('CAD')
        .withOrderId(orderId)
        .withHostedPaymentData(hostedPaymentData);

    console.log(vv)
    let responseStr = service
        .authorize(1)
        .withCurrency('CAD')
        .withOrderId(orderId)
        .withHostedPaymentData(hostedPaymentData)
        .withAmount(amount)
        .serialize();

    console.log(responseStr);
    console.log(typeof responseStr);
    let response = JSON.parse(responseStr);
} catch (error) {
    console.log(error);
}

`
When I checked out the response, I am getting amount in response like 123090.00000000001.So this look like Library floating point mechanism for amount creating issue.

@slogsdon
Copy link
Contributor

slogsdon commented Mar 9, 2020

@kuldeep-k Apologies here. We have a commit that fixes this, but it seems it was never merged in. I will work with our internal teams to get this corrected and will follow up as soon as it's available via NPM. In the meantime, you should be able to reference this commit from your package.json file to leverage this fix.

@kuldeep-k
Copy link
Author

Thanks for response, I tried with
npm install --save https://github.com/globalpayments/node-sdk#07768f7cf4aa717abc1a5f632b33f283ccb111b4
AND
npm install --save git+https://github.com/globalpayments/node-sdk.git#07768f7cf4aa717abc1a5f632b33f283ccb111b4

But only three files LICENSE.md, package.json, README.md is installed all other code is missing.

@FinnONeill
Copy link

Hi all, still having this issue. Is there a reason the above commit hasn't been merged? @slogsdon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants