Skip to content

Commit

Permalink
dev22
Browse files Browse the repository at this point in the history
  • Loading branch information
leedavi committed Oct 17, 2014
1 parent a6fd054 commit 8a264c3
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 28 deletions.
5 changes: 4 additions & 1 deletion App_LocalResources/PaymentSettings.ascx.resx
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,17 @@
<value>Template is displayed above the payment method selection, as a summary before select payment method. If no payment providers exist this template is not used.</value>
</data>
<data name="lbldisplaydetailtemplate.Text" xml:space="preserve">
<value>Summary template : </value>
<value>Summary Header Template : </value>
</data>
<data name="lblpaymentfailtemplate.Help" xml:space="preserve">
<value>Template displayed when the transaction fails.</value>
</data>
<data name="lblpaymentfailtemplate.Text" xml:space="preserve">
<value>Payment Fail template :</value>
</data>
<data name="lblpaymentfooter.Text" xml:space="preserve">
<value>Summary Footer Template : </value>
</data>
<data name="lblpaymentoktemplate.Help" xml:space="preserve">
<value>Template displayed when the payemnt has been successful. if no payment providers exist then the order is automatiocally processed and this template is displayed directly.</value>
</data>
Expand Down
2 changes: 2 additions & 0 deletions NBrightBuy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,8 @@
<Content Include="Themes\Cygnus\Default\ordershippedemail.html" />
<Content Include="Themes\Cygnus\Default\ordervalidatedemail.html" />
<Content Include="Themes\Cygnus\Default\paymentFAIL.html" />
<Content Include="Themes\Cygnus\Default\paymentfooter.html" />
<Content Include="Themes\Cygnus\Default\paymentheader.html" />
<Content Include="Themes\Cygnus\Default\paymentOK.html" />
<Content Include="Themes\Cygnus\Default\printorder.html" />
<Content Include="Themes\Cygnus\Default\printreceipt.html" />
Expand Down
1 change: 1 addition & 0 deletions Payment.ascx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<%@ Control language="C#" Inherits="Nevoweb.DNN.NBrightBuy.Payment" AutoEventWireup="true" Codebehind="Payment.ascx.cs" %>
<asp:Repeater ID="rpDetailDisplay" runat="server" OnItemCommand="CtrlItemCommand"></asp:Repeater>
<asp:Repeater ID="rpPaymentGateways" runat="server" OnItemCommand="CtrlItemCommand"></asp:Repeater>
<asp:Repeater ID="rpDetailFooter" runat="server" OnItemCommand="CtrlItemCommand"></asp:Repeater>
<asp:PlaceHolder ID="phData" runat="server"></asp:PlaceHolder>

19 changes: 14 additions & 5 deletions Payment.ascx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ override protected void OnInit(EventArgs e)

var templOk = ModSettings.Get("paymentoktemplate");
var templFail = ModSettings.Get("paymentfailtemplate");
var templPayment = "";
var templHeader = "";
var templFooter = "";

if (_provList.Count == 0)
{
Expand All @@ -87,7 +88,8 @@ override protected void OnInit(EventArgs e)
#region "Payment Details"

// display the payment method by default
templPayment = ModSettings.Get("paymentordersummary");
templHeader = ModSettings.Get("paymentordersummary");
templFooter = ModSettings.Get("paymentfooter");
var templPaymentText = "";
var msg = "";
var orderid = Utils.RequestQueryStringParam(Context, "orderid");
Expand All @@ -100,23 +102,29 @@ override protected void OnInit(EventArgs e)
if (msg == "") // no message so successful
{
_orderData = new OrderData(PortalId, Convert.ToInt32(orderid)); // get the updated order.
templPayment = templOk;
templHeader = templOk;
}
else
{
templPayment = templFail;
templHeader = templFail;
}
templFooter = ""; // return from bank, hide footer
}
else
{
// not returning from bank, so display list of payment providers.
rpPaymentGateways.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(GetPaymentProviderTemplates(), ModSettings.Settings(), PortalSettings.HomeDirectory);
}

