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
-
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.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs