PayPal.Api.PayPalRelationalObject.GetApprovalUrl C# (CSharp) Method

GetApprovalUrl() public method

Gets the approval URL from a list of HATEOAS links.
public GetApprovalUrl ( bool setUserActionParameter = false ) : string
setUserActionParameter bool If true, appends the 'useraction' URL query parameter. /// For PayPal payments, this will set the approval button text on the PayPal site to "Pay Now".
return string
        public string GetApprovalUrl(bool setUserActionParameter = false)
        {
            var link = this.GetHateoasLink(BaseConstants.HateoasLinkRelations.ApprovalUrl);
            if (link != null)
            {
                return link.href + (setUserActionParameter ? "&useraction=commit" : "");
            }
            return string.Empty;
        }

Usage Example

Exemplo n.º 1
0
 public void LinksNoApprovalUrlPayNowTest()
 {
     var resource = new PayPalRelationalObject
     {
         links = new List<Links>
         {
             GetLinks(false)
         }
     };
     var approvalUrl = resource.GetApprovalUrl(true);
     Assert.IsTrue(string.IsNullOrEmpty(approvalUrl));
 }
All Usage Examples Of PayPal.Api.PayPalRelationalObject::GetApprovalUrl