Perl script monitors payments and feedback in eBay sales
eBay Can't Add
You might not realize that some people out there actually add up the individual line items of a computer-generated invoice and check whether the bottom line is right. But, I must confess, sometimes I cannot resist – especially for the monthly eBay invoice when just four items are listed, as in Figure 4.
Every second grader with a calculator could verify in a breeze that 4.40 + 0.45 + 1.00 + 0.39 adds up to the total sum of $6.24. Yet, eBay's Java jockeys are apparently not aware of the article on floating-point arithmetic that every programmer should read [2]. Otherwise, they'd realized that CPUs save floating-point numbers inaccurately; for that reason, astonishing rounding errors can arise during addition.
That explains why eBay brazenly charged me $6.25, although the total sum for the line items should, without a doubt, have come to $6.24. I had already called into the customer service center a while ago on a different issue and spent a half hour talking to a representative from overseas to report a discrepancy of a few cents. I will save this one-cent complaint for a very special day.
Auditor
The script in Listing 2 helps to automatically conduct this audit every month. It relies on the official eBay API, identifying itself with a token for the eBay web service and retrieving the previous month's invoice as an XML document. The line items are found there under the NetDetailAmount
tag, as is the total amount under InvoiceBalance
. The pipelined invoice-check
in Listing 3 is then able to check whether eBay calculated the sum of the line items correctly (Figure 5).
Listing 2
ebay-invoice
Listing 3
invoice-check
Key to the Kingdom of Data
An application that reads or writes eBay user data must identify itself to the platform with a token. To accomplish this, the developer must register with the eBay Developers Program and enter an application name. In the normal flow for a smartphone app, for example, the user would be guided through the login process on eBay, and, upon confirmation, receive a token that the app can use going forward. If developers only need a token for test purposes and for their own account, they can instead click the Sign in to Production
button on the eBay Developer Program sign-up page and receive a token this way (Figure 6) [3].
This token is then valid for the account actually in live production, as opposed to the sandbox in which developers can test out their apps until they are sure that they are ready for production (Figure 7).
Requests for personal data then require the token to be included, embedded in the RequesterCredentials
tag in the request's XML (see Listing 2, line 35). It consists of an 872-character hex string that must be placed between the eBayAuthToken
tags without line breaks.
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Red Hat Adds New Deployment Option for Enterprise Linux Platforms
Red Hat has re-imagined enterprise Linux for an AI future with Image Mode.
-
OSJH and LPI Release 2024 Open Source Pros Job Survey Results
See what open source professionals look for in a new role.
-
Proton 9.0-1 Released to Improve Gaming with Steam
The latest release of Proton 9 adds several improvements and fixes an issue that has been problematic for Linux users.
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.