Author: lektran
Date: Tue Jul 21 06:12:20 2009 New Revision: 796153 URL: http://svn.apache.org/viewvc?rev=796153&view=rev Log: Add payPal support to checkAuthValidity (PayPal auths are only good for 3 days) Modified: ofbiz/trunk/applications/accounting/config/payment.properties ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Modified: ofbiz/trunk/applications/accounting/config/payment.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/payment.properties?rev=796153&r1=796152&r2=796153&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/payment.properties (original) +++ ofbiz/trunk/applications/accounting/config/payment.properties Tue Jul 21 06:12:20 2009 @@ -33,9 +33,11 @@ payment.general.reauth.mc.days=30 payment.general.reauth.visa.days=7 payment.general.reauth.other.days=7 +payment.general.reauth.paypal.days=3 payment.general.cc_create.auth=0 payment.general.cc_update.auth=0 + ############################################ # General Gift Certificate Configuration ############################################ Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=796153&r1=796152&r2=796153&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Tue Jul 21 06:12:20 2009 @@ -2732,6 +2732,8 @@ if (authTime == null) { return false; } + + String reauthDays = null; GenericValue paymentMethod = null; try { @@ -2749,7 +2751,6 @@ } if (creditCard != null) { String cardType = creditCard.getString("cardType"); - String reauthDays = null; // add more types as necessary -- maybe we should create seed data for credit card types?? if ("Discover".equals(cardType)) { reauthDays = UtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.disc.days", "90"); @@ -2763,22 +2764,27 @@ reauthDays = UtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.other.days", "7"); } - int days = 0; - try { - days = Integer.parseInt(reauthDays); - } catch (Exception e) { - Debug.logError(e, module); - } + } + } else if (paymentMethod != null && "EXT_PAYPAL".equals(paymentMethod.get("paymentMethodTypeId"))) { + reauthDays = UtilProperties.getPropertyValue(paymentConfig, "payment.general.reauth.paypal.days", "3"); + } + + if (reauthDays != null) { + int days = 0; + try { + days = Integer.parseInt(reauthDays); + } catch (Exception e) { + Debug.logError(e, module); + } - if (days > 0) { - Calendar cal = Calendar.getInstance(); - cal.setTimeInMillis(authTime.getTime()); - cal.add(Calendar.DAY_OF_YEAR, days); - Timestamp validTime = new Timestamp(cal.getTimeInMillis()); - Timestamp nowTime = UtilDateTime.nowTimestamp(); - if (nowTime.after(validTime)) { - return false; - } + if (days > 0) { + Calendar cal = Calendar.getInstance(); + cal.setTimeInMillis(authTime.getTime()); + cal.add(Calendar.DAY_OF_YEAR, days); + Timestamp validTime = new Timestamp(cal.getTimeInMillis()); + Timestamp nowTime = UtilDateTime.nowTimestamp(); + if (nowTime.after(validTime)) { + return false; } } } |
Free forum by Nabble | Edit this page |