Ticket #91: 2012_afterbuy.php

File 2012_afterbuy.php, 27.2 KB (added by Simon Heinrich, 12 years ago)

afterbuy.php (neuere Version / rewritten?)

Line 
1 <?php
2 /** ----------------------------------------------------------------------------
3 **
4 *F afterbuy.php
5 **
6 ** WEB-Shop Software http://www.webs.de
7 **
8 ** ----------------------------------------------------------------------------
9 ** based on:
10 ** (c) 2000-2001 The Exchange Project (earlier name of osCommerce)
11 ** (c) 2002-2003 osCommerce; www.oscommerce.com
12 ** (c) 2003 nextcommerce; www.nextcommerce.org
13 ** (c) 2006 XT-Commerce
14 **
15 ** Released under the GNU General Public License
16 **
17 ** @author Mathis Klooß <webs@gunah.eu>
18 ** @version $Id: afterbuy.php 1772 2010-12-30 13:29:50Z joerg $
19 ** @copyright 2010 WEB-Shop Software http://www.webs.de/
20 **
21 ** changes (xtsell.de):
22 ** 2012-07-07 changed $ShopInterface to 'api.afterbuy.de', changed $ShopInterface_path to '/afterbuy/ShopInterface.aspx'
23 ** 2012-07-08 added billing_suburb, delivery suburb to query and pass to Kstrasse2, KLstrasse2
24 ** 2012-07-08 added Kundenerkennung
25 ** 2012-07-08 added test for billing address equals delivery address and set Lieferanschrift=0 if equal
26 ** 2012-07-08 added Artikelerkennung, Bestandart, set ArtikelStammID_x to products_model
27 ** 2012-07-10 added SetPay=1 for ZahlartFID=5
28 ** 2012-07-10 added handling for ot_payment
29 ** 2012-07-10 use $error for error mail
30 ** 2012-07-11 extract AID and UID, store in orders_ident_key
31 ** 2012-07-11 added CheckVID=1
32 ** 2012-07-14 set ZahlartFID=1 for eustandardtransfer
33 ** 2012-07-15 set VMemo= and MarkierungID= for SetPay
34 **
35 ** ------------------------------------------------------------------------- */
36 class xtc_afterbuy_functions {
37 var $order_id;
38 var $PartnerID = AFTERBUY_PARTNERID;
39 var $PartnerPass = AFTERBUY_PARTNERPASS;
40 var $UserID = AFTERBUY_USERID;
41 var $order_status = AFTERBUY_ORDERSTATUS;
42 var $ShopInterface = 'api.afterbuy.de';
43 var $ShopInterface_path = '/afterbuy/ShopInterface.aspx';
44 var $user_agent = 'Mozilla/5.0 (compatible, cURL, PHP5) - Afterbuy API';
45
46 /** ---------------------------------------------------------------------------------
47 *
48 *F xtc_afterbuy_functions::xtc_afterbuy_functions
49 *
50 * @param int $order_id
51 */
52 function xtc_afterbuy_functions($order_id) {
53 require_once (DIR_FS_INC.'xtc_product_link.inc.php');
54 $this->order_id = $order_id;
55 $this->template_path_afterbuy = DIR_FS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/afterbuy';
56 $this->afterbuy_crt = $this->template_path_afterbuy . '/curl-auth.pem';
57 if(AFTERBUY_DEALERS) {
58 $this->dealers = explode("," , AFTERBUY_DEALERS);
59 }
60 if(AFTERBUY_IGNORE_GROUPE) {
61 $this->ignore = explode("," , AFTERBUY_IGNORE_GROUPE);
62 }
63 }
64
65 /** ---------------------------------------------------------------------------------
66 *
67 *F xtc_afterbuy_functions::process_order
68 *
69 */
70 function process_order() {
71 if( @!array_key_exists($_SESSION['customers_status']['customers_status_id'], $this->ignore) ) {
72 $nr = 0;
73 $anzahl = 0;
74 // get order-data
75 $o_query = xtc_db_query("SELECT customers_id,
76 billing_gender,
77 billing_company,
78 billing_firstname,
79 billing_lastname,
80 billing_street_address,
81 billing_suburb,
82 billing_postcode,
83 billing_city,
84 customers_telephone AS billing_telephone,
85 customers_email_address,
86 billing_country_iso_code_2,
87 delivery_gender,
88 delivery_company,
89 delivery_firstname,
90 delivery_lastname,
91 delivery_street_address,
92 delivery_suburb,
93 delivery_postcode,
94 delivery_city,
95 delivery_country_iso_code_2,
96 payment_method,
97 shipping_method,
98 orders_status,
99 comments
100 FROM ".TABLE_ORDERS."
101 WHERE orders_id='".$this->order_id."'
102 LIMIT 1;");
103 $oData = xtc_db_fetch_array($o_query);
104
105
106 $afterbuy = array();
107 // Start Auth
108 $afterbuy[] = "Action=new";
109 $afterbuy[] = "PartnerID=".$this->iconv($this->PartnerID);
110 $afterbuy[] = "PartnerPass=".$this->iconv($this->PartnerPass);
111 $afterbuy[] = "UserID=".$this->iconv($this->UserID);
112
113 // Kundenerkennung (0=Kbenutzername, 1=Kemail, 2=EKundenNr)
114 $afterbuy[] = "Kundenerkennung=1";
115
116 // User IDs
117 $afterbuy[] = "Kbenutzername=".$this->iconv($oData['customers_id'])."_XTC-ORDER_".$this->iconv($this->order_id);
118 $afterbuy[] = "VID=".$this->iconv($this->order_id);
119 $afterbuy[] = "CheckVID=1";
120
121 // billing Address
122 $afterbuy[] = "KVorname=".$this->iconv($oData['billing_firstname']);
123 $afterbuy[] = "KNachname=".$this->iconv($oData['billing_lastname']);
124 $afterbuy[] = "KStrasse=".$this->iconv($oData['billing_street_address']);
125 $afterbuy[] = "KStrasse2=".$this->iconv($oData['billing_suburb']);
126 $afterbuy[] = "KPLZ=".$this->iconv($oData['billing_postcode']);
127 $afterbuy[] = "KOrt=".$this->iconv($oData['billing_city']);
128 $afterbuy[] = "Kemail=".$this->iconv($oData['customers_email_address']);
129 $afterbuy[] = "KLand=".$this->iconv($oData['billing_country_iso_code_2']);
130 if($oData['billing_company']) {
131 $afterbuy[] = "KFirma=".$this->iconv($oData['billing_company']);
132 }
133 if($oData['billing_gender']) {
134 switch($oData['billing_gender']) {
135 case 'm':
136 $oData['billing_gender'] = 'Herr';
137 break;
138 default:
139 $oData['billing_gender'] = 'Frau';
140 }
141 $afterbuy[] = "Kanrede=".$this->iconv($oData['billing_gender']);
142 }
143 if($oData['billing_telephone']) {
144 $afterbuy[] = "Ktelefon=".$this->iconv($oData['billing_telephone']);
145 }
146
147 // check for billing_address equals delivery_address
148 if( ($oData['billing_company'] == $oData['delivery_company']) &&
149 ($oData['billing_firstname'] == $oData['delivery_firstname']) &&
150 ($oData['billing_lastname'] == $oData['delivery_lastname']) &&
151 ($oData['billing_street_address'] == $oData['delivery_street_address']) &&
152 ($oData['billing_suburb'] == $oData['delivery_suburb']) &&
153 ($oData['billing_postcode'] == $oData['delivery_postcode']) &&
154 ($oData['billing_city'] == $oData['delivery_city']) &&
155 ($oData['billing_country_iso_code_2'] == $oData['delivery_country_iso_code_2'])) {
156 $afterbuy[] = "Lieferanschrift=0";
157 } else {
158 $afterbuy[] = "Lieferanschrift=1";
159 // Delivery Address
160 $afterbuy[] = "KLFirma=".$this->iconv($oData['delivery_company']);
161 $afterbuy[] = "KLVorname=".$this->iconv($oData['delivery_firstname']);
162 $afterbuy[] = "KLNachname=".$this->iconv($oData['delivery_lastname']);
163 $afterbuy[] = "KLStrasse=".$this->iconv($oData['delivery_street_address']);
164 $afterbuy[] = "KLStrasse2=".$this->iconv($oData['delivery_suburb']);
165 $afterbuy[] = "KLPLZ=".$this->iconv($oData['delivery_postcode']);
166 $afterbuy[] = "KLOrt=".$this->iconv($oData['delivery_city']);
167 $afterbuy[] = "KLLand=".$this->iconv($oData['delivery_country_iso_code_2']);
168 }
169
170 // Artikelerkennung (0 = ProduktID, 1 = Artikelnummer, 2 = externe Artikelnummer, 13 = Hersteller EAN
171 $afterbuy[] = "Artikelerkennung=0";
172
173 // Bestandart (auktion/shop)
174 $afterbuy[] = "Bestandart=shop";
175
176 // products_data
177 // get products related to order
178 $p_query = xtc_db_query("SELECT products_model,
179 products_name,
180 products_id,
181 products_tax,
182 products_price,
183 products_quantity
184 FROM ".TABLE_ORDERS_PRODUCTS."
185 WHERE orders_id='".$this->order_id."'");
186 /*
187
188 */
189 $p_count = xtc_db_num_rows($p_query);
190 while ($pDATA = xtc_db_fetch_array($p_query)) {
191 $nr ++;
192 if ( empty($pDATA['products_model']) ) {
193 $pDATA['products_model'] = $pDATA['products_id'];
194 }
195 $afterbuy[] = "Artikelnr_".$nr."=".$pDATA['products_model'];
196 $afterbuy[] = "ArtikelStammID_".$nr."=".$pDATA['products_model'];
197 $afterbuy[] = "Artikelname_".$nr."=".$this->iconv( $pDATA['products_name']);
198
199 if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 &&
200 $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
201 $pDATA['products_price'] = $pDATA['products_price'] + $pDATA['products_tax'];
202 }
203 if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 &&
204 $_SESSION['customers_status']['customers_status_add_tax_ot'] == 0) {
205 $pDATA['products_tax'] = 0;
206 }
207 $price = $this->currency( $pDATA['products_price'] );
208 $tax = $this->currency( $pDATA['products_tax']);
209 $afterbuy[] = "ArtikelEPreis_".$this->iconv($nr)."=".$this->iconv($price);
210 $afterbuy[] = "ArtikelMwst_".$this->iconv($nr)."=".$this->iconv($tax);
211 $afterbuy[] = "ArtikelMenge_".$this->iconv($nr)."=".$this->iconv($pDATA['products_quantity']);
212 $url = $this->url('product_info.php',xtc_product_link($pDATA['products_id'],$pDATA['products_name']));
213 $afterbuy[] = "ArtikelLink_".$this->iconv($nr)."=".$this->iconv($url);
214
215 $a_query = xtc_db_query("SELECT products_options_values,
216 products_options
217 FROM ".TABLE_ORDERS_PRODUCTS_ATTRIBUTES."
218 WHERE orders_id='".$this->order_id."'
219 AND orders_products_id='".$pDATA['orders_products_id']."'");
220 $options = array();
221 while ($aDATA = xtc_db_fetch_array($a_query)) {
222 $options[] = $aDATA['products_options'].":".$aDATA['products_options_values'];
223 }
224 if ($options) {
225 $options = implode('|',$options);
226 $afterbuy[] = "Attribute_".$this->iconv($nr)."=".$this->iconv($options);
227 }
228 }
229
230 $order_total_query = xtc_db_query("SELECT
231 class,
232 value,
233 sort_order
234 FROM ".TABLE_ORDERS_TOTAL."
235 WHERE orders_id='".$this->order_id."'
236 ORDER BY sort_order ASC");
237
238 while ($order_total_values = xtc_db_fetch_array($order_total_query)) {
239
240 $order_total[] = array ('CLASS' => $order_total_values['class'], 'VALUE' => $order_total_values['value']);
241 // shippingcosts
242 if ($order_total_values['class'] == 'ot_shipping') {
243 $vK = $this->currency( $order_total_values['value'] );
244 $afterbuy[] = "Versandkosten=".$this->iconv($vK);
245 }
246 // nachnamegebuer
247 if ($order_total_values['class'] == 'ot_cod_fee') {
248 $cod_fee = $this->currency( $order_total_values['value']);
249 $afterbuy[] = "Zahlartenaufschlag=".$this->iconv($cod_fee);
250 }
251 // payment fee
252 if ($order_total_values['class'] == 'ot_payment') {
253 $pay_fee = $this->currency( $order_total_values['value']);
254 $afterbuy[] = "Zahlartenaufschlag=".$this->iconv($pay_fee);
255 }
256 // rabatt
257 if ($order_total_values['class'] == 'ot_discount') {
258 $nr ++;
259 $p_count ++;
260 $afterbuy[] = "Artikelnr_".$this->iconv($nr)."=99999998";
261 $afterbuy[] = "Artikelname_".$this->iconv($nr)."=Rabatt";
262 $discount = $this->currency( $order_total_values['value'] );
263 $afterbuy[] = "ArtikelEPreis_".$this->iconv($nr)."=".$this->iconv($discount);
264 $afterbuy[] = "ArtikelMwst_".$this->iconv($nr)."=".$this->iconv($tax);
265 $afterbuy[] = "ArtikelMenge_".$this->iconv($nr)."=1";
266 }
267 // Gutschein
268 if ($order_total_values['class'] == 'ot_gv') {
269 $nr ++;
270 $afterbuy[] = "Artikelnr_".$this->iconv($nr)."=99999997";
271 $afterbuy[] = "Artikelname_".$this->iconv($nr)."=Gutschein";
272 $gv = $this->currency( ($order_total_values['value'] * (-1)));
273 $afterbuy[] = "ArtikelEPreis_".$this->iconv($nr)."=".$this->iconv($gv);
274 $afterbuy[] = "ArtikelMwst_".$this->iconv($nr)."=0";
275 $afterbuy[] = "ArtikelMenge_".$this->iconv($nr)."=1";
276 $p_count ++;
277 }
278 if ($order_total_values['class'] == 'ot_coupon') {
279 $nr ++;
280 $afterbuy[] = "Artikelnr_".$this->iconv($nr)."=99999996";
281 $afterbuy[] = "Artikelname_".$this->iconv($nr)."=Kupon";
282 $coupon = $this->currency( ($order_total_values['value'] * (-1)));
283 $afterbuy[] = "ArtikelEPreis_".$this->iconv($nr)."=".$this->iconv($coupon);
284 $afterbuy[] = "ArtikelMwst_".$this->iconv($nr)."=0";
285 $afterbuy[] = "ArtikelMenge_".$this->iconv($nr)."=1";
286 $p_count ++;
287 }
288 }
289
290 $afterbuy[] = "PosAnz=".$this->iconv($p_count);
291
292 if($oData['comments']) {
293 $afterbuy[] = "kommentar=".$this->iconv($oData['comments']);
294 }
295 $s_method = explode( '(' , $oData['shipping_method'] );
296 $s_method['0'] = trim($s_method['0']);
297 $afterbuy[] = "Versandart=".$this->iconv($s_method['0']);
298 $afterbuy[] = "Zahlart=".$this->iconv( $this->payment($oData['payment_method']) );
299 $ZFID = $this->iconv( $this->payment_FID($oData['payment_method']) );
300 $afterbuy[] = "ZFunktionsID=".$ZFID;
301 if($ZFID == 5) {
302 $afterbuy[] = "SetPay=1";
303 $afterbuy[] = "VMemo=".$this->iconv("ACHTUNG: Vorgang wurde als bezahlt übergeben. Überprüfung erforderlich!");
304 $afterbuy[] = "MarkierungID=324";
305 }
306
307 //banktransfer data
308 if ($oData['payment_method']=='banktransfer') {
309 $b_query = xtc_db_query("SELECT banktransfer_bankname,
310 banktransfer_blz,
311 banktransfer_number,
312 banktransfer_owner
313 FROM ".TABLE_BANKTRANSFER."
314 WHERE orders_id='".$this->order_id."'
315 LIMIT 1;");
316 if (xtc_db_numrows($b_query)) {
317 $b_data = xtc_db_fetch_array($b_query);
318 $afterbuy[] = "Bankname=".$this->iconv($b_data['banktransfer_bankname']);
319 $afterbuy[] = "BLZ=".$this->iconv($b_data['banktransfer_blz']);
320 $afterbuy[] = "Kontonummer=".$this->iconv($b_data['banktransfer_number']);
321 $afterbuy[] = "Kontoinhaber=".$this->iconv($b_data['banktransfer_owner']);
322 }
323 }
324 $afterbuy[] = $this->extra();
325 $afterbuy[] = "NoVersandCalc=1";
326 if(isset($this->dealers) && !empty($this->dealers) &&
327 @array_key_exists($_SESSION['customers_status']['customers_status_id'], $this->dealers) ) {
328 $afterbuy[] = 'Haendler=1';
329 }
330
331 if($xml = $this->submit($afterbuy)) {
332 $result = simplexml_load_string ( $xml );
333
334 if ($result->success == '1') {
335 $cdr = $result->data->KundenNr;
336 //build string of AID/UID/KundenNr
337 $AB = $result->data->AID . $result->data->UID . $cdr;
338 xtc_db_query("UPDATE ".TABLE_ORDERS." SET afterbuy_success='1',afterbuy_id='".$cdr."',orders_ident_key='".$AB."' WHERE orders_id='".$this->order_id."'");
339
340 //set new order status
341 if ($this->order_status != '') {
342 xtc_db_query("UPDATE ".TABLE_ORDERS." SET orders_status='".$this->order_status."' WHERE orders_id='".$this->order_id."'");
343 }
344
345 } else {
346 $error = array();
347 foreach($result->errorlist->error as $row) {
348 $error[] = $row;
349 }
350 // mail to shopowner
351 $mail_content_html = 'Fehler bei Uebertragung der Bestellung: '.$this->order_id."<br />\r\n".'Folgende Fehlermeldung wurde vom afterbuy.de zurueckgegeben:'."<br />\r\n"."<br />\r\n".implode("<br />\r\n",$error);
352 $mail_content_txt = 'Fehler bei Uebertragung der Bestellung: '.$this->order_id."\r\n".'Folgende Fehlermeldung wurde vom afterbuy.de zurueckgegeben:'."\r\n\r\n".implode("\r\n",$error);
353
354 xtc_php_mail(EMAIL_BILLING_ADDRESS,STORE_NAME.'-Afterbuy',EMAIL_BILLING_ADDRESS, STORE_NAME,'',EMAIL_BILLING_ADDRESS, STORE_NAME,'','', "Afterbuy-Error", $mail_content_html,$mail_content_txt);
355
356 }
357 }
358 }
359 }
360
361 /** ---------------------------------------------------------------------------------
362 *
363 *F xtc_afterbuy_functions::order_send
364 *
365 * @return boolean
366 */
367 function order_send() {
368
369 $check_query = xtc_db_query("SELECT afterbuy_success FROM ".TABLE_ORDERS." WHERE orders_id='".$this->order_id."' LIMIT 1;");
370 $data = xtc_db_fetch_array($check_query);
371
372 if ($data['afterbuy_success'] == 1) {
373 return false;
374 }
375 return true;
376
377 }
378
379 /** ---------------------------------------------------------------------------------
380 *
381 *PF xtc_afterbuy_functions::iconv
382 *
383 * convert strings to iso-8859-1 for afterbuy and urlencoded
384 *
385 * @param string $str
386 * @return string
387 */
388 private function iconv( $str ) {
389 if(defined('DB_SERVER_CHARSET')) {
390 if(function_exists('iconv')) {
391 return urlencode( iconv( charset_mapper(DB_SERVER_CHARSET) , 'ISO-8859-1' , $str ) );
392 } elseif( DB_SERVER_CHARSET == 'utf8' ) {
393 return urlencode( utf8_decode( $str ) );
394 } else {
395 return urlencode( $str );
396 }
397 } else {
398 return urlencode( $str );
399 }
400 }
401
402 /** ---------------------------------------------------------------------------------
403 *
404 *PF xtc_afterbuy_functions::submit
405 *
406 * connector to Afterbuy API
407 *
408 * @param string $str
409 * @return string
410 */
411 private function submit( $POST_ARRAY ) {
412 $POST_ARRAY = implode('&',$POST_ARRAY);
413 if(function_exists('curl_init')) {
414 $ch = curl_init();
415 @curl_setopt($ch, CURLOPT_URL, 'https://'.$this->ShopInterface.$this->ShopInterface_path);
416 if(file_exists($this->afterbuy_crt) && is_readable($this->afterbuy_crt)) {
417 @curl_setopt($ch, CURLOPT_CAFILE, $this->afterbuy_crt);
418 @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
419 }
420 @curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent);
421 @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
422 @curl_setopt($ch, CURLOPT_POST, 1);
423 @curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
424 @curl_setopt($ch, CURLOPT_POSTFIELDS, $POST_ARRAY);
425 $return = @curl_exec($ch);
426 if(curl_errno($ch)) {
427 $error = @curl_error($ch);
428 $error = strip_tags($error);
429 $s = array("\r","\n","\t");
430 $r = array(""," "," ");
431 $error = str_replace($s,$r,$error);
432 $return = '<?xml version="1.0" encoding="UTF-8" ?>'."\n<result>\n<success>0</success>\n<errorlist>\n<error>" . $error . "</error>\n</errorlist>\n</result>";
433 }
434 @curl_close($ch);
435 } else {
436 $return = '<?xml version="1.0" encoding="UTF-8" ?>'."\n<result>\n<success>0</success>\n<errorlist>\n<error>Die Funktionen von cURL konnten nicht gefunden werden.</error>\n<error>Um diesen API zu nutzen, wird PHP cURL benoetigt: http://www.php.net/curl</error>\n</errorlist>\n</result>";
437 }
438 return $return;
439 }
440
441 /** ---------------------------------------------------------------------------------
442 *
443 *PF xtc_afterbuy_functions::url
444 *
445 * create URLs like xtc_href_link
446 *
447 * @param string $page
448 * @param string $params (optional)
449 * @param string $connect (optioal [only NONSSL or SSL])
450 * @return url address
451 */
452 private function url($page='index.php' , $params='' , $connect='NONSSL') {
453 switch($connect) {
454 case 'NONSSL':
455 $connect = 'NONSSL';
456 break;
457 default:
458 $connect = 'SSL';
459 }
460 if(!function_exists('xtc_catalog_href_link')) {
461 return xtc_href_link($page , $params , $connect);
462 } else {
463 return xtc_catalog_href_link($page , $params , $connect);
464 }
465 }
466
467 /** ---------------------------------------------------------------------------------
468 *
469 *PF xtc_afterbuy_functions::payment
470 *
471 * english to german
472 *
473 * @param string $payment
474 * @return string
475 */
476 private function payment($payment) {
477 switch($payment) {
478 case 'banktransfer':
479 $payment = 'Lastschrift';
480 break;
481 case 'cash':
482 $payment = 'Barzahlung';
483 break;
484 case 'cc':
485 $payment = 'Kreditkarte';
486 break;
487 case 'cod':
488 $payment = 'Nachnahme';
489 break;
490 case 'eustandardtransfer':
491 $payment = 'Überweisung/Vorkasse';
492 break;
493 case 'iclear':
494 $payment = 'iClear Payment System';
495 break;
496 case 'invoice':
497 $payment = 'Rechnung';
498 break;
499 case 'ipayment':
500 $payment = 'iPayment';
501 break;
502 case 'ipaymentelv':
503 $payment = 'iPayment Lastschriftverfahren';
504 break;
505 case 'ogone':
506 $payment = 'Ogone - Payment Service Provider';
507 break;
508 case 'moneyorder':
509 $payment = 'Überweisung/Vorkasse';
510 break;
511 case 'paypal':
512 $payment = 'PayPal';
513 break;
514 case 'paypalexpress':
515 $payment = 'PayPal Express';
516 break;
517 case 'sofortueberweisung':
518 case 'sofortueberweisung_direct':
519 case 'sofortueberweisungredirect':
520 case 'sofortueberweisungvorkasse':
521 $payment = 'Sofortüberweisung';
522 break;
523 case 'worldpay':
524 $payment = 'Secure Credit Card Payment';
525 break;
526 }
527 return $payment;
528 }
529
530 /** ---------------------------------------------------------------------------------
531 *
532 *PF xtc_afterbuy_functions::payment_FID
533 *
534 * payment names to intengers by afterbuy
535 *
536 * @param string $payment
537 * @return int
538 */
539 private function payment_FID($payment) {
540 switch($payment) {
541 case 'banktransfer':
542 $payment = '7';
543 break;
544 case 'cash':
545 $payment = '2';
546 break;
547 case 'cod':
548 $payment = '4';
549 break;
550 case 'invoice':
551 $payment = '6';
552 break;
553 case 'eustandardtransfer':
554 case 'moneyorder':
555 $payment = '1';
556 break;
557 case 'paypal':
558 $payment = '5';
559 break;
560 case 'paypalexpress':
561 $payment = '5';
562 break;
563 case 'sofortueberweisung':
564 $payment = '12';
565 break;
566 case 'sofortueberweisungredirect':
567 $payment = '12';
568 break;
569 case 'sofortueberweisungvorkasse':
570 $payment = '12';
571 break;
572 default:
573 $payment = '99';
574 }
575 return $payment;
576 }
577
578 /** ---------------------------------------------------------------------------------
579 *
580 *PF xtc_afterbuy_functions::currency
581 *
582 * US dez. numbers to DE dez. numbers
583 *
584 * @param flood $flood
585 * @return flood
586 */
587 private function currency( $flood ) {
588 return str_replace('.', ',', $flood );
589 }
590
591 function extra() {
592
593 }
594
595 }
596 ?>