الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

التسديد عن طريق paypal

بدأه زكيري عبد العالي في 27 أبريل 2010 · 2 رد · 902 مشاهدة · في لغة Delphi
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

اريد ان يتم التسديد لجلب معلومات من قاعدة اليانات من طرف الزبون عن طريق paypal ولقد وجدت مثالا بالجافا و حولته الى الدلفي لكن تضهر رسالة خطأ ارجو المساعدة شكرا .

spot_flowChart_589x278.gif

package com.compubase.web.ws;

import java.rmi.RemoteException;

import org.apache.axis2.AxisFault;
import org.apache.axis2.databinding.types.soapencoding.Token;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.log4j.Logger;
import com.compubase.web.ws.constants.WsProperty;
import com.compubase.web.ws.helper.ResourceBundleHelper;
import com.compubase.web.ws.stubs.PayPalAPIInterfaceServiceStub;
import com.compubase.web.ws.stubs.PayPalAPIInterfaceServiceStub.BasicAmountType;
import com.compubase.web.ws.stubs.PayPalAPIInterfaceServiceStub.CurrencyCodeType;
import com.compubase.web.ws.stubs.PayPalAPIInterfaceServiceStub.CustomSecurityHeaderType;
import com.compubase.web.ws.stubs.PayPalAPIInterfaceServiceStub.EmailAddressType;
import com.compubase.web.ws.stubs.PayPalAPIInterfaceServiceStub.RequesterCredentials;
import com.compubase.web.ws.stubs.PayPalAPIInterfaceServiceStub.SetExpressCheckoutRequestDetailsType;
import com.compubase.web.ws.stubs.PayPalAPIInterfaceServiceStub.SetExpressCheckoutRequestType;
import com.compubase.web.ws.stubs.PayPalAPIInterfaceServiceStub.SetExpressCheckoutResponseType;
import com.compubase.web.ws.stubs.PayPalAPIInterfaceServiceStub.UserIdPasswordType;

public class PayPalServiceManager extends ServiceManager<PayPalAPIInterfaceServiceStub>{

	private static Logger logger = Logger.getLogger(PayPalServiceManager.class);
	public PayPalServiceManager() {
		super(PayPalAPIInterfaceServiceStub.class, ResourceBundleHelper
				.getWsProperty(WsProperty.ws_paypalservice));
	}


