Monday, December 30, 2013

BPAY payments / Customer Reference Number (CRN) generation - Luhn algorithm, mod 10 version 5 (MOD10V05)

1. BPAY payments

BPAY has become quite a comfortable and an easy online payment solution for Australian customers, more and more applications provide this option to be used. In order to start accepting BPAY payments in your application or website - you just need to make a few steps, like:
  • Register as the BPAY Biller at -> you'll get your BPAY Biller code then;
  • When your customer is willing to make a BPAY transfer - your application should generate a Customer Reference Number (CRN) programmatically (see below), or you can even generate valid CRNs manually using CRN Generator Tool (win/mac desktop app) - anyway, each CRN generated for a User can be used by him further on, although some applications/services do prefer to generate a new CRN for each new Order a User makes - both approaches are quite fine;
  • Then you should provide this pair of values to such a Customer:
    • your BPAY Biller code;
    • his CRN generated/assigned to him;
  • Then he makes a BPAY payment using these credentials - using various online banking interfaces or even mobile apps that support BPAY option;
  • You accept it on your end, then you just need to check the CRN value mentioned inside the payment details -> identify your Customer -> process the corresponding Order.

2. Customer Reference Number (CRN) generation

CRN is an identifier of a Customer within the BPAY Biller's customer base. This is a number of certain length (that is set up in advance by Biller when he gets registered), consisting of the following two parts:

  • CRN "seed" - certain numeric value that you choose, representing your Customer or an Order document inside your database. It can be your Customer or Order ID, but we recommend to avoid exposing your internal autoincremented IDs, instead - some randomized public IDs (of certain length, e.g. 12 digits) would better be used. So, for example, such a 12digits-length number is taken for this part.
  • and a Check digit has to be calculated and appended to the value above. For BPAY CRNs specifically this Check digit gets calculated based on the value above - using the Luhn algorithm, mod 10 version 5 (MOD10V05):

$seed_length = strlen($seed);
$total = 0;

// Calculate the sum of the products of "seed"'s digits with their 1-based array position numbers, accordingly
for($i = 0; $i < $seed_length; $i++) $total += $seed{$i} * ($i + 1);

// The check digit to be found - would be the the sum above mod 10
$check_digit = fmod($total, 10);

// Resulting CRN: concatenation of the "seed" value with the Check digit calculated above
$result = $seed. $check_digit;

Monday, July 15, 2013

Sierra w802s (Overdrive PRO 3G/4G) Mobile Hotspot firmware update [patched, "no update"]

So, what we have:
  • Sierra w802s (Overdrive PRO 3G/4G) Mobile Hotspot ("Sprint"-unlocked)

What we need:
  • update its firmware to 802s_patched_firmware_new_no_update.bin with the aim to:
    • stabilize its connection by getting rid of "disconnecting..."-related issues, hang-ups;
    • get rid of the issue with reconnection unability until its battery gets re-inserted;
    • and of course, avoid those insistent suggestions to upgrade firmware finally resulting into the device workability loss at all, in our case;
  • avoid "The update cannot proceed. There is a SKU version mismatch." error while updating.

Steps to go:
  • download this firmware (link above);
  • open it with any text editor, find "sku:" inside, copy it somewhere (e.g. clipboard):

  • export router settings:

  • you get "cfg.txt" this way - open this file using any text editor, find "eagle_sku" parameter, and update its value to the one we copied above ("1453010" in our case), save the file:
  • import this configuration file back into the device:

  • and now you get the ability to finally update the actual firmware:

  • the update gets started, you'll see its progress on the device's screen, and the whole process is going to take several minutes. The device gets rebooted then, and Yahooo! - you get it working with the new soft inside, no that boring "disconnecting..." constantly, no suggestions to "update your firmware" that might lead to disfunction, etc. You're all done.

To those exhausted with "SKU version mismatch" :)
Hope it helps,
Kind regards,..

Saturday, June 1, 2013

Redmine A1 theme "Issues coloring acc. to Priority" broken [fixed]

We love Redmine, and we like the A1 theme, among the rest of. But we've faced an issue with Issues coloring (acc. to Priority) broken in fresh versions of Redmine (Redmine version 2.3.1.stable, at least, but people have been reporting similar issues for a long time already, e.g. yet in Redmine 2.1.2).

The actual A1 theme is wonderful (thanks to Kirill Bezrukov @ RedmineCRM), but Redmine has changed their default enumerations (those seeded with the corresponding rake task from Redmine), specifially and at least - the actual "Issue priorities" enumeration (it's IDs have been changed), that is now looking like:
So having forked the original A1 from (v1.1.1 at that moment), we had to amend the coloring, and this is how our fixed A1 theme colors the Issues listing on Redmine version 2.3.1.stable now:

For those suffered from this "issues coloring acc. to priority" broken in Redmine's Issues listing as of Redmine versions 2.1.2-2.3.1, at least: