本文整理汇总了PHP中Gateway::AddAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP Gateway::AddAccount方法的具体用法?PHP Gateway::AddAccount怎么用?PHP Gateway::AddAccount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gateway
的用法示例。
在下文中一共展示了Gateway::AddAccount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ProcessPaymentForm
public function ProcessPaymentForm($data = array())
{
$postData = $this->_Validate($data);
if ($postData === false) {
return false;
}
// Is setup in test or live mode?
$this->_testmode = $this->GetValue("testmode") == "YES";
// PaySimple accepts payments in cents
$ccname = $postData['name'];
$cctype = $postData['cctype'];
$ccissueno = $postData['ccissueno'];
$ccissuedatem = $postData['ccissuedatem'];
$ccissuedatey = $postData['ccissuedatey'];
$ccnum = $postData['ccno'];
$ccexpm = $postData['ccexpm'];
$ccexpy = $postData['ccexpy'];
$cccvd = $postData['cccvd'];
$billingDetails = $this->GetBillingDetails();
$testmode = ($this->GetValue('testmode') == 'YES');
$message = '';
try{
$gateway = new Gateway();
$gateway->production = !$testmode;
$dynamicKey = new DynamicKey($this, $gateway);
//Create Customer
$customer = new Customer();
$BillingAddress = new Address();
$BillingAddress->AddressLine1 = $billingDetails['ordbillstreet1'] . ' ' . $billingDetails['ordbillstreet2'];
$BillingAddress->City = $billingDetails['ordbillsuburb'];
$BillingAddress->ZipCode = $billingDetails['ordbillzip'];
$customer->BillingAddress = $BillingAddress;
$customer->BillingCountryName = GetCountryISO3ById($billingDetails['ordbillcountryid']);
$customer->ShippingAddress = $BillingAddress;
$contact = new Contact();
$contact->EMail = $billingDetails['ordbillemail'];
$contact->Phone1 = $billingDetails['ordbillphone'];
$name = new Name();
$name->FirstName = $billingDetails['ordbillfirstname'];
$name->LastName = $billingDetails['ordbilllastname'];
$contact->Name = $name;
$customer->Contact = $contact;
$customer = $gateway->AddCustomer($dynamicKey->key, $customer);
if ($gateway->isError()) {
$message = $gateway->getErrorMessage();
}
$account = new CustomerAccountDTO();
$account->IsCreditCard = true;
$account->CreditCardNo = $ccnum;
$account->CCExpiry = "20".$ccexpy."-".$ccexpm."-01T00:00:00";
$account->CCType = $cctype;
$account->CustomerId = $customer;
$account->CardName = $ccname;
if (!$gateway->isError()) {
$account = $gateway->AddAccount($dynamicKey->key, $account);
}
if ($gateway->isError()) {
$message = $gateway->getErrorMessage();
}
if (isset($account->Id)) {
$PSpayment = new Payment();
if ($testmode) {
$PSpayment->Amount = 120;
}
else {
$PSpayment->Amount = $this->GetGatewayAmount();
}
$PSpayment->CustomerId = $customer;
$PSpayment->FromAccountId = $account->Id;
$PSpayment->PaymentTypeCode = "CC";
$PSpayment->PaymentSubTypeCode = "MOTO";
if (!$gateway->isError()) {
$PSpayment = $gateway->MakePayment($dynamicKey->key, $PSpayment, null);
}
if ($gateway->isError()) {
$message = $gateway->getErrorMessage();
}
}
else {
//.........这里部分代码省略.........