示例#1
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);
 }
        /// <summary>
        /// Gets the express checkout details.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <returns></returns>
        internal PayPalPayer GetExpressCheckoutDetails(string token)
        {
            PayPalPayer payPalPayer = new PayPalPayer();

              GetExpressCheckoutDetailsReq expressCheckoutRequest = new GetExpressCheckoutDetailsReq();
              GetExpressCheckoutDetailsRequestType expressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType();
              expressCheckoutDetailsRequest.Token = token;
              expressCheckoutDetailsRequest.Version = PayPalServiceUtility.PayPalVersionNumber;
              expressCheckoutRequest.GetExpressCheckoutDetailsRequest = expressCheckoutDetailsRequest;
              GetExpressCheckoutDetailsResponseType expressCheckoutDetailsResponse =
            payPalAPIAASoapBinding.GetExpressCheckoutDetails(expressCheckoutRequest);

              string errorList = ValidateResponse(expressCheckoutDetailsResponse);
              //if (expressCheckoutDetailsResponse.Ack != AckCodeType.Success && expressCheckoutDetailsResponse.Ack != AckCodeType.SuccessWithWarning) {
              if(IsValidResponse(expressCheckoutDetailsResponse.Ack)) {
            if (!string.IsNullOrEmpty(errorList)) {
              throw new PayPalServiceException(errorList);
            }
              }

              if (EnforceSellerProtectionPolicy) {
            if (expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.AddressStatus !=
            AddressStatusCodeType.Confirmed) {
              throw new PayPalServiceException(PayPalStrings.AddressStatusException);
            }
              }

              payPalPayer.PayPalPayerId =
            expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerID;
              payPalPayer.PayPalToken = expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.Token;
              payPalPayer.ShippingAddress.AddressType = AddressType.ShippingAddress;
              payPalPayer.ShippingAddress.Email = expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Payer;
              payPalPayer.ShippingAddress.FirstName =
            expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerName.FirstName;
              payPalPayer.ShippingAddress.LastName =
            expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerName.LastName;
              payPalPayer.ShippingAddress.Address1 =
            expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.Street1;
              payPalPayer.ShippingAddress.Address2 =
            expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.Street2;
              payPalPayer.ShippingAddress.City =
            expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.CityName;
              payPalPayer.ShippingAddress.StateOrRegion =
            expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.StateOrProvince;
              payPalPayer.ShippingAddress.PostalCode =
            expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.PostalCode;
              if (expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.CountrySpecified) {
            payPalPayer.ShippingAddress.Country =
              expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.Country.ToString();
              }
              if (expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.ContactPhone != null) {
            payPalPayer.ShippingAddress.Phone = expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.ContactPhone;
              }
              else {
            if (expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.ContactPhone != null) {
              payPalPayer.ShippingAddress.Phone =
            expressCheckoutDetailsResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.ContactPhone;
            }
              }

              return payPalPayer;
        }
示例#3
0
 /// <remarks/>
 public void GetExpressCheckoutDetailsAsync(GetExpressCheckoutDetailsReq GetExpressCheckoutDetailsReq) {
     this.GetExpressCheckoutDetailsAsync(GetExpressCheckoutDetailsReq, null);
 }