

function IPAYMENTCC_doPay(oPayForm, bShowWaitForPay){
	bShowWaitForPay=false;
	oPayForm.action = 'https://ipayment.de/merchant/54168156/processor.php';
	oPayForm.submit();
	return(bShowWaitForPay);
};

function IPAYMENTCC_beforeSendOrder(params, cancel){
	if (params['ret_errorcode']!= "0") {
		cancel = true;
		location.replace(SM_PAGEURL_DATA_ENTRY_PAYMENT + '?errdesc=' + params['ret_errormsg'].toString().replace(/\+/g," "));
	};
	return(cancel);
};

function IPAYMENTCC_setFieldValue(fieldName, fieldValue){
	switch(fieldName){
		case 'trxuser_id':
			fieldValue = '10033'; break;
		case 'trx_typ':
			fieldValue = 'auth'; break;
		case 'trxpassword':
			fieldValue = '57956713'; break;
		case 'trx_amount':
			var oAmount = new cSMPrice();
			oAmount.decode(SMShop.basket.getAttribute(_SMAFinalSum));
			fieldValue = cprimary.format(oAmount.gross, SM_CNOFORMAT);
			fieldValue = fieldValue.toFixed(2);
			fieldValue = fieldValue.toString().replace(".","");
			break;
		case 'trx_currency':
			fieldValue = 'eur'; break;
		case 'addr_name':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_FIRSTNAME") + " " + SMShop.getFormValue("BILLTO", "BILLTO_LASTNAME");
			break;
		case 'addr_street':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_STREET_1");
			break;
		case 'addr_street2':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_STREET_2");
			break;
		case 'addr_city':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_CITY");
			break;
		case 'addr_zip':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_POSTCODE");
			break;
		case 'addr_country':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_COUNTRY", true).substring(0, 2);
			break;
		case 'addr_telefon':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_PHONE_NUMBER");
			break;
		case 'addr_telefax':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_FAX_NUMBER");
			break;
		case 'addr_email':
			fieldValue = SMShop.getFormValue("BILLTO", "BILLTO_EMAIL");
			break;
		case 'error_lang':
			fieldValue = sErrLang;	break;
		case 'check_fraudattack':
			break;
		case 'client_name':
			fieldValue = "SmartStore.biz 5";
			break;
		case 'client_version':
			fieldValue = toStr(Parameters("app-version"));
			break;
		case 'redirect_url':
		case 'silent_error_url':
			fieldValue = SM_PAGEURL_SEND_ORDER_INFO;
			break;
		case 'addr_check_address':
			fieldValue = "0";
			break;
	};
	return(fieldValue);
};

function IPAYMENTCC_removePayFormFields(){
	return(true);
};

function IPAYMENTCC_setForwardPayformFieldNames(){
	var sFields = 'transid;ret_authcode;ret_booknr'; // semicolon separated string with paymethods formfields to show in ordermail
	return(sFields);
};

function IPAYMENTCC_setResponseQueryCaptions(param){
	var sCaption = '';
	switch(param.toLowerCase()){
		case 'transid': sCaption = 'Transaktionsnr.'; break;
		case 'ret_authcode': sCaption = 'Autorisierungsnummer'; break;
		case 'ret_booknr': sCaption = 'Buchungsnummer'; break;
		default: sCaption = param;
	};
	return(sCaption);
};
