|
Removes one item from the beginning of a string of values that have been separated with specified character. NOTE: array values should not be passed to this function as they will not get updated correctly (meaning that nothing gets removed from the lis |
|
Chunks |
A string that is filled with character (eg. comma) separated values |
Separator |
A character that will be considered as the separator between the values |
|
external inner function string 255 RemoveNextListItem(var string,string);
global
updating procedure ShopHandleCreditCardPayment(string paysessionid)
begin
record WebNGPaySessionVc WPSr;
record WebNGPaySessionVc oldWPSr;
record CredCardTypeVc CCTr;
record IVVc oldIVr,IVr;
boolean ivokf;
string 255 paydeal,ccnumber,cctype,authcode;
string 255 tstr,tstr2,margs;
record CUVc CUr;
string 255 activcode;
record WebNGShopCompBlock WSCb;
if (GetPaySession(paysessionid,WPSr)) begin
if (WPSr.Completed==0) then begin
ivokf = false;
BlockLoad(WSCb);
PayMethodSupported("creditcard",paydeal,tstr);
margs = WPSr.CustomField1;
while (nonblank(margs)) begin
tstr = removenextlistitem(margs,",");
tstr2 = removenextlistitem(tstr,"=");
switch (tstr2) begin
case "ccnumber": ccnumber = tstr;
case "cctype": cctype = tstr;
case "authcode": authcode = tstr;
end;
end;
if (nonblank(cctype)) then begin
CCTr.Code = cctype;
if (ReadFirstMain(CCTr,1,true)) then begin
if (nonblank(CCTr.PayTerm)) then begin
paydeal = CCTr.PayTerm;
end;
end;
end;
if (BuildWebNGInvoice(IVr,0,paydeal,true,"")) then begin
if (blank(IVr.SerNr)) then begin
IVr.SerNr = NextSerNr("IVVc",IVr.TransDate,-1,false,"");
end;
IVr.CreditCard = ccnumber;
IVr.AuthorizationCode = authcode;
if (RecordStore(IVr,true)) then begin
CUr.Code = IVr.CustCode;
if (ReadFirstMain(CUr,1,true)) then begin end;
ivokf = true;
if (WSCb.DontOKInvoices==0) then begin
RecordCopy(oldIVr,IVr);
IVr.OKFlag = 1;
if (RecordUpdate(oldIVr,IVr,true)) then begin end;
if (CreateHWContractFromInvoice(IVr.SerNr,"")) then begin end;
end;
end;
end;
if (ivokf) then begin
ClearShopBasket(0);
RecordCopy(oldWPSr,WPSr);
WPSr.Completed = 1;
WPSr.CompletedDate = CurrentDate;
WPSr.RecordNr = IVr.SerNr;
if (RecordUpdate(oldWPSr,WPSr,false)) then begin end;
end;
end;
end;
return;
end;
|
««