<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Star120.co.za &#187; Development</title>
	<atom:link href="http://star120.co.za/blog/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://star120.co.za/blog</link>
	<description></description>
	<lastBuildDate>Fri, 26 Mar 2010 07:15:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Star120 Opens Debit API</title>
		<link>http://star120.co.za/blog/2009/09/22/star120-opens-debit-api/</link>
		<comments>http://star120.co.za/blog/2009/09/22/star120-opens-debit-api/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 12:31:54 +0000</pubDate>
		<dc:creator>james</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Star120]]></category>

		<guid isPermaLink="false">http://star120.co.za/blog/?p=186</guid>
		<description><![CDATA[We a proud to announce the activation of our new REST API. As a priority we converted our account validation and electronic debit mandate capturing features. We are in the process of completing the documentation. Please contact us for assistance if you require more technical information. Account Validation The bank account validation test will verify [...]]]></description>
			<content:encoded><![CDATA[<p>We a proud to announce the activation of our new <a href="http://en.wikipedia.org/wiki/REST">REST</a> <a href="http://en.wikipedia.org/wiki/API">API</a>. As a priority we converted our account validation and electronic debit mandate capturing features. We are in the process of completing the documentation. Please <a href="http://debits.star120.com/company/contact">contact us</a> for assistance if you require more technical information.</p>
<p><strong>Account Validation</strong><br />
The bank account validation test will verify your customers <a href="http://en.wikipedia.org/wiki/Identity_document#South_Africa">South African ID number</a>, Cell number, branch code and bank account number. This will greatly reduce any initial account errors. The pre check will give you the opportunity to contact your customer to update their details before submitting the debit order.</p>
<p><strong>Electronic Debit Mandate Capturing</strong><br />
A prerequisite for the processing of any debit order is to have a confirmed debit mandate from the customer. We can facilitate this via our electronic mandate capturing feature. You submit the clients banking details and mobile number. We sms the customer notifying them of your request. The customer dials a <a href="http://en.wikipedia.org/wiki/USSD_Gateway">USSD</a> number and either accepts or declines the request. The request is logged.</p>
<p><img src="http://star120.co.za/blog/wp-content/uploads/2009/09/api_validation_overview.jpg" alt="api_validation_overview" title="api_validation_overview" width="473" height="563" class="alignleft size-full wp-image-188" /></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fstar120.co.za%2Fblog%2F2009%2F09%2F22%2Fstar120-opens-debit-api%2F&amp;linkname=Star120%20Opens%20Debit%20API"><img src="http://star120.co.za/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://star120.co.za/blog/2009/09/22/star120-opens-debit-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validate a South African ID Number</title>
		<link>http://star120.co.za/blog/2009/04/07/validate-a-south-african-id-number/</link>
		<comments>http://star120.co.za/blog/2009/04/07/validate-a-south-african-id-number/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 09:40:26 +0000</pubDate>
		<dc:creator>james</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://star120.co.za/blog/?p=155</guid>
		<description><![CDATA[Besides checking the length of a South African ID number for validation, our developer Clive Crous thought there must be an official checksum. After piecing together multiple google searches he has build a ruby class which validates our customer ID numbers. Our online debit engine is enhanced a little further. Below is the ruby code, enjoy [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-166" title="south_african_id_book" src="http://star120.co.za/blog/wp-content/uploads/2009/04/south_african_id_book.png" alt="south_african_id_book" width="89" height="100" />Besides checking the length of a South African ID number for validation, our developer <a href="http://clive.crous.co.za/">Clive Crous</a> thought there must be an official checksum. After piecing together multiple google searches he has build a ruby class which validates our customer ID numbers. Our <a href="http://debits.star120.com/">online debit engine</a> is enhanced a little further.</p>
<p>Below is the ruby code, enjoy</p>
<p>Download the <a href="http://star120.co.za/blog/wp-content/uploads/2009/04/identity_number1.rb">identity_number.rb</a> file</p>
<p><span style="font-family: monospace;"><span style="color: #a52a2a;"> 1 </span><span style="color: #a020f0;">require</span> <span style="color: #6a5acd;">&#8216;</span><span style="color: #ff00ff;">time</span><span style="color: #6a5acd;">&#8216;</span> <span style="color: #0000ff;"># Used for verifying date of birth portion of ID Number</span><br />
<span style="color: #a52a2a;"> 2 </span><br />
<span style="color: #a52a2a;"> 3 </span><span style="color: #a020f0;">class</span> <span style="color: #2e8b57;"><strong>SouthAfricanIDNumber</strong></span><br />
<span style="color: #a52a2a;"> 4 </span><br />
<span style="color: #a52a2a;"> 5 </span> <span style="color: #0000ff;"># The format of a normal South-African ID number is as follows</span><br />
<span style="color: #a52a2a;"> 6 </span> <span style="color: #0000ff;"># {YYMMDD}{G}{SSS}{A}{Z}</span><br />
<span style="color: #a52a2a;"> 7 </span> <span style="color: #0000ff;"># YYMMDD: Date of birth</span><br />
<span style="color: #a52a2a;"> 8 </span> <span style="color: #0000ff;"># G  : Gender. 0-4 Female; 5-9 Male.</span><br />
<span style="color: #a52a2a;"> 9 </span> <span style="color: #0000ff;"># SSS  : Sequence No. for DOB/G combination.</span><br />
<span style="color: #a52a2a;"> 10 </span> <span style="color: #0000ff;"># C  : Citizenship. 0 SA; 1 Other.</span><br />
<span style="color: #a52a2a;"> 11 </span> <span style="color: #0000ff;"># A  : Usually 8, or 9 (can be other values)</span><br />
<span style="color: #a52a2a;"> 12 </span> <span style="color: #0000ff;"># Z  : Control digit.</span><br />
<span style="color: #a52a2a;"> 13 </span><br />
<span style="color: #a52a2a;"> 14 </span> <span style="color: #a020f0;">def</span> <span style="color: #008b8b;">initialize</span>( number )<br />
<span style="color: #a52a2a;"> 15 </span> <span style="color: #008b8b;">@number</span> = number.to_s<br />
<span style="color: #a52a2a;"> 16 </span> <span style="color: #a020f0;">end</span><br />
<span style="color: #a52a2a;"> 17 </span><br />
<span style="color: #a52a2a;"> 18 </span> <span style="color: #a020f0;">def</span> <span style="color: #008b8b;">gender</span><br />
<span style="color: #a52a2a;"> 19 </span> <span style="color: #ff00ff;">self</span>[<span style="color: #ff00ff;">6</span>] &gt; <span style="color: #ff00ff;">4</span> ? <span style="color: #ff00ff;">:male</span> : <span style="color: #ff00ff;">:female</span><br />
<span style="color: #a52a2a;"> 20 </span> <span style="color: #a020f0;">end</span><br />
<span style="color: #a52a2a;"> 21 </span><br />
<span style="color: #a52a2a;"> 22 </span> <span style="color: #a020f0;">def</span> <span style="color: #008b8b;">south_african?</span><br />
<span style="color: #a52a2a;"> 23 </span> <span style="color: #ff00ff;">self</span>[<span style="color: #ff00ff;">10</span>] == <span style="color: #ff00ff;">0</span><br />
<span style="color: #a52a2a;"> 24 </span> <span style="color: #a020f0;">end</span><br />
<span style="color: #a52a2a;"> 25 </span><br />
<span style="color: #a52a2a;"> 26 </span> <span style="color: #a020f0;">def</span> <span style="color: #008b8b;">generate_check_digit</span><br />
<span style="color: #a52a2a;"> 27 </span> odd_digits = <span style="color: #008b8b;">@number</span>.scan(<span style="color: #6a5acd;">/</span><span style="color: #6a5acd;">..</span><span style="color: #6a5acd;">/</span>).map{|<span style="color: #008b8b;">n</span>|n[<span style="color: #ff00ff;">0</span>].chr}<br />
<span style="color: #a52a2a;"> 28 </span> even_digits = <span style="color: #008b8b;">@number</span>.scan(<span style="color: #6a5acd;">/</span><span style="color: #6a5acd;">..</span><span style="color: #6a5acd;">/</span>).map{|<span style="color: #008b8b;">n</span>|n[<span style="color: #ff00ff;">1</span>].chr}<br />
<span style="color: #a52a2a;"> 29 </span><br />
<span style="color: #a52a2a;"> 30 </span> sum_of_odd_digits = odd_digits.inject(<span style="color: #ff00ff;">0</span>){ |<span style="color: #008b8b;">total</span>,<span style="color: #008b8b;">digit</span>| total + digit.to_i }<br />
<span style="color: #a52a2a;"> 31 </span><br />
<span style="color: #a52a2a;"> 32 </span> combined_and_multiplied_even_digits = even_digits.join(<span style="color: #6a5acd;">&#8221;</span>).to_i * <span style="color: #ff00ff;">2</span><br />
<span style="color: #a52a2a;"> 33 </span><br />
<span style="color: #a52a2a;"> 34 </span> sum_of_even_digits_multiplied =<br />
<span style="color: #a52a2a;"> 35 </span> combined_and_multiplied_even_digits.to_s.scan(<span style="color: #6a5acd;">/</span><span style="color: #6a5acd;">.</span><span style="color: #6a5acd;">/</span>).inject(<span style="color: #ff00ff;">0</span>){|<span style="color: #008b8b;">total</span>,<span style="color: #008b8b;">digit</span>|total + digit.to_i }<br />
<span style="color: #a52a2a;"> 36 </span><br />
<span style="color: #a52a2a;"> 37 </span> ( <span style="color: #ff00ff;">10</span> &#8211; ( (sum_of_odd_digits + sum_of_even_digits_multiplied) % <span style="color: #ff00ff;">10</span> ) ) % <span style="color: #ff00ff;">10</span><br />
<span style="color: #a52a2a;"> 38 </span> <span style="color: #a020f0;">end</span><br />
<span style="color: #a52a2a;"> 39 </span><br />
<span style="color: #a52a2a;"> 40 </span> <span style="color: #a020f0;">def</span> <span style="color: #008b8b;">valid_format?</span><br />
<span style="color: #a52a2a;"> 41 </span> <span style="color: #008b8b;">@number</span> =~ <span style="color: #6a5acd;">/</span><span style="color: #6a5acd;">^</span><span style="color: #6a5acd;">[</span><span style="color: #ff00ff;">0-9</span><span style="color: #6a5acd;">]</span><span style="color: #6a5acd;">{13}</span><span style="color: #6a5acd;">$</span><span style="color: #6a5acd;">/</span> ? <span style="color: #ff00ff;">true</span> : <span style="color: #ff00ff;">false</span><br />
<span style="color: #a52a2a;"> 42 </span> <span style="color: #a020f0;">end</span><br />
<span style="color: #a52a2a;"> 43 </span><br />
<span style="color: #a52a2a;"> 44 </span> <span style="color: #a020f0;">def</span> <span style="color: #008b8b;">valid_birth_date?</span><br />
<span style="color: #a52a2a;"> 45 </span> <span style="color: #a52a2a;"><strong>begin</strong></span><br />
<span style="color: #a52a2a;"> 46 </span> <span style="color: #a52a2a;"><strong>return</strong></span> <span style="color: #ff00ff;">false</span> <span style="color: #a52a2a;"><strong>unless</strong></span> <span style="color: #2e8b57;"><strong>Time</strong></span>.parse(<span style="color: #008b8b;">@number</span>[<span style="color: #ff00ff;">0</span>..<span style="color: #ff00ff;">5</span>]).strftime(<span style="color: #6a5acd;">&#8216;</span><span style="color: #ff00ff;">%y%m%d</span><span style="color: #6a5acd;">&#8216;</span>) == <span style="color: #008b8b;">@number</span>[<span style="color: #ff00ff;">0</span>..<span style="color: #ff00ff;">5</span>]<br />
<span style="color: #a52a2a;"> 47 </span> <span style="color: #a52a2a;"><strong>rescue</strong></span><br />
<span style="color: #a52a2a;"> 48 </span> <span style="color: #a52a2a;"><strong>return</strong></span> <span style="color: #ff00ff;">false</span><br />
<span style="color: #a52a2a;"> 49 </span> <span style="color: #a52a2a;"><strong>end</strong></span><br />
<span style="color: #a52a2a;"> 50 </span> <span style="color: #ff00ff;">true</span><br />
<span style="color: #a52a2a;"> 51 </span> <span style="color: #a020f0;">end</span><br />
<span style="color: #a52a2a;"> 52 </span><br />
<span style="color: #a52a2a;"> 53 </span> <span style="color: #a020f0;">def</span> <span style="color: #008b8b;">valid_check_digit?</span><br />
<span style="color: #a52a2a;"> 54 </span> <span style="color: #ff00ff;">self</span>[<span style="color: #ff00ff;">12</span>] == generate_check_digit<br />
<span style="color: #a52a2a;"> 55 </span> <span style="color: #a020f0;">end</span><br />
<span style="color: #a52a2a;"> 56 </span><br />
<span style="color: #a52a2a;"> 57 </span> <span style="color: #a020f0;">def</span> <span style="color: #008b8b;">valid?</span><br />
<span style="color: #a52a2a;"> 58 </span> valid_format? <span style="color: #a52a2a;"><strong>and</strong></span> valid_birth_date? <span style="color: #a52a2a;"><strong>and</strong></span> valid_check_digit?<br />
<span style="color: #a52a2a;"> 59 </span> <span style="color: #a020f0;">end</span><br />
<span style="color: #a52a2a;"> 60 </span><br />
<span style="color: #a52a2a;"> 61 </span> <span style="color: #a020f0;">def</span> <span style="color: #008b8b;">to_s</span><br />
<span style="color: #a52a2a;"> 62 </span> <span style="color: #008b8b;">@number</span><br />
<span style="color: #a52a2a;"> 63 </span> <span style="color: #a020f0;">end</span><br />
<span style="color: #a52a2a;"> 64 </span><br />
<span style="color: #a52a2a;"> 65 </span> <span style="color: #a020f0;">def</span> <span style="color: #008b8b;">[]</span>( character_enum )<br />
<span style="color: #a52a2a;"> 66 </span> <span style="color: #a52a2a;"><strong>begin</strong></span><br />
<span style="color: #a52a2a;"> 67 </span> <span style="color: #008b8b;">@number</span>[character_enum].chr.to_i<br />
<span style="color: #a52a2a;"> 68 </span> <span style="color: #a52a2a;"><strong>rescue</strong></span><br />
<span style="color: #a52a2a;"> 69 </span> <span style="color: #ff00ff;">nil</span><br />
<span style="color: #a52a2a;"> 70 </span> <span style="color: #a52a2a;"><strong>end</strong></span><br />
<span style="color: #a52a2a;"> 71 </span> <span style="color: #a020f0;">end</span><br />
<span style="color: #a52a2a;"> 72 </span><br />
<span style="color: #a52a2a;"> 73 </span><span style="color: #a020f0;">end</span><br />
<span style="color: #a52a2a;"> 74 </span></span></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fstar120.co.za%2Fblog%2F2009%2F04%2F07%2Fvalidate-a-south-african-id-number%2F&amp;linkname=Validate%20a%20South%20African%20ID%20Number"><img src="http://star120.co.za/blog/wp-content/plugins/add-to-any/share_save_171_16.gif" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://star120.co.za/blog/2009/04/07/validate-a-south-african-id-number/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
