本文整理汇总了PHP中Lookup::paycard方法的典型用法代码示例。如果您正苦于以下问题:PHP Lookup::paycard方法的具体用法?PHP Lookup::paycard怎么用?PHP Lookup::paycard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lookup
的用法示例。
在下文中一共展示了Lookup::paycard方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tag
//.........这里部分代码省略.........
$options['disabled'] = 'disabled';
$options['class'] = ($classname?"$classname ":"").'disabled hidden';
$output .= '<select name="billing[state]" id="billing-state-menu" '.inputattrs($options,$select_attrs).'>';
$output .= '<option value="">'.$label.'</option>';
if (is_array($states) && !empty($states)) $output .= menuoptions($states,$options['selected'],true);
$output .= '</select>';
unset($options['disabled']);
$options['class'] = $classname;
$output .= '<input type="text" name="billing[state]" id="billing-state" '.inputattrs($options).'/>';
return $output;
break;
case "billing-postcode":
if ($options['mode'] == "value") return $this->Billing->postcode;
if (!empty($this->Billing->postcode))
$options['value'] = $this->Billing->postcode;
return '<input type="text" name="billing[postcode]" id="billing-postcode" '.inputattrs($options).' />';
break;
case "billing-country":
if ($options['mode'] == "value") return $this->Billing->country;
if (!empty($this->Billing->country))
$options['selected'] = $this->Billing->country;
else if (empty($options['selected'])) $options['selected'] = $base['country'];
$output = '<select name="billing[country]" id="billing-country" '.inputattrs($options,$select_attrs).'>';
$output .= menuoptions($countries,$options['selected'],true);
$output .= '</select>';
return $output;
break;
case "billing-card":
if ($options['mode'] == "value")
return str_repeat('X',strlen($this->Billing->card)-4)
.substr($this->Billing->card,-4);
$options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard';
if (!empty($this->Billing->card)) {
$options['value'] = $this->Billing->card;
$this->Billing->card = "";
}
if (!isset($options['autocomplete'])) $options['autocomplete'] = "off";
return '<input type="text" name="billing[card]" id="billing-card" '.inputattrs($options).' />';
break;
case "billing-cardexpires-mm":
if ($options['mode'] == "value") return date("m",$this->Billing->cardexpires);
$options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard';
if (!isset($options['autocomplete'])) $options['autocomplete'] = "off";
if (!empty($this->Billing->cardexpires))
$options['value'] = date("m",$this->Billing->cardexpires);
return '<input type="text" name="billing[cardexpires-mm]" id="billing-cardexpires-mm" '.inputattrs($options).' />';
break;
case "billing-cardexpires-yy":
if ($options['mode'] == "value") return date("y",$this->Billing->cardexpires);
$options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard';
if (!isset($options['autocomplete'])) $options['autocomplete'] = "off";
if (!empty($this->Billing->cardexpires))
$options['value'] = date("y",$this->Billing->cardexpires);
return '<input type="text" name="billing[cardexpires-yy]" id="billing-cardexpires-yy" '.inputattrs($options).' />';
break;
case "billing-cardtype":
if ($options['mode'] == "value") return $this->Billing->cardtype;
$options['class'] = isset($options['class']) ? $options['class'].' paycard':'paycard';
if (!isset($options['selected'])) $options['selected'] = false;
if (!empty($this->Billing->cardtype))
$options['selected'] = $this->Billing->cardtype;
$cards = array();
foreach ($this->paycards as $paycard)
示例2: paycard
public static function paycard($result)
{
$fields = isset($_POST['billing']) ? $_POST['billing'] : array();
if (apply_filters('shopp_billing_card_required', isset($fields['card']) && empty($fields['card']))) {
return shopp_add_error(Shopp::__('You did not provide a credit card number.'));
}
if (apply_filters('shopp_billing_cardtype_required', isset($fields['cardtype']) && empty($fields['cardtype']))) {
return shopp_add_error(Shopp::__('You did not select a credit card type.'));
}
$card = Lookup::paycard(strtolower($fields['cardtype']));
// Skip validating payment details for purchases not requiring a
// payment (credit) card including free orders, remote checkout systems, etc
if (false === $card) {
return $result;
}
if (apply_filters('shopp_billing_valid_card', !$card->validate($fields['card']))) {
return shopp_add_error(Shopp::__('The credit card number you provided is invalid.'));
}
if (apply_filters('shopp_billing_cardexpires_month_required', empty($fields['cardexpires-mm']))) {
return shopp_add_error(Shopp::__('You did not enter the month the credit card expires.'));
}
if (apply_filters('shopp_billing_cardexpires_year_required', empty($fields['cardexpires-yy']))) {
return shopp_add_error(Shopp::__('You did not enter the year the credit card expires.'));
}
if (apply_filters('shopp_billing_card_expired', intval($fields['cardexpires-yy']) < intval(date('y')) || intval($fields['cardexpires-yy']) == intval(date('y')) && intval($fields['cardexpires-mm']) < intval(date('n')))) {
return shopp_add_error(Shopp::__('The credit card expiration date you provided has already expired.'));
}
if (apply_filters('shopp_billing_cvv_required', strlen($fields['cvv']) < 3)) {
return shopp_add_error(Shopp::__('You did not enter a valid security ID for the card you provided. The security ID is a 3 or 4 digit number found on the back of the credit card.'));
}
return $result;
}
示例3: purchase
/**
* Converts a shopping session order to a Purchase record
*
* @author Jonathan Davis
* @since 1.1
*
* @return void
**/
public function purchase(PurchaseOrderEvent $Event)
{
$Shopping = ShoppShopping();
$changed = $this->changed();
// No auth message, bail
if (empty($Event)) {
shopp_debug('Order failure: An empty order event message was received by the order processor.');
return;
}
// Copy details from Auth message
$this->txnstatus = $Event->name;
$this->gateway = $Event->gateway;
$paycard = Lookup::paycard($this->Billing->cardtype);
$this->Billing->cardtype = !$paycard ? $this->Billing->cardtype : $paycard->name;
$Paymethod = $this->Payments->selected();
$shipoption = $this->Shiprates->selected();
if (empty($this->inprogress)) {
// Create a new order
$Purchase = new ShoppPurchase();
} elseif (empty(ShoppPurchase()->id)) {
// Handle updates to an existing order from checkout reprocessing
$Purchase = new ShoppPurchase($this->inprogress);
} else {
// Update existing order
$Purchase = ShoppPurchase();
}
// Capture early event transaction IDs
if (isset($Event->txnid)) {
$Purchase->txnid = $this->txnid = $Event->txnid;
}
$Purchase->order = 0;
$Purchase->copydata($this);
$Purchase->copydata($this->Customer);
$Purchase->copydata($this->Billing);
$Purchase->copydata($this->Shipping, 'ship');
$Purchase->copydata($this->Cart->Totals->data());
$Purchase->subtotal = $Purchase->order;
// Remap order to subtotal
$Purchase->paymethod = $Paymethod->slug;
$Purchase->customer = $this->Customer->id;
$Purchase->taxing = shopp_setting_enabled('tax_inclusive') ? 'inclusive' : 'exclusive';
$Purchase->freight = $this->Cart->total('shipping');
$Purchase->shipoption = isset($shipoption->name) ? $shipoption->name : '';
$Purchase->ip = $Shopping->ip;
$Purchase->created = current_time('mysql');
unset($Purchase->order);
$Purchase->save();
// Catch Purchase record save errors
if (empty($Purchase->id)) {
shopp_add_error(Shopp::__('The order could not be created because of a technical problem on the server. Please try again, or contact the website administrator.'));
return;
}
ShoppPurchase($Purchase);
// Process the order events if updating an existing order
if (!empty($this->inprogress)) {
if ($changed) {
// The order has changed since the last order attempt
// Rebuild purchased records from cart items
$Purchase->delete_purchased();
remove_action('shopp_order_event', array($Purchase, 'notifications'));
// Void prior invoiced balance
shopp_add_order_event($Purchase->id, 'voided', array('txnorigin' => '', 'txnid' => '', 'gateway' => $Purchase->gateway));
// Recreate purchased records from the cart and re-invoice for the new order total
$this->items($Purchase->id);
$this->meta($Purchase);
$this->invoice($Purchase);
add_action('shopp_order_event', array($Purchase, 'notifications'));
} elseif ('voided' == $Purchase->txnstatus) {
$this->invoice($Purchase);
// Re-invoice cancelled orders that are still in-progress @see #1930
} elseif ($Purchase->did('invoiced')) {
// Reet the order status to invoiced without invoicing it again @see #3301
$Purchase->txnstatus = 'invoiced';
$Purchase->save();
}
$this->process($Purchase);
return;
}
$this->items($Purchase->id);
// Create purchased records from the cart items
$this->purchase = false;
// Clear last purchase in prep for new purchase
$this->inprogress = $Purchase->id;
// Keep track of the purchase record in progress for transaction updates
shopp_debug('Purchase ' . $Purchase->id . ' was successfully saved to the database.');
// Start the transaction processing events
do_action('shopp_purchase_order_created', $Purchase);
}
示例4: join
}
if (!isset($Gateways->active[$gateway])) {
continue;
}
$Gateway = $Gateways->active[$gateway];
$payment = $Gateway->settings;
if (false !== $id) {
$payment = $Gateway->settings[$id];
$slug = join('-', array($gateway, $id));
} else {
$slug = $gateway;
}
$cards = array();
if (isset($payment['cards'])) {
foreach ((array) $payment['cards'] as $symbol) {
$Paycard = Lookup::paycard($symbol);
if ($Paycard) {
$cards[] = $Paycard->name;
}
}
}
$editurl = add_query_arg(array('id' => $slug), $this->url);
$deleteurl = wp_nonce_url(add_query_arg(array('delete' => $slug), $this->url), 'shopp_delete_gateway');
$classes = array();
if (!$even) {
$classes[] = 'alternate';
}
$even = !$even;
if ($edit && $edit == $slug && in_array($edit, $gateways)) {
$event = strtolower($edit);
$template_data = array('${editing_class}' => "{$event}-editing", '${cancel_href}' => $this->url, '${instance}' => $id);