templPaymentText = ModCtrl.GetTemplateData(ModSettings, templPayment, Utils.GetCurrentCulture(), DebugMode);
templPaymentText = ModCtrl.GetTemplateData(ModSettings, templHeader, Utils.GetCurrentCulture(), DebugMode);
rpDetailDisplay.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(templPaymentText + msg, ModSettings.Settings(), PortalSettings.HomeDirectory);
_templateHeader = (GenXmlTemplate)rpDetailDisplay.ItemTemplate;

if (templFooter != "")
{
var templPaymentFooterText = ModCtrl.GetTemplateData(ModSettings, templFooter, Utils.GetCurrentCulture(), DebugMode);
rpDetailFooter.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(templPaymentFooterText, ModSettings.Settings(), PortalSettings.HomeDirectory);
}

#endregion
}
Expand Down Expand Up @@ -189,6 +197,7 @@ private void PageLoad()
// display return page
DoDetail(rpDetailDisplay,_cartInfo.PurchaseInfo);
DoDetail(rpPaymentGateways, _cartInfo.PurchaseInfo);
DoDetail(rpDetailFooter, _cartInfo.PurchaseInfo);


#endregion
Expand Down
9 changes: 9 additions & 0 deletions Payment.ascx.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion Providers/TaxProvider/App_LocalResources/Tax.ascx.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,25 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="enabletaxcountry.Text" xml:space="preserve">
<value>Enable use of Country for Tax exempt.</value>
</data>
<data name="enabletaxnumber.Text" xml:space="preserve">
<value>Enable use of Compnay Tax Number to remove Tax</value>
<value>Enable use of (EU) Tax Number for Tax Exempt</value>
</data>
<data name="taxdefault.Text" xml:space="preserve">
<value>Default Tax (%)</value>
</data>
<data name="taxexemptregions.Text" xml:space="preserve">
<value>Taxed Region codes (CSV list)</value>
</data>
<data name="taxrate.Text" xml:space="preserve">
<value>Tax Rate (%)</value>
</data>
<data name="taxtype.data" xml:space="preserve">
<value>Tax Included in Unit Price;Tax NOT Included in Unit Price;No Tax</value>
</data>
<data name="valideutaxcountrycode.Text" xml:space="preserve">
<value>Valid EU country codes (CSV List)</value>
</data>
</root>
84 changes: 73 additions & 11 deletions Providers/TaxProvider/TaxProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.Xml;
using DotNetNuke.Entities.Content.Common;
using NBrightCore.common;
using NBrightDNN;
using Nevoweb.DNN.NBrightBuy.Components;
Expand Down Expand Up @@ -46,28 +47,89 @@ public override NBrightInfo Calculate(NBrightInfo cartInfo)
if (taxtype == "2") cartInfo.SetXmlPropertyDouble("genxml/appliedtax", taxtotal);


var taxcountry = cartInfo.GetXmlProperty("genxml/billaddress/genxml/dropdownlist/country");
var storecountry = StoreSettings.Current.Get("storecountry");
var valideutaxcountrycode = info.GetXmlProperty("genxml/textbox/valideutaxcountrycode");
var isvalidEU = false;
valideutaxcountrycode = "," + valideutaxcountrycode.ToUpper().Replace(" ", "") + ",";
if ((valideutaxcountrycode.Contains("," + taxcountry.ToUpper().Replace(" ", "") + ","))) isvalidEU = true;

