Skip to content

Commit

Permalink
1.4.3.0 (2018-10-09)
Browse files Browse the repository at this point in the history
* Deleted a hard-coded TxnRef in TestPOS GetLast and ReprintReceipt command
* Fixed bug in MessageParser that padded the TxnRef rather than leaving it blank, so the EFTClient didn't like it
  • Loading branch information
Sam Coianiz committed Oct 8, 2018
1 parent 74b2b4d commit 9b58bb6
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 48 deletions.
2 changes: 1 addition & 1 deletion IPInterface.TestPOS/ViewModels/EftWrapper.cs
Expand Up @@ -445,7 +445,7 @@ await SendRequest<EFTReprintReceiptResponse>(new EFTReprintReceiptRequest()
CutReceipt = cutMode,
ReceiptAutoPrint = printMode,
ReprintType = type,
OriginalTxnRef = "1234"
OriginalTxnRef = ""
});
}
#endregion
Expand Down
20 changes: 15 additions & 5 deletions IPInterface/IPInterface.csproj
Expand Up @@ -5,8 +5,8 @@
<AssemblyName>PCEFTPOS.EFTClient.IPInterface</AssemblyName>
<Title>PCEFTPOS.EFTClient.IPInterface</Title>
<PackageId>PCEFTPOS.EFTClient.IPInterface</PackageId>
<PackageVersion>1.4.2.0</PackageVersion>
<Version>1.4.2.0</Version>
<PackageVersion>1.4.3.0</PackageVersion>
<Version>1.4.3.0</Version>
<Description>TCP/IP library used for connecting to PC-EFTPOS Client</Description>
<Authors>PC-EFTPOS Pty Ltd</Authors>
<Company>PC-EFTPOS Pty Ltd</Company>
Expand All @@ -17,11 +17,21 @@
<SignAssembly>false</SignAssembly>
<AssemblyOriginatorKeyFile>pceftpos.pfx</AssemblyOriginatorKeyFile>
<ReleaseNotes>
1.4.3.0 (2018-10-09)
* Deleted a hard-coded TxnRef in TestPOS GetLast and ReprintReceipt command
* Fixed bug in MessageParser that padded the TxnRef rather than leaving it blank, so the EFTClient didn't like it


1.4.2.0 (2018-09-19)
* Added new ReceiptAutoPrint modes for EFTRequests
* Updated MessageParser to use non-deprecated properties
</ReleaseNotes>
<PackageReleaseNotes>1.4.2.0 (2018-09-19)
<PackageReleaseNotes>1.4.3.0 (2018-10-09)
* Deleted a hard-coded TxnRef in TestPOS GetLast and ReprintReceipt command
* Fixed bug in MessageParser that padded the TxnRef rather than leaving it blank, so the EFTClient didn't like it


1.4.2.0 (2018-09-19)
* Added new ReceiptAutoPrint modes for EFTRequests
* Updated MessageParser to use non-deprecated properties

Expand All @@ -46,8 +56,8 @@
* Added support for basket data API
* Updated some property names to bring EFTClientIP more inline with the existing ActiveX interface. Old property names have been marked obsolete, but are still supported.
</PackageReleaseNotes>
<AssemblyVersion>1.4.2.0</AssemblyVersion>
<FileVersion>1.4.2.0</FileVersion>
<AssemblyVersion>1.4.3.0</AssemblyVersion>
<FileVersion>1.4.3.0</FileVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions IPInterface/Model/EFTRequest.cs
Expand Up @@ -15,9 +15,9 @@ public enum ReceiptPrintModeType
/// <summary> Receipts will be printed using the pinpad printer </summary>
PinpadPrinter = '9',
/// <summary> Merchant receipts print on internal printer, all other print on POS </summary>
MerchantPOSPrinter = '7',
MerchantInternalPOSPrinter = '7',
/// <summary> Merchant receipts print on internal printer, all other print using the printer configured in the EFT-Client (Windows only) </summary>
MerchantEFTClientPrinter = '8'
MerchantInternalEFTClientPrinter = '8'
}

/// <summary>
Expand Down
88 changes: 50 additions & 38 deletions IPInterface/PCEFTPOS/Util/StringExtension.cs
@@ -1,41 +1,53 @@
using System;

