Exemple #1
0
 /// <remarks/>
 public void GetExpressCheckoutDetailsAsync(GetExpressCheckoutDetailsReq GetExpressCheckoutDetailsReq) {
     this.GetExpressCheckoutDetailsAsync(GetExpressCheckoutDetailsReq, null);
 }
Exemple #2
0
 /// <remarks/>
 public void GetExpressCheckoutDetailsAsync(GetExpressCheckoutDetailsReq GetExpressCheckoutDetailsReq, object userState) {
     if ((this.GetExpressCheckoutDetailsOperationCompleted == null)) {
         this.GetExpressCheckoutDetailsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetExpressCheckoutDetailsOperationCompleted);
     }
     this.InvokeAsync("GetExpressCheckoutDetails", new object[] {
                 GetExpressCheckoutDetailsReq}, this.GetExpressCheckoutDetailsOperationCompleted, userState);
 }
        public PayPalInformation GetExpressCheckoutDetails(PayPalInformation payPalInformation, string token)
        {
            GetExpressCheckoutDetailsResponseType GetECDetailsRes = new GetExpressCheckoutDetailsResponseType();
            GetExpressCheckoutDetailsRequestType GetECDetailsReqType = new GetExpressCheckoutDetailsRequestType();
            GetExpressCheckoutDetailsReq GetECDetailsReq = new GetExpressCheckoutDetailsReq();

            GetECDetailsReqType.Version = "53.0";
            GetECDetailsReqType.Token = token;

            GetECDetailsReq.GetExpressCheckoutDetailsRequest = GetECDetailsReqType;

            PayPalAPIAASoapBinding PPInterface = new PayPalAPIAASoapBinding();
            UserIdPasswordType user = new UserIdPasswordType();
            user.Username = this.APIUsername;
            user.Password = this.APIPassword;
            user.AuthCert = CertPath;

            PPInterface.Url = this.APIPath;
            PPInterface.RequesterCredentials = new CustomSecurityHeaderType();
            PPInterface.RequesterCredentials.Credentials = new UserIdPasswordType();
            PPInterface.RequesterCredentials.Credentials = user;

            FileStream fStream = File.Open(CertPath, FileMode.Open, FileAccess.Read);
            byte[] buffer = new byte[fStream.Length];

            int count = fStream.Read(buffer, 0, buffer.Length);

            fStream.Close();

            X509Certificate2 x509 = new X509Certificate2(buffer, CertPassword);
            PPInterface.ClientCertificates.Add(x509);
            //PayPalInformation PPInformation = new PayPalInformation();
            GetECDetailsRes = PPInterface.GetExpressCheckoutDetails(GetECDetailsReq);
            if (GetECDetailsRes.Ack == AckCodeType.Success)
            {

                payPalInformation.Order.Enduser.FirstName = GetECDetailsRes.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerName.FirstName;
                payPalInformation.Order.Enduser.LastName = GetECDetailsRes.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerName.LastName;
                payPalInformation.Order.ShippingAddress.AddressLine = GetECDetailsRes.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.Street1;
                payPalInformation.Order.ShippingAddress.AddressLine2 = GetECDetailsRes.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.Street2;
                payPalInformation.Order.ShippingAddress.City = GetECDetailsRes.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.CityName;
                payPalInformation.Order.ShippingAddress.PostalCode = GetECDetailsRes.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.PostalCode;
                payPalInformation.Order.PayerId = GetECDetailsRes.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerID;
            }
            return payPalInformation;
        }