// Check for EU tax number.
var enabletaxnumber = info.GetXmlPropertyBool("genxml/checkbox/enabletaxnumber");
if (enabletaxnumber)
{
var taxnumer = cartInfo.GetXmlProperty("genxml/extrainfo/genxml/textbox/taxnumber");
var storetaxnumber = StoreSettings.Current.Get("storetaxnumber");
if (storetaxnumber.Length >= 2) storetaxnumber = storetaxnumber.Substring(0, 2).ToUpper();
if (taxnumer.ToUpper().StartsWith(storetaxnumber))
var taxnumber = cartInfo.GetXmlProperty("genxml/extrainfo/genxml/textbox/taxnumber");
if (taxnumber != "")
{
var storetaxnumber = StoreSettings.Current.Get("storetaxnumber");
if (storetaxnumber.Length >= 2) storetaxnumber = storetaxnumber.Substring(0, 2).ToUpper();
if (taxnumber.Length >= 2) taxnumber = taxnumber.Substring(0, 2).ToUpper();
if (taxnumber != storetaxnumber)
{
// not matching merchant country, so remove tax
if (taxtype == "1")
{
cartInfo.SetXmlPropertyDouble("genxml/taxcost", taxtotal * -1);
cartInfo.SetXmlPropertyDouble("genxml/appliedtax", taxtotal * -1);
}
if (taxtype == "2")
{
cartInfo.SetXmlPropertyDouble("genxml/taxcost", 0);
cartInfo.SetXmlPropertyDouble("genxml/appliedtax", 0);
}
}
}
}

// Check for country.
var enabletaxcountry = info.GetXmlPropertyBool("genxml/checkbox/enabletaxcountry");
if (enabletaxcountry)
{
if (taxcountry != "")
{
// matching merchant cuntry, so remove tax
if (taxtype == "1")
if (taxcountry != storecountry && !isvalidEU)
{
cartInfo.SetXmlPropertyDouble("genxml/taxcost", taxtotal * -1);
cartInfo.SetXmlPropertyDouble("genxml/appliedtax", taxtotal * -1);
// not matching merchant country, so remove tax
if (taxtype == "1")
{
cartInfo.SetXmlPropertyDouble("genxml/taxcost", taxtotal * -1);
cartInfo.SetXmlPropertyDouble("genxml/appliedtax", taxtotal * -1);
}
if (taxtype == "2")
{
cartInfo.SetXmlPropertyDouble("genxml/taxcost", 0);
cartInfo.SetXmlPropertyDouble("genxml/appliedtax", 0);
}
}
if (taxtype == "2")
}
}

// check for region exempt (in same country)
var taxexemptregions = info.GetXmlProperty("genxml/textbox/taxexemptregions");
if (taxexemptregions != "" && taxcountry == storecountry)
{
taxexemptregions = "," + taxexemptregions.ToUpper().Replace(" ","") + ",";
var taxregioncode = cartInfo.GetXmlProperty("genxml/billaddress/genxml/dropdownlist/region");
if (taxregioncode == "") taxregioncode = cartInfo.GetXmlProperty("genxml/billaddress/genxml/textbox/txtregion");
if (taxregioncode != "")
{
if (!taxexemptregions.Contains("," + taxregioncode.ToUpper().Replace(" ", "") + ","))
{
cartInfo.SetXmlPropertyDouble("genxml/taxcost", 0);
cartInfo.SetXmlPropertyDouble("genxml/appliedtax", 0);
// not matching merchant region, so remove tax
if (taxtype == "1")
{
cartInfo.SetXmlPropertyDouble("genxml/taxcost", taxtotal * -1);
cartInfo.SetXmlPropertyDouble("genxml/appliedtax", taxtotal * -1);
}
if (taxtype == "2")
{
cartInfo.SetXmlPropertyDouble("genxml/taxcost", 0);
cartInfo.SetXmlPropertyDouble("genxml/appliedtax", 0);
}
}
}
}


}

Expand Down
10 changes: 4 additions & 6 deletions Providers/TaxProvider/TaxProvider.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,16 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Tax.ascx">
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="Tax.ascx" />
<Content Include="Themes\config\default\settings.html" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="App_LocalResources\Tax.ascx.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Themes\config\resx\Method.ascx.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Themes\config\resx\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
Expand Down
23 changes: 22 additions & 1 deletion Providers/TaxProvider/Themes/config/default/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<div class="box-content">
<div class="form-horizontal dnnForm">
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-6">
[<tag id="taxtype" resourcekey="Tax.taxtype" type="radiobuttonlist" datavalue="1;2;3" selectedvalue="1"/>]
</div>
Expand All @@ -40,9 +41,29 @@
</div>
</div>

