Skip to content

Commit

Permalink
Merge pull request #163 from HotcakesCommerce/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Will Strohl authored Sep 22, 2018
2 parents 7ace092 + 057e561 commit be08be2
Show file tree
Hide file tree
Showing 22 changed files with 414 additions and 289 deletions.
4 changes: 2 additions & 2 deletions Build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

<!-- Version Number -->
<PropertyGroup Condition=" '$(BUILD_NUMBER)' == '' ">
<Version>03.02.00</Version>
<Version>03.02.01</Version>
<FileVersion>01.00.00</FileVersion>
<InformationalVersion>01.00.00</InformationalVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(BUILD_NUMBER)' != '' ">
<!-- Build Server Number -->
<Version>03.02.00</Version>
<Version>03.02.01</Version>
<FileVersion>$(BUILD_NUMBER)</FileVersion>
<InformationalVersion>$(BUILD_NUMBER)</InformationalVersion>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[assembly: CLSCompliant(false)]
[assembly: ComVisible(false)]

[assembly: AssemblyVersion("3.02.00")]
[assembly: AssemblyVersion("3.02.01")]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
Expand Down
8 changes: 4 additions & 4 deletions GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
// </auto-generated>
//------------------------------------------------------------------------------

[assembly: System.Reflection.AssemblyCopyright("Copyright © 2017. All rights reserved.")]
[assembly: System.Reflection.AssemblyCopyright("Copyright © 2018. All rights reserved.")]
[assembly: System.Reflection.AssemblyConfiguration("Release")]
[assembly: System.Reflection.AssemblyVersion("03.00.00")]
[assembly: System.Reflection.AssemblyVersion("03.02.01")]
[assembly: System.Reflection.AssemblyFileVersion("01.00.00")]
[assembly: System.Reflection.AssemblyInformationalVersion("01.00.00")]



internal sealed partial class ThisAssembly {

internal const string AssemblyCopyright = "Copyright © 2017. All rights reserved.";
internal const string AssemblyCopyright = "Copyright © 2018. All rights reserved.";

internal const string AssemblyConfiguration = "Release";

internal const string AssemblyVersion = "03.00.00";
internal const string AssemblyVersion = "03.02.01";

internal const string AssemblyFileVersion = "01.00.00";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,10 @@ public override bool ProcessCheckout(OrderTaskContext context)
EventLog.LogEvent("PayPal Express Checkout", "CartReturnUrl=" + cartReturnUrl, EventLogSeverity.Information);

PaymentActionCodeType mode = PaymentActionCodeType.Authorization;
if (context.HccApp.CurrentStore.Settings.PayPal.ExpressAuthorizeOnly)
{
mode = PaymentActionCodeType.Order;
}
else
if (!context.HccApp.CurrentStore.Settings.PayPal.ExpressAuthorizeOnly)
{
mode = PaymentActionCodeType.Sale;
}
}

// Accelerated boarding
if (string.IsNullOrWhiteSpace(context.HccApp.CurrentStore.Settings.PayPal.UserName))
Expand Down
7 changes: 7 additions & 0 deletions Libraries/Hotcakes.Commerce/Catalog/WishListItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ public WishListItem()
/// </summary>
public OptionSelections SelectionData { get; set; }


/// <summary>
/// Show Additional Product Variant/Selection
/// </summary>
public string ProductShortDescription { get; set; }

private void Init()
{
Id = 0;
Expand All @@ -84,6 +90,7 @@ private void Init()
ProductId = string.Empty;
Quantity = 1;
SelectionData = new OptionSelections();
ProductShortDescription = string.Empty;
}

/// <summary>
Expand Down
9 changes: 9 additions & 0 deletions Libraries/Hotcakes.Commerce/Orders/Order.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,15 @@ public List<HtmlTemplateTag> GetReplaceableTags(HccRequestContext context)

