Skip to content

Commit c650341

Browse files
committed
v1.3.0
1 parent ad9f88d commit c650341

File tree

5 files changed

+295
-4
lines changed

5 files changed

+295
-4
lines changed

Components/ProviderUtils.cs

Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
using NBrightDNN;
1313
using Nevoweb.DNN.NBrightBuy.Components;
1414
using DotNetNuke.Common.Utilities;
15+
using NBrightCore.images;
16+
using System.Globalization;
1517

1618
namespace OS_PayBox
1719
{
1820
public class ProviderUtils
1921
{
22+
private static Dictionary<string, string> _countryCode;
2023
public static NBrightInfo GetProviderSettings()
2124
{
2225
var objCtrl = new NBrightBuyController();
@@ -77,6 +80,21 @@ public static String GetBankRemotePost(OrderData orderData)
7780
rPost.Add("PBX_RETOUR", info.GetXmlProperty("genxml/textbox/pbxretour"));
7881
}
7982

83+
//REQUIRED FOR 3DS
84+
85+
rPost.Add("PBX_SHOPPINGCART", "<?xml version='1.0' encoding='utf-8'?><shoppingcart><total><totalQuantity>" + orderData.GetInfo().GetXmlPropertyInt("genxml/totalqty") + "</totalQuantity></total></shoppingcart>");
86+
87+
PopulateCountryCode();
88+
var billAddrInfo = orderData.GetBillingAddress();
89+
var countryCode = billAddrInfo.GetXmlProperty("genxml/dropdownlist/country");
90+
var cCode = "250";
91+
if (_countryCode.ContainsKey(countryCode)) cCode = _countryCode[countryCode];
92+
93+
var xmlBilling = "<?xml version='1.0' encoding='utf-8'?><Billing><Address><FirstName>" + billAddrInfo.GetXmlProperty("genxml/textbox/firstname") + "</FirstName><LastName>" + billAddrInfo.GetXmlProperty("genxml/textbox/lastname") + "</LastName><Address1>" + billAddrInfo.GetXmlProperty("genxml/textbox/unit") + " " + billAddrInfo.GetXmlProperty("genxml/textbox/street") + "</Address1><ZipCode>" + billAddrInfo.GetXmlProperty("genxml/textbox/postalcode") + "</ZipCode><City>" + billAddrInfo.GetXmlProperty("genxml/textbox/city") + "</City><CountryCode>" + cCode + "</CountryCode></Address></Billing>";
94+
xmlBilling = StripAccents(xmlBilling);
95+
rPost.Add("PBX_BILLING", xmlBilling);
96+
97+
// Calc HMAC
8098
rPost.Add("PBX_HMAC", rPost.GetHmac(info.GetXmlProperty("genxml/textbox/hmackey")).ToUpper());
8199

82100

@@ -90,6 +108,278 @@ public static String GetBankRemotePost(OrderData orderData)
90108
}
91109
return rtnStr;
92110
}
111+
private static string StripAccents(string s)
112+
{
113+
var sb = new StringBuilder();
114+
foreach (char c in s.Normalize(NormalizationForm.FormKD))
115+
switch (CharUnicodeInfo.GetUnicodeCategory(c))
116+
{
117+
case UnicodeCategory.NonSpacingMark:
118+
case UnicodeCategory.SpacingCombiningMark:
119+
case UnicodeCategory.EnclosingMark:
120+
break;
121+
122+
default:
123+
sb.Append(c);
124+
break;
125+
}
126+
return sb.ToString();
127+
}
128+
129+
private static void PopulateCountryCode()
130+
{
131+
_countryCode = new Dictionary<string, string>();
132+
_countryCode.Add("AF", "004");
133+
_countryCode.Add("AL", "008");
134+
_countryCode.Add("DZ", "012");
135+
_countryCode.Add("AS", "016");
136+
_countryCode.Add("AD", "020");
137+
_countryCode.Add("AO", "024");
138+
_countryCode.Add("AI", "660");
139+
_countryCode.Add("AQ", "010");
140+
_countryCode.Add("AG", "028");
141+
_countryCode.Add("AR", "032");
142+
_countryCode.Add("AM", "051");
143+
_countryCode.Add("AW", "533");
144+
_countryCode.Add("AU", "036");
145+
_countryCode.Add("AT", "040");
146+
_countryCode.Add("AZ", "031");
147+
_countryCode.Add("BS", "044");
148+
_countryCode.Add("BH", "048");
149+
_countryCode.Add("BD", "050");
150+
_countryCode.Add("BB", "052");
151+
_countryCode.Add("BY", "112");
152+
_countryCode.Add("BE", "056");
153+
_countryCode.Add("BZ", "084");
154+
_countryCode.Add("BJ", "204");
155+
_countryCode.Add("BM", "060");
156+
_countryCode.Add("BT", "064");
157+
_countryCode.Add("BO", "068");
158+
_countryCode.Add("BQ", "535");
159+
_countryCode.Add("BA", "070");
160+
_countryCode.Add("BW", "072");
161+
_countryCode.Add("BV", "074");
162+
_countryCode.Add("BR", "076");
163+
_countryCode.Add("IO", "086");
164+
_countryCode.Add("BN", "096");
165+
_countryCode.Add("BG", "100");
166+
_countryCode.Add("BF", "854");
167+
_countryCode.Add("BI", "108");
168+
_countryCode.Add("CV", "132");
169+
_countryCode.Add("KH", "116");
170+
_countryCode.Add("CM", "120");
171+
_countryCode.Add("CA", "124");
172+
_countryCode.Add("KY", "136");
173+
_countryCode.Add("CF", "140");
174+
_countryCode.Add("TD", "148");
175+
_countryCode.Add("CL", "152");
176+
_countryCode.Add("CN", "156");
177+
_countryCode.Add("CX", "162");
178+
_countryCode.Add("CC", "166");
179+
_countryCode.Add("CO", "170");
180+
_countryCode.Add("KM", "174");
181+
_countryCode.Add("CD", "180");
182+
_countryCode.Add("CG", "178");
183+
_countryCode.Add("CK", "184");
184+
_countryCode.Add("CR", "188");
185+
_countryCode.Add("HR", "191");
186+
_countryCode.Add("CU", "192");
187+
_countryCode.Add("CW", "531");
188+
_countryCode.Add("CY", "196");
189+
_countryCode.Add("CZ", "203");
190+
_countryCode.Add("CI", "384");
191+
_countryCode.Add("DK", "208");
192+
_countryCode.Add("DJ", "262");
193+
_countryCode.Add("DM", "212");
194+
_countryCode.Add("DO", "214");
195+
_countryCode.Add("EC", "218");
196+
_countryCode.Add("EG", "818");
197+
_countryCode.Add("SV", "222");
198+
_countryCode.Add("GQ", "226");
199+
_countryCode.Add("ER", "232");
200+
_countryCode.Add("EE", "233");
201+
_countryCode.Add("SZ", "748");
202+
_countryCode.Add("ET", "231");
203+
_countryCode.Add("FK", "238");
204+
_countryCode.Add("FO", "234");
205+
_countryCode.Add("FJ", "242");
206+
_countryCode.Add("FI", "246");
207+
_countryCode.Add("FR", "250");
208+
_countryCode.Add("GF", "254");
209+
_countryCode.Add("PF", "258");
210+
_countryCode.Add("TF", "260");
211+
_countryCode.Add("GA", "266");
212+
_countryCode.Add("GM", "270");
213+
_countryCode.Add("GE", "268");
214+
_countryCode.Add("DE", "276");
215+
_countryCode.Add("GH", "288");
216+
_countryCode.Add("GI", "292");
217+
_countryCode.Add("GR", "300");
218+
_countryCode.Add("GL", "304");
219+
_countryCode.Add("GD", "308");
220+
_countryCode.Add("GP", "312");
221+
_countryCode.Add("GU", "316");
222+
_countryCode.Add("GT", "320");
223+
_countryCode.Add("GG", "831");
224+
_countryCode.Add("GN", "324");
225+
_countryCode.Add("GW", "624");
226+
_countryCode.Add("GY", "328");
227+
_countryCode.Add("HT", "332");
228+
_countryCode.Add("HM", "334");
229+
_countryCode.Add("VA", "336");
230+
_countryCode.Add("HN", "340");
231+
_countryCode.Add("HK", "344");
232+
_countryCode.Add("HU", "348");
233+
_countryCode.Add("IS", "352");
234+
_countryCode.Add("IN", "356");
235+
_countryCode.Add("ID", "360");
236+
_countryCode.Add("IR", "364");
237+
_countryCode.Add("IQ", "368");
238+
_countryCode.Add("IE", "372");
239+
_countryCode.Add("IM", "833");
240+
_countryCode.Add("IL", "376");
241+
_countryCode.Add("IT", "380");
242+
_countryCode.Add("JM", "388");
243+
_countryCode.Add("JP", "392");
244+
_countryCode.Add("JE", "832");
245+
_countryCode.Add("JO", "400");
246+
_countryCode.Add("KZ", "398");
247+
_countryCode.Add("KE", "404");
248+
_countryCode.Add("KI", "296");
249+
_countryCode.Add("KP", "408");
250+
_countryCode.Add("KR", "410");
251+
_countryCode.Add("KW", "414");
252+
_countryCode.Add("KG", "417");
253+
_countryCode.Add("LA", "418");
254+
_countryCode.Add("LV", "428");
255+
_countryCode.Add("LB", "422");
256+
_countryCode.Add("LS", "426");
257+
_countryCode.Add("LR", "430");
258+
_countryCode.Add("LY", "434");
259+
_countryCode.Add("LI", "438");
260+
_countryCode.Add("LT", "440");
261+
_countryCode.Add("LU", "442");
262+
_countryCode.Add("MO", "446");
263+
_countryCode.Add("MG", "450");
264+
_countryCode.Add("MW", "454");
265+
_countryCode.Add("MY", "458");
266+
_countryCode.Add("MV", "462");
267+
_countryCode.Add("ML", "466");
268+
_countryCode.Add("MT", "470");
269+
_countryCode.Add("MH", "584");
270+
_countryCode.Add("MQ", "474");
271+
_countryCode.Add("MR", "478");
272+
_countryCode.Add("MU", "480");
273+
_countryCode.Add("YT", "175");
274+
_countryCode.Add("MX", "484");
275+
_countryCode.Add("FM", "583");
276+
_countryCode.Add("MD", "498");
277+
_countryCode.Add("MC", "492");
278+
_countryCode.Add("MN", "496");
279+
_countryCode.Add("ME", "499");
280+
_countryCode.Add("MS", "500");
281+
_countryCode.Add("MA", "504");
282+
_countryCode.Add("MZ", "508");
283+
_countryCode.Add("MM", "104");
284+
_countryCode.Add("NA", "516");
285+
_countryCode.Add("NR", "520");
286+
_countryCode.Add("NP", "524");
287+
_countryCode.Add("NL", "528");
288+
_countryCode.Add("NC", "540");
289+
_countryCode.Add("NZ", "554");
290+
_countryCode.Add("NI", "558");
291+
_countryCode.Add("NE", "562");
292+
_countryCode.Add("NG", "566");
293+
_countryCode.Add("NU", "570");
294+
_countryCode.Add("NF", "574");
295+
_countryCode.Add("MP", "580");
296+
_countryCode.Add("NO", "578");
297+
_countryCode.Add("OM", "512");
298+
_countryCode.Add("PK", "586");
299+
_countryCode.Add("PW", "585");
300+
_countryCode.Add("PS", "275");
301+
_countryCode.Add("PA", "591");
302+
_countryCode.Add("PG", "598");
303+
_countryCode.Add("PY", "600");
304+
_countryCode.Add("PE", "604");
305+
_countryCode.Add("PH", "608");
306+
_countryCode.Add("PN", "612");
307+
_countryCode.Add("PL", "616");
308+
_countryCode.Add("PT", "620");
309+
_countryCode.Add("PR", "630");
310+
_countryCode.Add("QA", "634");
311+
_countryCode.Add("MK", "807");
312+
_countryCode.Add("RO", "642");
313+
_countryCode.Add("RU", "643");
314+
_countryCode.Add("RW", "646");
315+
_countryCode.Add("RE", "638");
316+
_countryCode.Add("BL", "652");
317+
_countryCode.Add("SH", "654");
318+
_countryCode.Add("KN", "659");
319+
_countryCode.Add("LC", "662");
320+
_countryCode.Add("MF", "663");
321+
_countryCode.Add("PM", "666");
322+
_countryCode.Add("VC", "670");
323+
_countryCode.Add("WS", "882");
324+
_countryCode.Add("SM", "674");
325+
_countryCode.Add("ST", "678");
326+
_countryCode.Add("SA", "682");
327+
_countryCode.Add("SN", "686");
328+
_countryCode.Add("RS", "688");
329+
_countryCode.Add("SC", "690");
330+
_countryCode.Add("SL", "694");
331+
_countryCode.Add("SG", "702");
332+
_countryCode.Add("SX", "534");
333+
_countryCode.Add("SK", "703");
334+
_countryCode.Add("SI", "705");
335+
_countryCode.Add("SB", "090");
336+
_countryCode.Add("SO", "706");
337+
_countryCode.Add("ZA", "710");
338+
_countryCode.Add("GS", "239");
339+
_countryCode.Add("SS", "728");
340+
_countryCode.Add("ES", "724");
341+
_countryCode.Add("LK", "144");
342+
_countryCode.Add("SD", "729");
343+
_countryCode.Add("SR", "740");
344+
_countryCode.Add("SJ", "744");
345+
_countryCode.Add("SE", "752");
346+
_countryCode.Add("CH", "756");
347+
_countryCode.Add("SY", "760");
348+
_countryCode.Add("TW", "158");
349+
_countryCode.Add("TJ", "762");
350+
_countryCode.Add("TZ", "834");
351+
_countryCode.Add("TH", "764");
352+
_countryCode.Add("TL", "626");
353+
_countryCode.Add("TG", "768");
354+
_countryCode.Add("TK", "772");
355+
_countryCode.Add("TO", "776");
356+
_countryCode.Add("TT", "780");
357+
_countryCode.Add("TN", "788");
358+
_countryCode.Add("TR", "792");
359+
_countryCode.Add("TM", "795");
360+
_countryCode.Add("TC", "796");
361+
_countryCode.Add("TV", "798");
362+
_countryCode.Add("UG", "800");
363+
_countryCode.Add("UA", "804");
364+
_countryCode.Add("AE", "784");
365+
_countryCode.Add("GB", "826");
366+
_countryCode.Add("UM", "581");
367+
_countryCode.Add("US", "840");
368+
_countryCode.Add("UY", "858");
369+
_countryCode.Add("UZ", "860");
370+
_countryCode.Add("VU", "548");
371+
_countryCode.Add("VE", "862");
372+
_countryCode.Add("VN", "704");
373+
_countryCode.Add("VG", "092");
374+
_countryCode.Add("VI", "850");
375+
_countryCode.Add("WF", "876");
376+
_countryCode.Add("EH", "732");
377+
_countryCode.Add("YE", "887");
378+
_countryCode.Add("ZM", "894");
379+
_countryCode.Add("ZW", "716");
380+
_countryCode.Add("AX", "248");
381+
}
382+
93383

94384
}
95385
}

DNNpackager.dnnpack

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<root>
2-
<version>1.2.0</version>
2+
<version>1.3.0</version>
33
<websitedestrelpath>/DesktopModules/NBright/OS_PayBox</websitedestrelpath>
44
<websitedestbinrelpath>/bin</websitedestbinrelpath>
55
<!-- Include only files that match the regular expression -->
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
OS_PayBox.dll : 1.3.0.0

OS_PayBox.dnn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<dotnetnuke type="Package" version="5.0">
22
<packages>
3-
<package name="OS_PayBox" type="Module" version="1.0.0">
3+
<package name="OS_PayBox" type="Module" version="1.0.3">
44
<friendlyName>OS_PayBox</friendlyName>
55
<description>OS_PayBox: Payment provider for open-Store</description>
66
<iconFile />

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.2.0.0")]
36-
[assembly: AssemblyFileVersion("1.2.0.0")]
35+
[assembly: AssemblyVersion("1.3.0.0")]
36+
[assembly: AssemblyFileVersion("1.3.0.0")]

0 commit comments

Comments
 (0)