Freelance Projects

Upeksha Wisidagama

PHP GD + PayPal REST API Integration

A PHP GD extensive WordPress Plugin for Dynamic ID Card Generation with c128b Bars and Spaces Encoded Strings having a Cart Communicating to PayPal via REST(beta) API.

Mr. Archieh and His ID Card Project

The project was posted by Mr. Archieh on freelancer.com. I was among another 26 bidders with an average of 558USD budget. I knew, I could do this. I bidded with 388USD.

Project Description

Extensive use of the PHP GD Extension

A set of PHP GD image manupulation functions were at the core of this plugin serving the purpose of generating dynamic ID cards that were ready to be printed. Creating image resources from uploaded files. Adding text on top of the image. Even overlaying transparent image on top of the background was done. The project was about living inside the wonderful world of PHP GD image manupulation.

http://php.net/manual/en/book.image.php

RESTful PayPal Beta

RESTful PayPal Beta

The PayPal API uses HTTP verbs and a RESTful endpoint structure. OAuth 2.0 is used as the API Authorization framework. Request and response payloads are formatted as JSON.

- PayPal REST API Reference

With OAuth 2.0 authorization is easy. All you need to do is present your client credentials and obtain a bearer token. No signing of requests is needed as with earlier OAuth.

https://developer.paypal.com/webapps/developer/docs/api/

C128b Encoded Data

Visitors should be given a facility to enter a string of their choice and it should be immediately converted to a Barcode (c128b).

‘c128b Encoding with PHP’
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
$source_length = strlen($encoded_string);
$p = $padding_x;
for($i = 0; $i < $source_length; $i++){
    $val = intval(substr($encoded_string, $i, 1));

    $bar = 0 == $i%2 ? true : false;
    for($n = 0; $n < $val; $n++) {
        $p += 1;
        if($bar){
            imageline($barcode, $p*$thickness, $padding_y,
                $p*$thickness, $height, $black);
        }
    }
}
return $barcode;
?>

Code 128 is a very high-density barcode symbology. It is used for alphanumeric or numeric-only barcodes. It can encode all 128 characters of ASCII and, by use of an extension character (FNC4), the Latin-1 characters defined in ISO/IEC 8859-1

- Wikipedia

https://en.wikipedia.org/wiki/Code%5F128/

Completion of the Project

I was able to successfully finish the project.

Project Feedback