|
Converts value in one currency to other currency using the exchange rate on specified date. |
|
CurncyFrom |
The currency mark of the value that we are going to convert. |
CurncyTo |
The currency mark into what we are converting to. |
CurncyDate |
The date of the exchange rate. |
Amount |
The value that will be converted. |
|
external function val Cur2Cur(string,string,date,val);
global updating procedure SetupPayServerTransaction(string paysessionid)
begin
record WebNGPaySessionVc oldWPSr,WPSr;
record CUVc CUr;
string 255 ovrcurrency;
string 255 partner,merchantid,merchantcode,merchantaccref,merchantkey,merchantrefundpw,merchantserialnr;
integer merchanttestaddr,merchantlivef;
string 255 cardfirstname,cardlastname,addr1,addr2,addr3,postcode,country;
longint err;
string 255 errmsg;
string 255 txnumber;
transaction string 255 frompayurl;
val fr,to1,to2,br1,br2;
if (GetPaySession(paysessionid,WPSr)) then begin
RecordCopy(oldWPSr,WPSr);
txnumber = -1;
if (WebSecureMode) then begin
frompayurl = "https://";
end else begin
frompayurl = "http://";
end;
frompayurl = frompayurl & WebHost;
ovrcurrency = FindBestCreditCardCurrency(WPSr.Currency);
if (ovrcurrency!=WPSr.Currency) then begin
WPSr.DisplayCurrency = WPSr.Currency;
WPSr.DisplayAmount = WPSr.InclAmount;
WPSr.DisplayVAT = WPSr.VAT;
WPSr.Currency = ovrcurrency;
WPSr.InclAmount = cur2cur(WPSr.DisplayCurrency,WPSr.Currency,CurrentDate,WPSr.DisplayAmount);
WPSr.VAT = cur2cur(WPSr.DisplayCurrency,WPSr.Currency,CurrentDate,WPSr.DisplayVAT);
GetFullCurncyRate(WPSr.Currency,CurrentDate,fr,to1,to2,br1,br2);
WPSr.FrRate = fr;
WPSr.ToRateB1 = to1;
WPSr.ToRateB2 = to2;
WPSr.BaseRate1 = br1;
WPSr.BaseRate2 = br2;
end;
if (GetCCPurchaseParameters(WPSr.Currency,"",1,
partner,merchantid,merchantcode,merchantaccref,merchantkey,merchantrefundpw,
merchanttestaddr,merchantserialnr,merchantlivef)==0) then begin
GetCUPersonFirstLastName(WPSr.CustCode,cardfirstname,cardlastname);
if (nonblank(cardfirstname)) then begin
if (nonblank(cardlastname)) then begin
cardfirstname = cardfirstname & " " & cardlastname;
end;
end else begin
cardfirstname = cardlastname;
end;
CUr.Code = WPSr.CustCode;
if (ReadFirstMain(CUr,1,true)) then begin
addr1 = CUr.InvAddr0;
addr2 = CUr.InvAddr1;
addr3 = CUr.InvAddr2;
postcode = CUr.InvAddr4;
country = CUr.CountryCode;
end;
if (OpenCCPurchaseTransaction(WPSr.InclAmount,WPSr.Currency,frompayurl,WPSr.UUID,txnumber,
partner,merchantid,merchantcode,merchantaccref,merchantkey,merchantrefundpw,
merchanttestaddr,merchantserialnr,merchantlivef,
cardfirstname,cardlastname,addr1,addr2,addr3,postcode,country,
err,errmsg)) then begin
WPSr.Status = 10+kCCStatusProcessing;
WPSr.ExternalSession = txnumber;
if (RecordUpdate(oldWPSr,WPSr,false)) then begin end;
end;
end;
end;
return;
end;
|
««