本文整理汇总了PHP中Payment::site_currency方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::site_currency方法的具体用法?PHP Payment::site_currency怎么用?PHP Payment::site_currency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payment
的用法示例。
在下文中一共展示了Payment::site_currency方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPaymentFormFields
function getPaymentFormFields()
{
$site_currency = Payment::site_currency();
$paymentsList = '<div id="SecurePayTechCardsAvailable">';
$count = 0;
foreach (self::$credit_cards as $name => $image) {
$count++;
$class = '';
if ($count == 1) {
$class = "first";
}
if ($count % 2) {
$class .= " even";
} else {
$class .= " odd";
}
$paymentsList .= '<img src="' . $image . '" alt="' . $name . '" class="SecurePayTechCardImage' . $count . '" />';
}
Requirements::customScript('
function paymark_verify(merchant) {
window.open ("http://www.paymark.co.nz/dart/darthttp.dll?etsl&tn=verify&merchantid=" + merchant, "verify", "scrollbars=yes, width=400, height=400");
}
', 'paymark_verify');
$paymentsList .= '
<img height="30" src="payment_securatech/images/paymark_small.png" alt="Paymark Certified" onclick="paymark_verify (' . "'" . self::get_spt_merchant_id() . "'" . ')" class="last" />
</div>';
$fieldSet = new FieldSet();
$fieldSet->push(new LiteralField('SPTInfo', $paymentsList));
return $fieldSet;
}
示例2: accept
function accept()
{
$status = $_REQUEST['STATUS'];
switch ($status) {
case 5:
case 9:
if (!isset($_REQUEST["amount"]) && isset($_REQUEST["AMOUNT"])) {
$_REQUEST["amount"] = $_REQUEST["AMOUNT"];
}
if (!isset($_REQUEST["amount"]) && isset($_REQUEST["Amount"])) {
$_REQUEST["amount"] = $_REQUEST["Amount"];
}
if (!isset($_REQUEST["amount"])) {
$_REQUEST["amount"] = 0;
}
$money = DBField::create('Money', array("Amount" => floatval($_REQUEST["amount"]), "Currency" => Payment::site_currency()));
$this->payment->Amount = $money;
$this->payment->Status = 'Success';
break;
case 51:
case 91:
$this->payment->Status = 'Pending';
break;
case 52:
case 92:
$this->payment->Status = 'Failure';
break;
}
$this->payment->write();
$this->checkShaOut();
$this->payment->redirectToOrder();
}
示例3: populateDefaults
function populateDefaults()
{
parent::populateDefaults();
$this->Amount->Currency = Payment::site_currency();
$this->setClientIP();
}
示例4: addOtherValuesToConfigs
protected function addOtherValuesToConfigs()
{
$this->definitions["Payment"]["site_currency"] = "Default currency for the site. <br />SET USING Payment::set_site_currency(\"NZD\") in the _config.php FILES";
$this->configs["Payment"]["site_currency"] = Payment::site_currency() . " ";
$this->defaults["Payment"]["site_currency"] = "[no default set]";
$this->definitions["Geoip"]["default_country_code"] = "Default currency for the site. <br />SET USING Geoip::\$default_country_code in the _config.php FILES";
$this->configs["Geoip"]["default_country_code"] = Geoip::$default_country_code;
$this->defaults["Geoip"]["default_country_code"] = "[no default set]";
$this->definitions["Email"]["admin_email_address"] = "Default administrator email. <br />SET USING Email::\$admin_email_address = \"bla@ta.com\" in the _config.php FILES";
$this->configs["Email"]["admin_email_address"] = Email::$admin_email_address;
$this->defaults["Email"]["admin_email_address"] = "[no default set]";
$siteConfig = SiteConfig::current_site_config();
$this->definitions["SiteConfig"]["website_title"] = "The name of the website. <br />This is set in the <a href=\"/admin/show/root\">site configuration</a>.";
$this->configs["SiteConfig"]["website_title"] = $siteConfig->Title;
$this->defaults["SiteConfig"]["website_title"] = "[no default set]";
$this->definitions["SiteConfig"]["website_tagline"] = "The subtitle or tagline of the website. <br />This is set in the <a href=\"/admin/show/root\">site configuration</a>.";
$this->configs["SiteConfig"]["website_tagline"] = $siteConfig->Tagline;
$this->defaults["SiteConfig"]["website_tagline"] = "[no default set]";
}
示例5: Currency
/**
* Return the currency being used on the site.
* @return string Currency code, e.g. "NZD" or "USD"
*/
function Currency()
{
if (class_exists('Payment')) {
return Payment::site_currency();
}
}
示例6: set_allowed_currency
/**
* Set the currency for all products. Must match site curency.
* TODO set currency for entire site in central location
*
* @param Array $currency
*/
public static function set_allowed_currency(array $currency)
{
if (count($currency) && array_key_exists(Payment::site_currency(), $currency)) {
self::$allowed_currency = $currency;
} else {
user_error("Cannot set allowed currency. Currency must match: " . Payment::site_currency(), E_USER_WARNING);
//TODO return meaningful error to browser in case error not shown
return;
}
}
示例7: processPayment
/**
* Process payment using HTTPS POST
*/
function processPayment($data, $form)
{
$data = Convert::raw2sql($data);
$realPayment = $this->Amount->Amount;
if (Director::isDev()) {
if (isset($data["SecurePayTechTestAmountValue"])) {
if ($data["SecurePayTechTestAmountValue"] !== "") {
if ($data["SecurePayTechTestAmountValue"] == 0) {
$numberString = "99";
} else {
$numberString = "0." . $data["SecurePayTechTestAmountValue"];
}
$nicelyFormatted = number_format($numberString, 2);
$this->Amount->Amount = floatval($nicelyFormatted);
$this->Amount->Currency = Payment::site_currency();
}
}
if (isset($data["SecurePayTechCardsToUse"])) {
if ($data["SecurePayTechCardsToUse"] !== "") {
$cardArray = explode(",", $this->getCardData($data["SecurePayTechCardsToUse"]));
$data['SecurePayTechCreditCardNumber'] = trim($cardArray[1]);
$data['SecurePayTechCardExpiry'] = trim($cardArray[2]) . trim($cardArray[3]);
}
}
}
$orderRef = $this->ID;
$cardNo = $data['SecurePayTechCreditCardNumber'];
$cardExp = $data['SecurePayTechCardExpiry'];
$cardHolder = $data['SecurePayTechCardHolderName'];
$cardType = 0;
$amt = $this->Amount->Amount;
$currency = $this->Amount->Currency;
$postvars = array('OrderReference' => $orderRef, 'CardNumber' => $cardNo, 'CardExpiry' => $cardExp, 'CardHolderName' => $cardHolder, 'CardType' => $cardType, 'MerchantID' => self::get_spt_merchant_id(), 'MerchantKey' => self::$spt_merchant_key, 'Amount' => $amt, 'Currency' => $currency);
$this->Amount->setAmount($realPayment);
$response = $this->http_post('https', 'tx.securepaytech.com', 8443, '/web/HttpPostPurchase', $postvars);
if (!$response) {
$this->Status = 'Failure';
$this->Message = "Communication Failure";
if (Director::isDev()) {
$this->Message .= " (" . curl_error($ch) . ")";
}
$this->write();
$result = new Payment_Failure();
return $result;
}
$responses = explode(',', $response);
//var_dump ($responses);
if (!isset($responses[0])) {
$responses[0] = 0;
}
$ok = false;
if ($responses[0] == 1) {
$ok = true;
}
if ($ok) {
$this->Status = 'Success';
$result = new Payment_Success();
} else {
$this->Status = 'Failure';
$this->Message = $this->getResponseMessage($responses[0]);
$result = new Payment_Failure();
}
$this->write();
return $result;
}
示例8: PromoSavings
/**
* @return Money
*/
public function PromoSavings()
{
$currency = method_exists('ShopConfig', 'get_site_currency') ? ShopConfig::get_site_currency() : Payment::site_currency();
$field = new Money("PromoSavings");
$field->setAmount($this->calculatePromoSavings());
$field->setCurrency($currency);
return $field;
}
示例9: requireDefaultRecords
/**
* Standard SS Method
* Adds the default currency
*/
function requireDefaultRecords()
{
parent::requireDefaultRecords();
$defaultCurrencyCode = Payment::site_currency();
if (!DataObject::get_one("EcommerceCurrency", "\"Code\" = '{$defaultCurrencyCode}'")) {
$obj = new EcommerceCurrency();
$obj->Code = $defaultCurrencyCode;
$obj->Name = $defaultCurrencyCode;
$obj->InUse = 1;
$obj->write();
}
}
示例10: getUCurrency
function getUCurrency()
{
$currency = $this->owner->CurrencyUsed();
if ($currency->exists() && !empty($currency->Code)) {
return $currency->Code;
}
return Payment::site_currency();
}
示例11: updateForAjax
function updateForAjax(array &$js)
{
$subTotal = DBField::create('Currency', $this->SubTotal())->Nice();
$total = DBField::create('Currency', $this->Total())->Nice() . ' ' . Payment::site_currency();
$js[] = array('id' => $this->TableSubTotalID(), 'parameter' => 'innerHTML', 'value' => $subTotal);
$js[] = array('id' => $this->TableTotalID(), 'parameter' => 'innerHTML', 'value' => $total);
$js[] = array('id' => $this->OrderForm_OrderForm_AmountID(), 'parameter' => 'innerHTML', 'value' => $total);
$js[] = array('id' => $this->CartSubTotalID(), 'parameter' => 'innerHTML', 'value' => $subTotal);
$js[] = array('id' => $this->CartTotalID(), 'parameter' => 'innerHTML', 'value' => $total);
}
示例12: updateTotal
/**
* Go through items and modifiers and update cart total
*
* Had to use DataObject::get() to retrieve Items because
* $this->Items() was not returning any items after first call
* to $this->addItem().
*/
public function updateTotal()
{
$total = 0;
$subTotal = 0;
$items = DataObject::get('Item', 'OrderID = ' . $this->ID);
$modifications = DataObject::get('Modification', 'OrderID = ' . $this->ID);
if ($items) {
foreach ($items as $item) {
$total += $item->Total()->Amount;
$subTotal += $item->Total()->Amount;
}
}
if ($modifications) {
foreach ($modifications as $modification) {
if ($modification->SubTotalModifier) {
$total += $modification->Amount->getAmount();
$subTotal += $modification->Amount->getAmount();
} else {
$total += $modification->Amount->getAmount();
}
}
}
$this->SubTotal->setAmount($subTotal);
$this->SubTotal->setCurrency(Payment::site_currency());
$this->Total->setAmount($total);
$this->Total->setCurrency(Payment::site_currency());
$this->write();
}