public void Get_basic_of_a_SearchRow() { var searchRow = new TransactionSearchRow(); var basic = searchRow.GetBasic(); basic.Should().BeNull(); var createdBasic = searchRow.CreateBasic(); basic = searchRow.GetBasic(); basic.Should().NotBeNull(); basic.Should().Be(createdBasic); }
public async Task Applies_search_pereferences_to_Search_requests() { const int pageSize = 10; var searchColumns = new TransactionSearchRow(); searchColumns.CreateBasic(b => { b.SetColumns(new[] { nameof(b.tranId), nameof(b.amount), nameof(b.entity) }); }); var searchResult = await client.searchAsync( new TransactionSearchAdvanced { columns = searchColumns, criteria = new TransactionSearch { basic = new TransactionSearchBasic { dateCreated = new SearchDateField { @operator = SearchDateFieldOperator.after, operatorSpecified = true, searchValue = new DateTime(2018, 01, 01), searchValueSpecified = true } } } }, new SearchPreferences { pageSize = pageSize, pageSizeSpecified = true } ); searchResult.status.isSuccess.Should().BeTrue(); searchResult.pageSize.Should().Be(pageSize); searchResult.searchRowList.Length.Should().BeGreaterThan(0); }
// Creation per record function from searchrow supplied and Align MaxCredible spec. HTTP_POST createHTTP_POST(TransactionSearchRow theTSRRow) { HTTP_POST theHTTP_POST = new HTTP_POST(); // Empty by default (not used) values as defined by Align BV theHTTP_POST.DEBITEURVOORLETTERS = ""; theHTTP_POST.DEBITEURGEBOORTEDATUM = ""; theHTTP_POST.DEBITEURHUISNUMMER = ""; /* Mandatory fields according to MaxCredible DEBITEURNUMMER Customer number String, 50 char DEBITEURNAAM Customer name String, 50 char DEBITEURADRES Customer address String, 50 char DEBITEURHUISNUMMER Customer housenumber String, 50 char DEBITEURPOSTCODE Customer postalcode 4 digits and 2 alpha numerics when country is ‘Nederland’ DEBITEURSTAD Customer city String, 50 char FACTUURNUMMER Invoice number Unique, not allowed to change. String, 50 char FACTUURBEDRAG Invoice amount Numeric FACTUURDATUM Invoice date Date. (dd-mm-yyyy) PROFILEID Profile Numeric. Must be a valid profileid VALUTA Currency String. Must be a valid currency (e.g. EUR) CLASSIFYID Classify Numeric. Value 1, unless agreed otherwise. FACTUURVERVALDATUM Due date of the invoice Data. (dd-mm-yyyy) Customer DEBIT... fields <DEBITEURNUMMER>111598</DEBITEURNUMMER> <!-- client number --> <DEBITEURNAAM>Studio Dentistico Dr. Antonino</DEBITEURNAAM> <!-- Client name --> <DEBITEURADRES>Via Barbaro 14 </DEBITEURADRES> <!-- Client address --> <DEBITEURPOSTCODE>37139</DEBITEURPOSTCODE> <!-- Client postal code --> <DEBITEURSTAD>Verona</DEBITEURSTAD> <!-- Client city --> <DEBITEURLAND>IT</DEBITEURLAND> <!-- Client country --> <DEBITEURTELEFOON>(+39)045 97 22 79</DEBITEURTELEFOON> <!-- Client phone number --> <DEBITEURFAX>(+39)045 89 58 71 4</DEBITEURFAX> <!-- Client fax number --> <DEBITEURCONTACTPERSOON>Antonino, Vittorio</DEBITEURCONTACTPERSOON> <!-- Contact person name --> */ string sEntityId = ""; if (theTSRRow.customerJoin.entityId != null) { sEntityId = theTSRRow.customerJoin.entityId[0].searchValue.ToString(); } theHTTP_POST.DEBITEURNUMMER = sEntityId; string sCustName = ""; if (theTSRRow.customerJoin.companyName != null) { sCustName = defaultMaxStringLength(theTSRRow.customerJoin.companyName[0].searchValue.ToString()); } theHTTP_POST.DEBITEURNAAM = sCustName; string sCustAddr = ""; string sCustState = ""; string sCustCountry = ""; string sCustPostCode = ""; if (theTSRRow.customerJoin.billAddress1 != null) // Use Customer Join / Lookup billing details { sCustAddr = defaultMaxStringLength(theTSRRow.customerJoin.billAddress1[0].searchValue.ToString()); if (theTSRRow.customerJoin.billCity != null) sCustState = defaultMaxStringLength(theTSRRow.customerJoin.billCity[0].searchValue.ToString()); if (theTSRRow.customerJoin.billCountryCode != null) sCustCountry = defaultMaxStringLength(theTSRRow.customerJoin.billCountryCode[0].searchValue.ToString()); if (theTSRRow.customerJoin.billZipCode != null) sCustPostCode = theTSRRow.customerJoin.billZipCode[0].searchValue.ToString(); } else // Use Invoice billing details { if (theTSRRow.basic.billAddress1 != null) sCustAddr = defaultMaxStringLength(theTSRRow.basic.billAddress1[0].searchValue.ToString()); if (theTSRRow.basic.billCity != null) sCustState = defaultMaxStringLength(theTSRRow.basic.billCity[0].searchValue.ToString()); if (theTSRRow.basic.billCountryCode != null) sCustCountry = defaultMaxStringLength(theTSRRow.basic.billCountryCode[0].searchValue.ToString()); if (theTSRRow.basic.billZip != null) sCustPostCode = theTSRRow.basic.billZip[0].searchValue.ToString(); } theHTTP_POST.DEBITEURSTAD = sCustState; theHTTP_POST.DEBITEURADRES = sCustAddr; theHTTP_POST.DEBITEURLAND = sCustCountry; theHTTP_POST.DEBITEURPOSTCODE = sCustPostCode; string sCustTel = ""; if (theTSRRow.customerJoin.phone != null) { sCustTel = theTSRRow.customerJoin.phone[0].searchValue.ToString(); } theHTTP_POST.DEBITEURTELEFOON = sCustTel; string sCustFax = ""; if (theTSRRow.customerJoin.fax != null) { sCustFax = theTSRRow.customerJoin.fax[0].searchValue.ToString(); } theHTTP_POST.DEBITEURFAX = sCustFax; string sCustEmail = ""; if (theTSRRow.customerJoin.email != null) { sCustEmail = theTSRRow.customerJoin.email[0].searchValue.ToString(); } theHTTP_POST.DEBITEUREMAIL = sCustEmail; string sCustContact = ""; if (theTSRRow.customerJoin.contact != null) { sCustContact = theTSRRow.customerJoin.contact[0].searchValue.ToString(); } theHTTP_POST.DEBITEURCONTACTPERSOON = sCustContact; /* Invoice fields <FACTUURNUMMER>1458760</FACTUURNUMMER> <!-- invoice number --> <FACTUURBEDRAG> 250.00</FACTUURBEDRAG> <!-- invoice amount --> <FACTUURDATUM>2011-12-28</FACTUURDATUM> <!-- invoice date --> <FACTUURVERVALDATUM>2012-01-27</FACTUURVERVALDATUM> <!-- invoice due date --> */ string sInvNum = ""; if (theTSRRow.basic.tranId != null) { sInvNum = theTSRRow.basic.tranId[0].searchValue.ToString(); } theHTTP_POST.FACTUURNUMMER = sInvNum; double sInvAmount = 0.00; if (theTSRRow.basic.fxAmount != null) { sInvAmount = theTSRRow.basic.fxAmount[0].searchValue; } theHTTP_POST.FACTUURBEDRAG = sInvAmount.ToString("0.00"); double sInvBaseAmount = 0.00; if (theTSRRow.basic.amount != null) { sInvBaseAmount = theTSRRow.basic.amount[0].searchValue; } theHTTP_POST.FACTUURBEDRAG_BASIS = sInvBaseAmount.ToString("0.00"); string sInvDate = ""; if (theTSRRow.basic.tranDate != null) { sInvDate = theTSRRow.basic.tranDate[0].searchValue.ToString("yyyy-MM-dd"); } theHTTP_POST.FACTUURDATUM = sInvDate; string sInvDueDate = ""; if (theTSRRow.basic.dueDate != null) { sInvDueDate = theTSRRow.basic.dueDate[0].searchValue.ToString("yyyy-MM-dd"); } theHTTP_POST.FACTUURVERVALDATUM = sInvDueDate; /* Misc. fields <KENMERK>ISABELLA V, V (2183537)</KENMERK> <!-- kenmerk/additional info --> <PROFILEID>87</PROFILEID> <!-- profile ID --> <VALUTA>EUR</VALUTA> <!-- currency --> <CLASSIFYID>1</CLASSIFYID> <!—Classification --> <STARTDATUM>2012-01-27</STARTDATUM> <!-- ??? --> <CUSTOMER_OPTION1> 250.00</CUSTOMER_OPTION1> <!-- ? looks like amount again --> <VALUTA_BASIS>EUR</VALUTA_BASIS> <!-- base currency --> <OPENSTAANDBEDRAG_BASIS> 250.00</OPENSTAANDBEDRAG_BASIS> <!-- Open invoice amount --> <FACTUURBEDRAG_BASIS> 250.00</FACTUURBEDRAG_BASIS> <!-- Invoice amount base --> */ string sComments = ""; if (theTSRRow.basic.memo != null) { sComments = defaultMaxStringLength(theTSRRow.basic.memo[0].searchValue.ToString()); } theHTTP_POST.KENMERK = sComments; string sCurrency = ""; if (theTSRRow.basic.currency != null) { sCurrency = getCurrencySymbol(theTSRRow.basic.currency[0].searchValue.internalId.ToString()); } theHTTP_POST.VALUTA = sCurrency; // To be confirmed what StartDate actually means and is used for ... theHTTP_POST.STARTDATUM = System.DateTime.Now.Date.ToString("yyyy-MM-dd"); if (sInvDueDate != "") theHTTP_POST.STARTDATUM = sInvDueDate; theHTTP_POST.PROFILEID = Settings.Default.MC_DefaultProfileID; theHTTP_POST.CLASSIFYID = Settings.Default.MC_DefaultClassifyID; theHTTP_POST.CUSTOMER_OPTION1 = sInvAmount.ToString("0.00"); theHTTP_POST.VALUTA_BASIS = Settings.Default.MC_BaseCurrency; return theHTTP_POST; }