Created
June 16, 2009 15:32
-
-
Save jamierumbelow/130742 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('XMLNS_RB_UPLOAD', '<UploadRequestV1 xmlns="http://www.optimalpayments.com/billing/xmlschema/v1" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://www.optimalpayments.com/billing/xmlschema/v1">'); | |
define('XMLNS_RB_UPLOAD_END', '</UploadRequestV1>'); | |
public function rb_create($consumer, $billing, $shipping, $card, $interval, $start, $end, $amount) { | |
$xml = XMLNS_RB_UPLOAD; | |
$xml .= '<merchantRefNum>Ref-'. substr(sha1(time() . rand(0, 100)),0,7).'</merchantRefNum>'; | |
$xml .= '<paymentInstruction>'; | |
$xml .= '<action>CREATION</action>'; | |
$xml .= $this->_cc_prep_account(); | |
$xml .= "<consumerInfo> | |
<firstName>".$consumer['firstName']."</firstName> | |
<lastName>".$consumer['lastName']."</lastName> | |
<title>".$consumer['title']."</title> | |
</consumerInfo> | |
<billingAddress> | |
<street>".$billing['street']."</street> | |
<city>".$billing['city']."</city> | |
<region>".$billing['state']."</region> | |
<country>".$billing['country']."</country> | |
<zip>".$billing['zip']."</zip> | |
</billingAddress> | |
<shippingAddress> | |
<street>".$shipping['street']."</street> | |
<city>".$shipping['city']."</city> | |
<region>".$shipping['state']."</region> | |
<country>".$shipping['country']."</country> | |
<zip>".$shipping['zip']."</zip> | |
</shippingAddress> | |
<contactMethods> | |
<contactMethod> | |
<type>PHN_HOME</type> | |
<value>".$consumer['phone']."</value> | |
</contactMethod> | |
<contactMethod> | |
<type>EMAIL</type> | |
<value>".$consumer['email']."</value> | |
</contactMethod> | |
</contactMethods> | |
<paymentMethod> | |
<merchantRefNum>RBILLING-". substr(sha1(time() . rand(0, 100)),0,7)."</merchantRefNum> | |
<card> | |
<cardNum>".$card['cardNum']."</cardNum> | |
<cardExpiry> | |
<month>".$card['cardExpiry']['month']."</month> | |
<year>".$card['cardExpiry']['year']."</year> | |
</cardExpiry> | |
<cardType>".$card['cardType']."</cardType> | |
</card> | |
</paymentMethod> | |
<billingSchedule> | |
<transactionMode>CCPURCHASE</transactionMode> | |
<merchantRefNum>PAY-". substr(sha1(time() . rand(0, 100)),0,7)."</merchantRefNum> | |
<intervalCode>".$interval."</intervalCode> | |
<startDate>".date('Y-m-d', $start + 86400)."</startDate> | |
<endDate>".date('Y-m-d', $end)."</endDate> | |
<amount>".$amount."</amount> | |
<lastDayOfTheMonth>Y</lastDayOfTheMonth> | |
</billingSchedule> | |
</paymentInstruction> | |
</UploadRequestV1>"; | |
$xml .= XMLNS_RB_UPLOAD_END; | |
//die(var_dump($xml)); | |
return $this->rb_call('billingUpload', $xml); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how will this work with the hoested api? how to implement this code