var orderService = Factory.CreateService<OrderService>(context);
result.Add(new HtmlTemplateTag("[[Order.PaymentMethod]]", orderService.OrdersListPaymentMethods(this)));
var PurchaseOrderNumber = string.Empty;
foreach (var orderdetail in orderService.Transactions.FindForOrder(bvin))
{
if (!string.IsNullOrEmpty(orderdetail.PurchaseOrderNumber))
{
PurchaseOrderNumber += orderdetail.PurchaseOrderNumber + ",";
}
}
result.Add(new HtmlTemplateTag("[[Order.Payment.PoNumber]]", PurchaseOrderNumber.Trim().TrimEnd(',')));

result.Add(new HtmlTemplateTag("[[Order.PaymentStatus]]",
LocalizationUtils.GetOrderPaymentStatus(PaymentStatus, culture)));
Expand Down
24 changes: 19 additions & 5 deletions Libraries/Hotcakes.Commerce/Orders/OrderCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ private void CalculateTaxes(Order order)

private void TaxOrder(Order order)
{
TaxItems(order.ItemsAsITaxable(), order.BillingAddress, order.ShippingAddress, order.TotalOrderDiscounts);
TaxItems(order.ItemsAsITaxable(), order.BillingAddress, order.ShippingAddress, order.TotalOrderDiscounts,order.UserID);

var isTaxRateSame = true;
decimal taxRate = -1;
Expand Down Expand Up @@ -586,14 +586,28 @@ private void TaxOrder(Order order)
order.TotalTax = order.ItemsTax + order.ShippingTax;
}

