Does anybody here used PayEasy?

I'm a newbie baker.. Can anybody help me translate this into cake?

sample php checkout program:

<?php
if ($submit) {
        if (!is_numeric($amount)) {
                $error .= "Error: Invalid amount.<br>";
        }
        if (!is_string($description) || $description == '' ) {
                $error .= "Error: Invalid description.<br>";
        }
        if ($error == '') {
                $txnid = 'PE' . time();
                $merchant = 'STOREDEMO';
                $passwd = 'mozzy';
                $digest_str = "$amount:$txnid:$merchant:$passwd:$ccy";
                $digest = sha1($digest_str);
                $params = "merchantid=" . urlencode($merchant) .
                        "&txnid=" .  urlencode($txnid) .
                        "&amount=" . urlencode($amount) .
                        "&description=" . urlencode($description) .
                        "&ccy=" . urlencode($ccy) .
                        "&digest=" . urlencode($digest);
                if ($email != '' && $password != '') {
                        $params .= "&email=" . $email .
                                "&passwd_sha1=" . sha1("$email:$password");
                }
                $url = 'http://uat.payeasy.ph/login2.asp';

                ############################################
                # put subroutine here to store transaction
                # in file or database
                ############################################

                header("Location: $url?$params");
        }
}
?>
<?php echo $error; ?>
<form method="post">
<table>
<tr>
<td>Amount:</td>
<td><input type="text" name="amount"
        value="<?php echo $amount; ?>"></td></tr>
<tr>
<td>Description:</td>
<td><input type="text" name="description"
        value="<?php echo $description; ?>"></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="text" name="email"
        value="<?php echo $email; ?>"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password"
        ></td>
</tr>
<tr>
<td>Currency:</td>
<td><input type="text" name="ccy" value="<?php echo $ccy; ?>"></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Pay Now"></td>
</tr>
</table>
</form>



Test paydemo.php script
back

sample return program:

<?php
$merchantid = 'STOREDEMO';
$error = '';

if ($result == 'success') {
        $rdigest_str = "$txnid:$result:$merchantid";
        $chk_rdigest = sha1($rdigest_str);
        if ($digest == $chk_rdigest) {

                ##################################################
                # insert subroutine to update transaction status
                ##################################################

        } else {
                echo "Error: Incorrect digest.<br>";
        }
} else {

        ##################################################
        # insert subroutine to update transaction status
        ##################################################

}
?>
<table><tr><td>
Txn Id:
</td><td>
<?php echo $txnid; ?>
</td></tr>
<tr><td>
Result:
</td><td>
<?php echo $result; ?>
</td></tr>
<tr><td>
Reason:
</td><td>
<?php echo $reason; ?>
</td></tr>
<tr><td>
Digest:
</td><td>
<?php echo $digest; ?>
</td></tr>
</table>



Links: https://www.payeasy.ph/faq.asp#faqquestion8
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to