Skip to content

Commit

Permalink
- add min/max order for GTD POA
Browse files Browse the repository at this point in the history
  • Loading branch information
larisagroza committed Nov 18, 2014
1 parent b8bd9b8 commit cfa23f0
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 1 deletion.
56 changes: 56 additions & 0 deletions app/code/community/GlobalExperts/Hypercharge/Model/Mobile.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,4 +575,60 @@ public function getAllConfigChannels()
return $hypercharge_channels;
}

public function isApplicableToQuote($quote, $checksBitMask)
{
if ($checksBitMask & self::CHECK_USE_FOR_COUNTRY) {
if (!$this->canUseForCountry($quote->getBillingAddress()->getCountry())) {
return false;
}
}
if ($checksBitMask & self::CHECK_USE_FOR_CURRENCY) {
if (!$this->canUseForCurrency($quote->getStore()->getBaseCurrencyCode())) {
return false;
}
}
if ($checksBitMask & self::CHECK_USE_CHECKOUT) {
if (!$this->canUseCheckout()) {
return false;
}
}
if ($checksBitMask & self::CHECK_USE_FOR_MULTISHIPPING) {
if (!$this->canUseForMultishipping()) {
return false;
}
}
if ($checksBitMask & self::CHECK_USE_INTERNAL) {
if (!$this->canUseInternal()) {
return false;
}
}
if ($checksBitMask & self::CHECK_ORDER_TOTAL_MIN_MAX) {
$total = $quote->getBaseGrandTotal();
$minTotal = $this->getConfigData('min_order_total');
$maxTotal = $this->getConfigData('max_order_total');

if ($quote->getBillingAddress()->getCompany()) {
$minTotal = $this->getConfigData('min_order_total_bb');
$maxTotal = $this->getConfigData('max_order_total_bb');
}

if (!empty($minTotal) && $total < $minTotal || !empty($maxTotal) && $total > $maxTotal) {
return false;
}
}
if ($checksBitMask & self::CHECK_RECURRING_PROFILES) {
if (!$this->canManageRecurringProfiles() && $quote->hasRecurringItems()) {
return false;
}
}
if ($checksBitMask & self::CHECK_ZERO_TOTAL) {
$total = $quote->getBaseSubtotal() + $quote->getShippingAddress()->getBaseShippingAmount();
if ($total < 0.0001 && $this->getCode() != 'free'
&& !($this->canManageRecurringProfiles() && $quote->hasRecurringItems())
) {
return false;
}
}
return true;
}
}
4 changes: 4 additions & 0 deletions app/code/community/GlobalExperts/Hypercharge/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@
<allowspecific>0</allowspecific>
<test>1</test>
<terms><![CDATA[Mit der &Uuml;bermittlung der f&uuml;r die Abwicklung des Rechnungskaufes und einer Identit&auml;ts- und Bonit&auml;tspr&uuml;fung erforderlichen Daten an payolution bin ich einverstanden. <a style="float:none; display:inline; margin: 0" href="https://payment.payolution.com/payolution-payment/infoport/dataprivacyconsent?mId=SMOkbmRsZXIgeHh4" target="_blank">Meine Einwilligung</a> kann ich jederzeit mit Wirkung f&uuml;r die Zukunft widerrufen.]]></terms>
<min_order_total>10</min_order_total>
<max_order_total>1500</max_order_total>
<min_order_total_bb>50</min_order_total_bb>
<max_order_total_bb>1500</max_order_total_bb>
</hypercharge_mobile_purchase_on_account_gtd>
<hypercharge_wpf_purchase_on_account>
<active>0</active>
Expand Down
32 changes: 32 additions & 0 deletions app/code/community/GlobalExperts/Hypercharge/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,38 @@
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</terms>
<min_order_total translate="label">
<label>Minimum Order Total B2C</label>
<frontend_type>text</frontend_type>
<sort_order>120</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</min_order_total>
<max_order_total translate="label">
<label>Maximum Order Total B2C</label>
<frontend_type>text</frontend_type>
<sort_order>130</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</max_order_total>
<min_order_total_bb translate="label">
<label>Minimum Order Total B2B</label>
<frontend_type>text</frontend_type>
<sort_order>140</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</min_order_total_bb>
<max_order_total_bb translate="label">
<label>Maximum Order Total B2B</label>
<frontend_type>text</frontend_type>
<sort_order>150</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>0</show_in_store>
</max_order_total_bb>
</fields>
</hypercharge_mobile_purchase_on_account_gtd>
<hypercharge_mobile_gtd translate="label" module="bithypercharge">
Expand Down
3 changes: 2 additions & 1 deletion skin/frontend/base/default/hypercharge/js/hypercharge.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Hyper = Class.create({
}
}

json += "\"header_origin\" : \"" + this.headerOrigin + "\"," ;
//json += "\"header_origin\" : \"" + this.headerOrigin + "\"," ;
json += "\"payment_method\" : \"" + this.paymentMethod + "\" } } ";

var data = json.evalJSON(true);
Expand All @@ -175,6 +175,7 @@ Hyper = Class.create({
data: data,
dataType: "xml",
headers: { 'origin': this.headerOrigin },
contentType: "application/text; charset=utf-8",
success: function(result) {
var xml = jQuery(result);
var transactionStatus = xml.find("status").text();
Expand Down

0 comments on commit cfa23f0

Please sign in to comment.