private void TaxItems(List<ITaxable> items, IAddress billingAddress, IAddress shippingAddress,decimal totalOrderDiscounts)
private void TaxItems(List<ITaxable> items, IAddress billingAddress, IAddress shippingAddress,decimal totalOrderDiscounts,string userId)
{
var applyVATRules = _app.CurrentStore.Settings.ApplyVATRules;
decimal discount = 0;
decimal qty = 0;
if (totalOrderDiscounts != 0)
{
var qty = items.Where(i => i.IsTaxExempt == false && i.TaxSchedule != -1 && _app.OrderServices.TaxSchedules.FindForThisStore(i.TaxSchedule) != null).Sum(i => i.Quantity);
discount = totalOrderDiscounts / qty;
foreach (var i in items)
{
if (i.IsTaxExempt == false && i.TaxSchedule != -1)
{
if (_app.OrderServices.TaxSchedules.FindForThisStore(i.TaxSchedule) != null)
{
qty += i.Quantity;
}
}
}

if (qty != 0)
{
discount = totalOrderDiscounts / qty;
}
}

foreach (var item in items)
Expand Down Expand Up @@ -622,7 +636,7 @@ private void TaxItems(List<ITaxable> items, IAddress billingAddress, IAddress sh

if (tax != null)
{
var user = _app.CurrentCustomer;
var user = _app.MembershipServices.Customers.Find(userId);
var taxExemptUser = user != null ? user.TaxExempt : false;

if (!taxExemptUser)
Expand Down
8 changes: 7 additions & 1 deletion Libraries/Hotcakes.Commerce/Payment/Methods/PaypalExpress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,16 @@ public bool Authorize(Transaction t, HotcakesApplication app)
{
var OrderNumber = t.MerchantInvoiceNumber + Guid.NewGuid();

PaymentActionCodeType mode = PaymentActionCodeType.Authorization;
if (!app.CurrentStore.Settings.PayPal.ExpressAuthorizeOnly)
{
mode = PaymentActionCodeType.Sale;
}

var paymentResponse = ppAPI.DoExpressCheckoutPayment(t.PreviousTransactionNumber,
t.PreviousTransactionAuthCode,
t.Amount.ToString("N", CultureInfo.InvariantCulture),
PaymentActionCodeType.Order,
mode,
PayPalAPI.GetCurrencyCodeType(app.CurrentStore.Settings.PayPal.Currency),
OrderNumber);

Expand Down
17 changes: 15 additions & 2 deletions Libraries/Hotcakes.Shipping.Ups/UPSService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private List<IShippingRate> GetAllShippingRatesForShipment(IShipment shipment)
sXML = XmlTools.BuildAccessKey(settings);
sXML += "\n";

sXML += BuildUPSRateRequestForShipment(shipment);
sXML += BuildUPSRateRequestForShipment(shipment, settings);

var sResponse = string.Empty;
sResponse = XmlTools.ReadHtmlPage_POST(sURL, sXML);
Expand Down Expand Up @@ -429,7 +429,7 @@ private string DecodeUpsServiceCode(string sCode)
return "UPS";
}

private string BuildUPSRateRequestForShipment(IShipment shipment)
private string BuildUPSRateRequestForShipment(IShipment shipment, UpsSettings settings)
{
var sXML = string.Empty;
var strWriter = new StringWriter();
Expand Down Expand Up @@ -497,7 +497,15 @@ private string BuildUPSRateRequestForShipment(IShipment shipment)
xw.WriteElementString("City", XmlTools.TrimToLength(shipment.SourceAddress.City.Trim(), 30));
}

if (shipment.SourceAddress.RegionData != null)
{
xw.WriteElementString("StateProvinceCode", shipment.SourceAddress.RegionData.Abbreviation);
}

xw.WriteElementString("CountryCode", shipment.SourceAddress.CountryData.IsoCode);

xw.WriteElementString("ShipperNumber", settings.License);

xw.WriteEndElement();
xw.WriteEndElement();

Expand All @@ -517,6 +525,11 @@ private string BuildUPSRateRequestForShipment(IShipment shipment)
}
}

if (shipment.DestinationAddress.RegionData != null)
{
xw.WriteElementString("StateProvinceCode", shipment.DestinationAddress.RegionData.Abbreviation);
}

if (shipment.DestinationAddress.CountryData.Bvin.Length > 0)
{
xw.WriteElementString("CountryCode", shipment.DestinationAddress.CountryData.IsoCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
using Hotcakes.Commerce.Membership;
using Hotcakes.Modules.Core.Admin.AppCode;
using Hotcakes.Web;
using System.Linq;

namespace Hotcakes.Modules.Core.Admin.Controls
{
Expand Down Expand Up @@ -211,8 +212,8 @@ protected void btnValidateUser_Click(object sender, ImageClickEventArgs e)

private void ValidateUser()
{
var u
= HccApp.MembershipServices.Customers.FindByUsername(UserNameField.Text.Trim());
var users = HccApp.MembershipServices.Customers.FindByEmail(UserNameField.Text.Trim());
var u = users != null ? users.FirstOrDefault() : null;
if (u != null)
{
if (u.Bvin != string.Empty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
if (ids.length > 0) {
var templateId = $lstPrintTemplate.val();
var redirectUrl = "PrintOrder.aspx?templateid=" + templateId + "&autoprint=1&id=" + ids.join(",");
window.location.replace(redirectUrl);
window.open(redirectUrl, "_blank");
} else {
hcAlert(event, "Please select at least one order to print first.");
}
Expand Down
88 changes: 47 additions & 41 deletions Website/DesktopModules/Hotcakes/Core/Admin/Orders/PrintOrder.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,60 @@
<%@ Register Src="OrderActions.ascx" TagName="OrderActions" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HccAdminPopupConent" runat="Server">

<script type="text/javascript">
function doPrint() {
if (window.print) {
window.print();
} else {
alert('Please choose the print button from your browser. Usually in the menu dropdowns at File: Print');
}
}
<script type="text/javascript">
function doPrint() {
if (window.print) {
window.print();
} else {
alert('Please choose the print button from your browser. Usually in the menu dropdowns at File: Print');
}
}
jQuery(function ($) {
if (hcc.getUrlVar('autoprint') == "1") {
doPrint();
}
});
</script>
jQuery(function ($) {
if (hcc.getUrlVar('autoprint') == "1") {
doPrint();
}
});
</script>

<div style="background: #fff; padding: 10px;">
<div class="hcNavContent printhidden">
<uc1:OrderActions ID="OrderActions1" HideActions="true" runat="server" />
<div style="background: #fff; padding: 10px;">
<div class="hcNavContent printhidden">
<uc1:OrderActions ID="OrderActions1" HideActions="true" runat="server" />

<div class="hcBlockNoBorder">
<asp:LinkButton ID="lnkPrintNow" runat="server" Text="Print" CssClass="hcPrimaryAction" OnClientClick="javascript:doPrint();" />
</div>
</div>
<div class="hcMainContent printhidden">
<h1>Print Order</h1>
Template:
<div class="hcBlockNoBorder">
<asp:LinkButton ID="lnkPrintNow" runat="server" Text="Print" CssClass="hcPrimaryAction" OnClientClick="javascript:doPrint();" />
</div>
</div>
<div class="hcMainContent printhidden">
<h1>Print Order</h1>
Template:
<asp:DropDownList ID="TemplateField" runat="Server"></asp:DropDownList>
<asp:ImageButton ID="btnGenerate" runat="server"
ImageUrl="~/DesktopModules/Hotcakes/Core/Admin/Images/Buttons/Go.png" OnClick="btnGenerate_Click" />
</div>
<div class="printbackground">
<asp:DataList BackColor="#FFFFFF" ID="DataList1" runat="server" Width="100%" OnItemDataBound="DataList1_ItemDataBound">
</div>
<div class="printbackground">
<asp:repeater id="rpOrder" runat="server" OnItemDataBound="rpOrder_ItemDataBound">
<ItemTemplate>
<div class="printhidden">
<hr />
</div>
<asp:Literal ID="litTemplate" runat="server"></asp:Literal>
<table style="width:100%; background-color:#FFFFFF">
<tbody>
<tr>
<td>
<div class="printhidden">
<hr />
</div>
<asp:Literal ID="litTemplate" runat="server"></asp:Literal>
</td>
</tr>
</tbody>
</table>
<div id="pagebreak" runat="server">&nbsp;</div>
</ItemTemplate>
<SeparatorTemplate>
<div style="page-break-after: always;">&nbsp;</div>
</SeparatorTemplate>
</asp:DataList>
</div>
<div class="printhidden clear">
<asp:ImageButton ID="btnContinue2" runat="server" ImageUrl="~/DesktopModules/Hotcakes/Core/Admin/Images/Buttons/Ok.png" OnClick="btnContinue2_Click" />
</div>
</asp:repeater>
</div>
<div class="printhidden clear">
<asp:ImageButton ID="btnContinue2" runat="server" ImageUrl="~/DesktopModules/Hotcakes/Core/Admin/Images/Buttons/Ok.png" OnClick="btnContinue2_Click" />
</div>

<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</asp:Content>
Original file line number Diff line number Diff line change
Expand Up @@ -141,28 +141,41 @@ private void Generate()
var id = Request.QueryString["id"];
id = id.TrimEnd(',');
var os = id.Split(',');
DataList1.DataSource = os;
DataList1.DataBind();
rpOrder.DataSource = os;
rpOrder.DataBind();
}

protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
protected void rpOrder_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
{

if (e.Item.ItemType == ListItemType.AlternatingItem | e.Item.ItemType == ListItemType.Item)
{
long templateId = 0;
long.TryParse(TemplateField.SelectedValue, out templateId);
var t = HccApp.ContentServices.HtmlTemplates.Find(templateId);
if (t != null)
{
var orderId = (string) e.Item.DataItem;
var orderId = (string)e.Item.DataItem;
var o = HccApp.OrderServices.Orders.FindForCurrentStore(orderId);
var litTemplate = (Literal) e.Item.FindControl("litTemplate");
var litTemplate = (Literal)e.Item.FindControl("litTemplate");
if (litTemplate != null)
{
t = t.ReplaceTagsInTemplateForOrder(HccApp.CurrentRequestContext, o);
litTemplate.Text = t.Body;
}
}

var id = Request.QueryString["id"];
if (!string.IsNullOrEmpty(id))
{
var count = id.TrimEnd(',').Split(',').Length;
if (e.Item.ItemIndex != count - 1)
{
System.Web.UI.HtmlControls.HtmlGenericControl div = (System.Web.UI.HtmlControls.HtmlGenericControl)e.Item.FindControl("pagebreak");
div.Attributes.Add("style", "page-break-after: always;");
}
}

}
}
}
Expand Down
Loading

0 comments on commit be08be2

Please sign in to comment.