	public SetExpressCheckoutResponseType setExpressCheckout() 
	throws WSTechnicalException, WSBusinessException {
		try {

			logger.debug("setExpressCheckout:in");
//			//the second parameter of the method
//			RequesterCredentials requesterCredentials = new RequesterCredentials();
//			//prepare the security informations
//			UserIdPasswordType credentials = new UserIdPasswordType();
//			credentials.setSignature("AFcWxV21C7fd0v3bYYYRCpSSRl31AP91utizHT0LUF4o5JKtfXeLhDyO ");
//			credentials.setUsername("mferhi_1271942295_biz_api1.compubase.net");
//			credentials.setPassword("1271942299");
//			//prepare the CustomSecurityHeaderType 
//			CustomSecurityHeaderType customSecurityHeaderType = new CustomSecurityHeaderType();
//			//add the security informations
//			customSecurityHeaderType.setCredentials(credentials );
//			//add the customSecurityHeaderType to the requesterCredentials
//			requesterCredentials.setRequesterCredentials(customSecurityHeaderType );
//			
//			//the second parameter of the method
//			SetExpressCheckoutRequestType setExpressCheckoutRequest = new SetExpressCheckoutRequestType();
//			//set the version
//			setExpressCheckoutRequest.setVersion("2.5");
//			//prepare the SetExpressCheckoutRequestDetailsType
//			SetExpressCheckoutRequestDetailsType expressCheckoutRequestDetails = new SetExpressCheckoutRequestDetailsType();
//			//prepare the EmailAddressType
//			EmailAddressType buyerEmail = new EmailAddressType();
//			//add the mail address
//			buyerEmail.setEmailAddressType("mferhi@compubase.net");
//			//add the other information to the SetExpressCheckoutRequestDetailsType
//			expressCheckoutRequestDetails.setBuyerEmail(buyerEmail );
//			expressCheckoutRequestDetails.setCancelURL("www.google.fr");
//			expressCheckoutRequestDetails.setReturnURL("www.google.fr");
//			expressCheckoutRequestDetails.setOrderDescription("Achat d'une fiche");
//			
//			//add the expressCheckoutRequestDetails to the SetExpressCheckoutRequestType
//			setExpressCheckoutRequest.setSetExpressCheckoutRequestDetails(expressCheckoutRequestDetails );

			// call the SetExpressCheckout method
			RequesterCredentials requesterCredentials = new RequesterCredentials();

			//prepare the security informations
			UserIdPasswordType credentials = new UserIdPasswordType();
			credentials.setSignature("AFcWxV21C7fd0v3bYYYRCpSSRl31AP91utizHT0LUF4o5JKtfXeLhDyO ");
			credentials.setUsername("mferhi_1271942295_biz_api1.compubase.net");
			credentials.setPassword("1271942299");

			//prepare the CustomSecurityHeaderType 
			CustomSecurityHeaderType customSecurityHeaderType = new CustomSecurityHeaderType();
			//add the security informations
			customSecurityHeaderType.setCredentials(credentials );
			//add the customSecurityHeaderType to the requesterCredentials
			requesterCredentials.setRequesterCredentials(customSecurityHeaderType );

			SetExpressCheckoutRequestType setExpressCheckoutRequest = new SetExpressCheckoutRequestType();
			setExpressCheckoutRequest.setVersion("51.0");
			//prepare the SetExpressCheckoutRequestDetailsType
			SetExpressCheckoutRequestDetailsType expressCheckoutRequestDetails = new SetExpressCheckoutRequestDetailsType();
//			BasicAmountType orderTotal = new BasicAmountType();
//			orderTotal.setString("100");

			//org.apache.axis2.databinding.types.Token token = null;
			//org.apache.axis2.databinding.types.Token token = new org.apache.axis2.databinding.types.Token();

			//orderTotal.setCurrencyID(currencyID );

			//expressCheckoutRequestDetails.setOrderTotal(orderTotal );
			expressCheckoutRequestDetails.setReturnURL("http://www.compubase.biz/");
			expressCheckoutRequestDetails.setCancelURL("http://www.compubase.biz/");
			setExpressCheckoutRequest.setSetExpressCheckoutRequestDetails(expressCheckoutRequestDetails );

			//options.setProperty(HTTPConstants.CHUNKED, false);




			SetExpressCheckoutResponseType retour =	getService().SetExpressCheckout(setExpressCheckoutRequest, requesterCredentials);
			System.out.println("Paypal response >>>>>>"+retour.toString());
			return  retour;
		} catch (AxisFault e) {
			logger.debug("setExpressCheckout: ", e);
			logger.error("setExpressCheckout: " + e.getMessage());
			throw new WSTechnicalException(e);
		} catch (RemoteException e) {
			logger.debug("setExpressCheckout: ", e);
			logger.error("setExpressCheckout: " + e.getMessage());
			throw new WSTechnicalException(e);
		} catch (InstantiationException e) {
			logger.debug("setExpressCheckout: ", e);
			logger.error("setExpressCheckout: " + e.getMessage());
			throw new WSTechnicalException(e);
		} catch (IllegalAccessException e) {
			logger.debug("setExpressCheckout: ", e);
			logger.error("setExpressCheckout: " + e.getMessage());
			throw new WSTechnicalException(e);
		} finally {
			logger.debug("setExpressCheckout:out");
		} 

	}

	public static void main (String args[]){
		PayPalServiceManager payPalServiceManager = new PayPalServiceManager();

		try {
			payPalServiceManager.setExpressCheckout();
		} catch (WSTechnicalException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (WSBusinessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}

post-1034-12723654665109_thumb.jpg

PayPalSvc.rar

تم تعديل هذه المشاركة بواسطة زكيري عبد العالي في 12 مايو 2010 في 13:26

#3

للرفع

مواضيع مشابهة