namespace PCEFTPOS.EFTClient.IPInterface
namespace PCEFTPOS.EFTClient.IPInterface
{
public static class StringExtension
{
/// <summary>
/// Pad or cut a string so that the length is equal to totalWidth
/// </summary>
/// <param name="v"></param>
/// <param name="totalWidth">The width of the string to return</param>
/// <returns>A string of length totalWidth</returns>
public static string PadRightAndCut(this string v, int totalWidth)
{
if (v.Length == totalWidth)
return v;
else if (v.Length < totalWidth)
return v.PadRight(totalWidth);
else
return v.Substring(0, totalWidth);
}
public static class StringExtension
{
/// <summary>
/// Pad or cut a string so that the length is equal to totalWidth
/// </summary>
/// <param name="v"></param>
/// <param name="totalWidth">The width of the string to return</param>
/// <returns>A string of length totalWidth</returns>
public static string PadRightAndCut(this string v, int totalWidth)
{
if (v.Length == totalWidth)
return v;
else if (v.Length < totalWidth)
return v.PadRight(totalWidth);
else
return v.Substring(0, totalWidth);
}

/// <summary>
/// Pad or cut a string so that the length is equal to totalWidth
/// </summary>
/// <param name="v"></param>
/// <param name="totalWidth">The width of the string to return</param>
/// <param name="paddingChar">The char to use for padding if required</param>///
/// <returns>A string of length totalWidth</returns>
/// <summary>
public static string PadRightAndCut(this string v, int totalWidth, char paddingChar)
{
if (v.Length == totalWidth)
return v;
else if (v.Length < totalWidth)
return v.PadRight(totalWidth, paddingChar);
else
return v.Substring(0, totalWidth);
}

/// <summary>
/// Pad or cut a string so that the length is equal to totalWidth
/// </summary>
/// <param name="v"></param>
/// <param name="totalWidth">The width of the string to return</param>
/// <param name="paddingChar">The char to use for padding if required</param>///
/// <returns>A string of length totalWidth</returns>
/// <summary>
public static string PadRightAndCut(this string v, int totalWidth, char paddingChar)
{
if (v.Length == totalWidth)
return v;
else if (v.Length < totalWidth)
return v.PadRight(totalWidth, paddingChar);
else
return v.Substring(0, totalWidth);
}
}
/// <summary>
/// Returns a substring of totalWidth length, or if input length is less than, leaves it alone
/// </summary>
/// <param name="v"></param>
/// <param name="totalWidth"></param>
/// <returns></returns>
public static string CutAndLeave(this string v, int totalWidth)
{
if (v.Length > totalWidth)
return v.Substring(0, totalWidth);
else
return v;
}
}
}
4 changes: 2 additions & 2 deletions IPInterface/Util/MessageParser.cs
Expand Up @@ -1032,7 +1032,7 @@ StringBuilder BuildEFTReprintReceiptRequest(EFTReprintReceiptRequest v)
r.Append((char)v.CutReceipt);
r.Append((char)v.ReceiptAutoPrint);
r.Append(v.Application.ToApplicationString());
r.Append(v.OriginalTxnRef.PadRightAndCut(16));
r.Append(v.OriginalTxnRef.CutAndLeave(16));
return r;
}

Expand All @@ -1043,7 +1043,7 @@ StringBuilder BuildEFTGetLastTransactionRequest(EFTGetLastTransactionRequest v)
r.Append("0");
r.Append(v.Application.ToApplicationString());
r.Append(v.Merchant.PadRightAndCut(2));
r.Append(v.TxnRef.PadRightAndCut(16));
r.Append(v.TxnRef.CutAndLeave(16));
return r;
}

Expand Down
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -203,6 +203,10 @@ class EFTClientIPDemoAsync

## Release notes

### 1.4.3.0 (2018-10-09)
* Deleted a hard-coded TxnRef in TestPOS GetLast and ReprintReceipt command
* Fixed bug in MessageParser that padded the TxnRef rather than leaving it blank, so the EFTClient didn't like it

### 1.4.2.0 (2018-09-19)
* Added new ReceiptAutoPrint modes for EFTRequests
* Updated MessageParser to use non-deprecated properties
Expand Down

0 comments on commit 9b58bb6

Please sign in to comment.