예제 #1
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            // Create request object
            DoNonReferencedCreditRequestType request = new DoNonReferencedCreditRequestType();
            request.DoNonReferencedCreditRequestDetails = new DoNonReferencedCreditRequestDetailsType();

            CurrencyCodeType currency = (CurrencyCodeType)
                Enum.Parse( typeof(CurrencyCodeType), currencyId.Value);
            request.DoNonReferencedCreditRequestDetails.Amount = new BasicAmountType(currency, itemAmount.Value);

            CreditCardDetailsType creditCard = new CreditCardDetailsType();
            request.DoNonReferencedCreditRequestDetails.CreditCard = creditCard;
            creditCard.CreditCardNumber = creditCardNumber.Value;
            creditCard.CreditCardType = (CreditCardTypeType)
                Enum.Parse(typeof(CreditCardTypeType), creditCardType.SelectedValue);
            creditCard.CVV2 = cvv.Value;
            string[] cardExpiryDetails = cardExpiryDate.Text.Split(new char[] { '/' });
            creditCard.ExpMonth = Int32.Parse(cardExpiryDetails[0]);
            creditCard.ExpYear = Int32.Parse(cardExpiryDetails[1]);

            if (comment.Value != "")
            {
                request.DoNonReferencedCreditRequestDetails.Comment = comment.Value;
            }
            // Invoke the API
            DoNonReferencedCreditReq wrapper = new DoNonReferencedCreditReq();
            wrapper.DoNonReferencedCreditRequest = request;
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
            DoNonReferencedCreditResponseType DoNonReferencedCreditResponse = service.DoNonReferencedCredit(wrapper);

            // Check for API return status
            setKeyResponseObjects(service, DoNonReferencedCreditResponse);
        }
        /// <summary>
        /// 
        /// </summary>
        ///<param name="doNonReferencedCreditReq"></param>
        ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> 
        public DoNonReferencedCreditResponseType DoNonReferencedCredit(DoNonReferencedCreditReq doNonReferencedCreditReq, ICredential credential)
        {
            setStandardParams(doNonReferencedCreditReq.DoNonReferencedCreditRequest);
            DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, doNonReferencedCreditReq.ToXMLString(null, "DoNonReferencedCreditReq"), null, null);
            IAPICallPreHandler apiCallPreHandler = new MerchantAPICallPreHandler(this.config, defaultHandler, credential);
            ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
            ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
            ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = "PayPalAPIAA";

            XmlDocument xmlDocument = new XmlDocument();
            xmlDocument.LoadXml(Call(apiCallPreHandler));
            return new DoNonReferencedCreditResponseType(
                xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='DoNonReferencedCreditResponse']")
            );
        }
 /// <summary> 
 /// 
 /// </summary>
 ///<param name="doNonReferencedCreditReq"></param>
 public DoNonReferencedCreditResponseType DoNonReferencedCredit(DoNonReferencedCreditReq doNonReferencedCreditReq)
 {
     return DoNonReferencedCredit(doNonReferencedCreditReq,(string) null);
 }
 /**
   *AUTO_GENERATED
  	  */
 public DoNonReferencedCreditResponseType DoNonReferencedCredit(DoNonReferencedCreditReq doNonReferencedCreditReq, string apiUserName)
 {
     IAPICallPreHandler apiCallPreHandler = null;
      		string portName = "PayPalAPIAA";
     setStandardParams(doNonReferencedCreditReq.DoNonReferencedCreditRequest);
     DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(doNonReferencedCreditReq.ToXMLString(null, "DoNonReferencedCreditReq"), null, null);
     apiCallPreHandler = new MerchantAPICallPreHandler(defaultHandler, apiUserName, getAccessToken(), getAccessTokenSecret());
     ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
     ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
     ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = portName;
     string response = Call(apiCallPreHandler);
     XmlDocument xmlDocument = new XmlDocument();
     xmlDocument.LoadXml(response);
     XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='DoNonReferencedCreditResponse']");
     return new DoNonReferencedCreditResponseType(xmlNode);
 }
        protected void Submit_Click(object sender, EventArgs e)
        {
            // Create request object
            DoNonReferencedCreditRequestType request = new DoNonReferencedCreditRequestType();
            request.DoNonReferencedCreditRequestDetails = new DoNonReferencedCreditRequestDetailsType();

            // (Required) Total of order, including shipping, handling, and tax. Amount = NetAmount + ShippingAmount + TaxAmount
            // Character length and limitations: Must not exceed $10,000 USD in any currency. No currency symbol. Must have 2 decimal places, decimal separator must be a period (.), and the optional thousands separator must be a comma (,).
            CurrencyCodeType currency = (CurrencyCodeType)
                Enum.Parse( typeof(CurrencyCodeType), currencyId.Value);
            request.DoNonReferencedCreditRequestDetails.Amount = new BasicAmountType(currency, itemAmount.Value);
            // (Required) Information about the credit card to be charged.
            CreditCardDetailsType creditCard = new CreditCardDetailsType();
            request.DoNonReferencedCreditRequestDetails.CreditCard = creditCard;
            // (Required) Credit card number.
            creditCard.CreditCardNumber = creditCardNumber.Value;
            // (Optional) Type of credit card. For UK, only Maestro, MasterCard, Discover, and Visa are allowable. For Canada, only MasterCard and Visa are allowable and Interac debit cards are not supported. It is one of the following values:
            // * Visa
            // * MasterCard
            // * Discover
            // * Amex
            // * Maestro: See note.
            // Note: If the credit card type is Maestro, you must set currencyId to GBP. In addition, you must specify either StartMonth and StartYear or IssueNumber.
            creditCard.CreditCardType = (CreditCardTypeType)
                Enum.Parse(typeof(CreditCardTypeType), creditCardType.SelectedValue);
            // Card Verification Value, version 2. Your Merchant Account settings determine whether this field is required. To comply with credit card processing regulations, you must not store this value after a transaction has been completed.
            creditCard.CVV2 = cvv.Value;
            string[] cardExpiryDetails = cardExpiryDate.Text.Split(new char[] { '/' });

            // (Required) Credit card expiration month.
            if (cardExpiryDetails.Length > 0 && !string.IsNullOrEmpty(cardExpiryDetails[0]))
            {
                int month = 0;
                Int32.TryParse(cardExpiryDetails[0], out month);
                creditCard.ExpMonth = month;
            }

            // (Required) Credit card expiration year.
            if (cardExpiryDetails.Length > 1 && !string.IsNullOrEmpty(cardExpiryDetails[1]))
            {
                int year = 0;
                Int32.TryParse(cardExpiryDetails[1], out year);
                creditCard.ExpYear = year;
            }

            // (Optional) Field used by merchant to record why this credit was issued to a buyer. It is similar to a "memo" field (freeform text or string field).
            if (comment.Value != string.Empty)
            {
                request.DoNonReferencedCreditRequestDetails.Comment = comment.Value;
            }
            // Invoke the API
            DoNonReferencedCreditReq wrapper = new DoNonReferencedCreditReq();
            wrapper.DoNonReferencedCreditRequest = request;

            // Configuration map containing signature credentials and other required configuration.
            // For a full list of configuration parameters refer in wiki page
            // [https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters]
            Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig();

            // Create the PayPalAPIInterfaceServiceService service object to make the API call
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);

            // # API call
            // Invoke the DoNonReferencedCredit method in service wrapper object
            DoNonReferencedCreditResponseType DoNonReferencedCreditResponse = service.DoNonReferencedCredit(wrapper);

            // Check for API return status
            setKeyResponseObjects(service, DoNonReferencedCreditResponse);
        }
 /**
   *AUTO_GENERATED
  	  */
 public DoNonReferencedCreditResponseType DoNonReferencedCredit(DoNonReferencedCreditReq doNonReferencedCreditReq, string apiUserName)
 {
     setStandardParams(doNonReferencedCreditReq.DoNonReferencedCreditRequest);
     string response = Call("DoNonReferencedCredit", doNonReferencedCreditReq.ToXMLString(), apiUserName);
     XmlDocument xmlDocument = new XmlDocument();
     xmlDocument.LoadXml(response);
     XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='DoNonReferencedCreditResponse']");
     return new DoNonReferencedCreditResponseType(xmlNode);
 }
 public DoNonReferencedCreditResponseType DoNonReferencedCredit(DoNonReferencedCreditReq DoNonReferencedCreditReq)
 {
     return DoNonReferencedCredit(DoNonReferencedCreditReq, null);
 }
        /**
         *
         */
        public DoNonReferencedCreditResponseType DoNonReferencedCredit(DoNonReferencedCreditReq DoNonReferencedCreditReq, string apiUsername)
        {
            setStandardParams(DoNonReferencedCreditReq.DoNonReferencedCreditRequest);
            string resp = call("DoNonReferencedCredit", DoNonReferencedCreditReq.toXMLString(), apiUsername);

            return new DoNonReferencedCreditResponseType(resp);
        }