<div class="form-group">
<label class="col-sm-3 control-label">[<tag type="valueof" resourcekey="Tax.valideutaxcountrycode" />]</label>
<div class="col-sm-6">
[<tag id="valideutaxcountrycode" cssclass="form-control" type="textbox" Text="AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,EL,HU,IE,IT,LV,LT,LU,MT,NL,PL,PT,RO,SK,SI,ES,SE" />]
</div>
</div>

<div class="form-group">
<label class="col-sm-3 control-label">[<tag type="valueof" resourcekey="Tax.enabletaxcountry" />]</label>
<div class="col-sm-1">
[<tag id="enabletaxcountry" type="checkbox" Text="" />]
</div>
</div>

<div class="form-group">
<label class="col-sm-3 control-label">[<tag type="valueof" resourcekey="Tax.taxexemptregions" />]</label>
<div class="col-sm-4">
[<tag id="taxexemptregions" cssclass="form-control" type="textbox" Text="" />]
</div>
</div>

<div class="form-group">
<label class="col-sm-2 control-label">[<tag type="valueof" resourcekey="Tax.taxdefault" />]</label>
<label class="col-sm-3 control-label">[<tag type="valueof" resourcekey="Tax.taxdefault" />]</label>
<div class="col-sm-1">
[<tag id="taxdefault" cssclass="form-control" type="textbox" Text="" />]
</div>
Expand Down
5 changes: 4 additions & 1 deletion Themes/config/default/Payment_Settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ <h2 class="dnnFormSectionHead"><a href="" class="dnnSectionExpanded">[<tag type=
[<tag id="lblpaymentfailtemplate" type="dnn:labelcontrol" />][<tag id="paymentfailtemplate" type="textbox" width="150" maxlength="50" text="paymentfail.html" />]
</div>
<div class="dnnFormItem">
[<tag id="lbldisplaydetailtemplate" type="dnn:labelcontrol" />][<tag id="paymentordersummary" type="textbox" width="150" maxlength="50" text="paymentordersummary.html" />]
[<tag id="lbldisplaydetailtemplate" type="dnn:labelcontrol" />][<tag id="paymentordersummary" type="textbox" width="150" maxlength="50" text="paymentheader.html" />]
</div>
<div class="dnnFormItem">
[<tag id="lblpaymentfooter" type="dnn:labelcontrol" />][<tag id="paymentfooter" type="textbox" width="150" maxlength="50" text="paymentfooter.html" />]
</div>
</fieldset>

Expand Down
4 changes: 2 additions & 2 deletions Themes/config/default/settingsbody.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">Country</label>
<div class="col-sm-5">
[<tag id="storecountry" cssclass="form-control" type="textbox" maxlength="150" Text="" />]
[<tag id="storecountry" cssclass="form-control" type="countrydropdown" />]
</div>
</div>
<div class="form-group">
Expand Down Expand Up @@ -171,7 +171,7 @@
[<tag id="emaillogo" type="fileupload" cssclass="form-control" textwidth="0" maxlength="50" separator=" " />]
[<tag id="cmdUpload" type="linkbutton" cssclass="btn btn-default" resourcekey="General.cmdUploadFileButton" commandname="save" />]
[<tag type="if" xpath="genxml/hidden/hidemaillogo" textvalue="" display="{OFF}" />]
[<tag id="cmdRemovelogo" type="linkbutton" cssclass="btn btn-danger" resourcekey="Settings.cmdRemoveButton" commandname="removelogo" />]
[<tag id="cmdRemovelogo" type="linkbutton" cssclass="btn btn-danger" resourcekey="General.cmdRemoveButton" commandname="removelogo" />]
[<tag type='imageof' xpath='genxml/hidden/emaillogourl' thumb="100" />]
[<tag type="endif" />]
</div>
Expand Down

0 comments on commit 8a264c3

Please sign in to comment.