MerchantPullPayment Parameters to make initiate a pull payment
Exemple #1
0
        protected void BillUser_Submit(object sender, EventArgs e)
        {
            // Create request object
            BillUserRequestType request = new BillUserRequestType();
            request.ReturnFMFDetails = Int32.Parse(returnFMFDetails.SelectedValue);

            MerchantPullPaymentType paymentDetails = new MerchantPullPaymentType();
            request.MerchantPullPaymentDetails = paymentDetails;
            paymentDetails.Amount = new BasicAmountType(
                (CurrencyCodeType) Enum.Parse(typeof(CurrencyCodeType), currencyCode.SelectedValue), amount.Value);
            paymentDetails.MpID = mpId.Value;
            if (paymentType.SelectedIndex != 0)
            {
                paymentDetails.PaymentType =
                    (MerchantPullPaymentCodeType)Enum.Parse(typeof(MerchantPullPaymentCodeType), paymentType.SelectedValue);
            }
            if (memo.Value != "")
            {
                paymentDetails.Memo = memo.Value;
            }
            if (emailSubject.Value != "")
            {
                paymentDetails.EmailSubject = emailSubject.Value;
            }
            if (tax.Value != "" && taxCurrencyCode.SelectedIndex != 0)
            {
                paymentDetails.Tax = new BasicAmountType(
                    (CurrencyCodeType)Enum.Parse(typeof(CurrencyCodeType), taxCurrencyCode.SelectedValue), tax.Value);
            }
            if (shipping.Value != "" && shippingCurrencyCode.SelectedIndex != 0)
            {
                paymentDetails.Shipping = new BasicAmountType(
                    (CurrencyCodeType)Enum.Parse(typeof(CurrencyCodeType), shippingCurrencyCode.SelectedValue), shipping.Value);
            }
            if (handling.Value != "" && handlingCurrencyCode.SelectedIndex != 0)
            {
                paymentDetails.Handling = new BasicAmountType(
                    (CurrencyCodeType)Enum.Parse(typeof(CurrencyCodeType), handlingCurrencyCode.SelectedValue), handling.Value);
            }
            if (itemName.Value != "")
            {
                paymentDetails.ItemName = itemName.Value;
            }
            if (itemNumber.Value != "")
            {
                paymentDetails.ItemNumber = itemNumber.Value;
            }
            if (invoiceNumber.Value != "")
            {
                paymentDetails.Invoice = invoiceNumber.Value;
            }
            if (custom.Value != "")
            {
                paymentDetails.Custom = custom.Value;
            }
            if (buttonSource.Value != "")
            {
                paymentDetails.ButtonSource = buttonSource.Value;
            }
            if (softDescriptor.Value != "")
            {
                paymentDetails.SoftDescriptor = softDescriptor.Value;
            }

            // Invoke the API
            BillUserReq wrapper = new BillUserReq();
            wrapper.BillUserRequest = request;
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
            BillUserResponseType billUserResponse = service.BillUser(wrapper);

            // Check for API return status
            setKeyResponseObjects(service, billUserResponse);
        }
        protected void BillUser_Submit(object sender, EventArgs e)
        {
            // Create request object
            BillUserRequestType request = new BillUserRequestType();
            request.ReturnFMFDetails = Convert.ToInt32(returnFMFDetails.SelectedValue);

            MerchantPullPaymentType paymentDetails = new MerchantPullPaymentType();
            request.MerchantPullPaymentDetails = paymentDetails;
            paymentDetails.Amount = new BasicAmountType(
                (CurrencyCodeType) Enum.Parse(typeof(CurrencyCodeType), currencyCode.SelectedValue), amount.Value);
            paymentDetails.MpID = mpId.Value;
            if (paymentType.SelectedIndex != 0)
            {
                paymentDetails.PaymentType =
                    (MerchantPullPaymentCodeType)Enum.Parse(typeof(MerchantPullPaymentCodeType), paymentType.SelectedValue);
            }
            if (memo.Value != string.Empty)
            {
                paymentDetails.Memo = memo.Value;
            }
            if (emailSubject.Value != string.Empty)
            {
                paymentDetails.EmailSubject = emailSubject.Value;
            }
            if (tax.Value != string.Empty && taxCurrencyCode.SelectedIndex != 0)
            {
                paymentDetails.Tax = new BasicAmountType(
                    (CurrencyCodeType)Enum.Parse(typeof(CurrencyCodeType), taxCurrencyCode.SelectedValue), tax.Value);
            }
            if (shipping.Value != string.Empty && shippingCurrencyCode.SelectedIndex != 0)
            {
                paymentDetails.Shipping = new BasicAmountType(
                    (CurrencyCodeType)Enum.Parse(typeof(CurrencyCodeType), shippingCurrencyCode.SelectedValue), shipping.Value);
            }
            if (handling.Value != string.Empty && handlingCurrencyCode.SelectedIndex != 0)
            {
                paymentDetails.Handling = new BasicAmountType(
                    (CurrencyCodeType)Enum.Parse(typeof(CurrencyCodeType), handlingCurrencyCode.SelectedValue), handling.Value);
            }
            if (itemName.Value != string.Empty)
            {
                paymentDetails.ItemName = itemName.Value;
            }
            if (itemNumber.Value != string.Empty)
            {
                paymentDetails.ItemNumber = itemNumber.Value;
            }
            if (invoiceNumber.Value != string.Empty)
            {
                paymentDetails.Invoice = invoiceNumber.Value;
            }
            if (custom.Value != string.Empty)
            {
                paymentDetails.Custom = custom.Value;
            }
            if (buttonSource.Value != string.Empty)
            {
                paymentDetails.ButtonSource = buttonSource.Value;
            }
            if (softDescriptor.Value != string.Empty)
            {
                paymentDetails.SoftDescriptor = softDescriptor.Value;
            }

            // Invoke the API
            BillUserReq wrapper = new BillUserReq();
            wrapper.BillUserRequest = 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 BillUser method in service wrapper object
            BillUserResponseType billUserResponse = service.BillUser(wrapper);

            // Check for API return status
            setKeyResponseObjects(service, billUserResponse);
        }