Author Topic: Order amount set to 0 ?  (Read 1533 times)

Offline svherpen

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Order amount set to 0 ?
« on: 03/April/2010, 07:17:23 PM »
When I try to make a payment using the iDEAL interface (which I've bought and installed as 3rd party plugin from web4more), it fails with the error message that the amount is 0.

Looking in the logfile 'thinmpi.log' indeed shows:
<purchaseID>Webhosting mediu</purchaseID>
<amount>0</amount>
<currency>EUR</currency>

among some other tags of course, which I removed here for clarity and readability.

How come that the amount is set to 0, where the invoice amount should be something like 29 Euro's.
Any idea what goes wrong and where to fix this?
« Last Edit: 03/April/2010, 07:19:29 PM by svherpen »

Offline netshine

  • Administrator
  • Hero Member
  • *****
  • Posts: 4,952
    • View Profile
Re: Order amount set to 0 ?
« Reply #1 on: 03/April/2010, 07:31:16 PM »
Does nBill report the correct amount before handing over to iDEAL? If so, you need to contact the author of the gateway for support. If nBill also says the amount is zero, check this page: http://www.nbill.co.uk/help/index.php?page=payment-amount-always-0-when-form-submitted.html

Offline svherpen

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Order amount set to 0 ?
« Reply #2 on: 05/April/2010, 11:06:17 AM »
Thanks for your fast response Netshine.

Where can I set a temporary line to display what nBILL is reporting as orderamount before it hands it over to iDEAL gateway?

I've looked in the code from the iDEAL folder, and it tries to retrieve the data using the next statement:
$timestamp = gmdate(Y) . "-" . gmdate(m) . "-" . gmdate(d) . "T" . gmdate(H) . ":" . gmdate(i) . ":" . gmdate(s) . ".000Z";
   $token = "";
   $tokenCode = "";
        if ( "SHA1_RSA" == $req->getAuthentication() ) {
      $message = $timestamp
                        . $req->getIssuerID()
                        . $req->getMerchantID()
                        . $req->getSubID()
                        . $req->getMerchantReturnURL()
                        . $req->getPurchaseID()
                        . $req->getAmount()
                        . $req->getCurrency()
                        . $req->getLanguage()
                        . $req->getDescription()
                        . $req->getEntranceCode();
      $message = $this->strip( $message );

           //create fingerprint so the receiver knows what certificate to use
           $token = $this->security->createCertFingerprint($this->conf["PRIVATECERT"]);

           //sign the message
           $tokenCode = $this->security->signMessage( $this->conf["PRIVATEKEY"], $this->conf["PRIVATEKEYPASS"], $message );
           //encode it with base64
           $tokenCode = base64_encode( $tokenCode );
       }
        $reqMsg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                . "<AcquirerTrxReq xmlns=\"http://www.idealdesk.com/Message\" version=\"1.1.0\">\n"
                . "<createDateTimeStamp>" . utf8_encode( $timestamp ) .  "</createDateTimeStamp>\n"
                . "<Issuer>" . "<issuerID>" . utf8_encode( $this->encode_html( $req->getIssuerID() ) ) . "</issuerID>\n"
                . "</Issuer>\n"
                . "<Merchant>" . "<merchantID>" . utf8_encode( $this->encode_html( $req->getMerchantID() ) ) . "</merchantID>\n"
                . "<subID>" . utf8_encode( $req->getSubID() ) . "</subID>\n"
                . "<authentication>" . utf8_encode( $req->getAuthentication() ) . "</authentication>\n"
                . "<token>" . utf8_encode( $token ) . "</token>\n"
                . "<tokenCode>" . utf8_encode( $tokenCode ) . "</tokenCode>\n"
                . "<merchantReturnURL>" . utf8_encode( $this->encode_html( $req->getMerchantReturnURL() ) ) . "</merchantReturnURL>\n"
                . "</Merchant>\n"
                . "<Transaction>" . "<purchaseID>" . utf8_encode( $this->encode_html( $req->getPurchaseID() ) ) . "</purchaseID>\n"
                . "<amount>" . utf8_encode( $req->getAmount() ) . "</amount>\n"
                . "<currency>" . utf8_encode( $req->getCurrency() ) . "</currency>\n"
                . "<expirationPeriod>" . utf8_encode( $req->getExpirationPeriod() ) . "</expirationPeriod>\n"
                . "<language>" . utf8_encode( $req->getLanguage() ) . "</language>\n"
                . "<description>" . utf8_encode( $this->encode_html( $req->getDescription() ) ) . "</description>\n"
                . "<entranceCode>" . utf8_encode( $this->encode_html( $req->getEntranceCode() ) ) . "</entranceCode>\n"
                . "</Transaction>" . "</AcquirerTrxReq>";

If I replace the line with <amount> with a hardcoded amount, it does get processed by my iDEAL server.
So either the statement in retrieving the data is wrong, or nBILL puts the amount to zero.

Offline svherpen

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Order amount set to 0 ?
« Reply #3 on: 05/April/2010, 11:14:06 AM »
One small thing I forgot to mention:

When trying to pay the order, the order amount shown in the webpage is correct, so it does not seem to be related to the topic you mentioned where the order amount is always set to 0.

It must be somewhere in the interface between iDEAL gateway and the orderamount from nBILL where things are screwed up.

This is an urgent issue for me, since the site is going to be live at the end of this month.

Offline netshine

  • Administrator
  • Hero Member
  • *****
  • Posts: 4,952
    • View Profile
Re: Order amount set to 0 ?
« Reply #4 on: 05/April/2010, 02:26:52 PM »
Try using the Paypal gateway. If that passes the correct amount to Paypal, then you know nBill is sending the correct amount to the gateway, in which case you need to ask the gateway author for support.

Offline svherpen

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Order amount set to 0 ?
« Reply #5 on: 06/April/2010, 08:07:11 AM »
Thanks netshine, I've tried using the Paypal interface and that worked okay.
So I will need to contact the web4more guys for their support. Although I assumed that would work seemlessly, since you are recommending them as payment gateway provider on your website.... But maybe they need to provide an update to their iDEAL interface?
Has there been changes in your interface that they might not be aware of?

Offline netshine

  • Administrator
  • Hero Member
  • *****
  • Posts: 4,952
    • View Profile
Re: Order amount set to 0 ?
« Reply #6 on: 06/April/2010, 08:43:42 AM »
I do not recommend or endorse any 3rd party products. I just make people aware of their existence. I have not personally examined any of the code for any 3rd party gateways, so cannot comment on them. As far as I am aware, Web4More and OSDCS are the only 2 companies that make nBill payment gateways available to the public, and both of them were informed of the changes required for nBill v2. I don't know anything about iDEAL, so if there are any changes at their end, it would be up to the gateway author to deal with them.

Offline svherpen

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Order amount set to 0 ?
« Reply #7 on: 07/April/2010, 12:14:54 PM »
Hi Netshine,

This post is to update you: my iDEAL gateway problem has been solved by the provider web4more.
Apparently they did not incorporate all the changes you have applied in the nBILL v2.x
Once this fix was applied, my payments (to the test-environment) work like a charme.

Sjaak

Offline svherpen

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Order amount set to 0 ?
« Reply #8 on: 09/April/2010, 09:12:53 PM »
Sorry to bother you once more, but I have a question about parsing the invoice_number to the iDEAL payment gateway.

In the picture shown, I see the generated invoice number and the total order amount.
This is the screen that's shown after a user has selected to shown his/her invoices and clicked on an invoice that's waiting to be paid.


Getting the amount is done using the command
$amount = nbf_common::get_param($_POST, 'total_gross') * 100;

However, getting the invoice_number fails. The current code is
$invoice_no = nbf_common::get_param($_POST, 'invoice_no');

But this returns an empty string.

Can you please tell me which variable I should use to get the invoice-number passed on to the iDEAL gateway?

Offline netshine

  • Administrator
  • Hero Member
  • *****
  • Posts: 4,952
    • View Profile
Re: Order amount set to 0 ?
« Reply #9 on: 10/April/2010, 08:22:44 AM »
The invoice number is passed (not parsed!) in the variable $document_no

Offline svherpen

  • Full Member
  • ***
  • Posts: 27
    • View Profile
Re: Order amount set to 0 ?
« Reply #10 on: 12/April/2010, 09:02:08 AM »
Thanks, I've made the change and it's working as expected.

And you're right, I shouldn't have used the word parsing, but these slip-of-the-tongue are easily made for a non-native speaker like myself.
Luckly I used the right wording 'passing' in the last sentence, so it was clear what I mentioned.

Regards,
Sjaak

Offline netshine

  • Administrator
  • Hero Member
  • *****
  • Posts: 4,952
    • View Profile
Re: Order amount set to 0 ?
« Reply #11 on: 12/April/2010, 09:09:39 AM »
Sorry, didn't mean to cause offense, just being picky! In fact, your English is far superior to many native English speakers.