/// <summary> /// Obtain the Payment resource for the given identifier. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="paymentId">Identifier of the Payment Resource to obtain the data for.</param> /// <returns>Payment</returns> public static Payment Get(APIContext apiContext, string paymentId) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(paymentId, "paymentId"); // Configure and send the request var pattern = "v1/payments/payment/{0}"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { paymentId }); return(PayPalResource.ConfigureAndExecute <Payment>(apiContext, HttpMethod.GET, resourcePath)); }
/// <summary> /// Reauthorizes an expired Authorization. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="authorization">The Authorization object containing the details of the authorization that should be reauthorized.</param> /// <returns>Authorization</returns> public static Authorization Reauthorize(APIContext apiContext, Authorization authorization) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(authorization, "authorization"); // Configure and send the request var pattern = "v1/payments/authorization/{0}/reauthorize"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { authorization.id }); return(PayPalResource.ConfigureAndExecute <Authorization>(apiContext, HttpMethod.POST, resourcePath, authorization.ConvertToJson())); }
/// <summary> /// Voids (cancels) an Authorization. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="authorizationId">ID of the authorization to void.</param> /// <returns>Authorization</returns> public static Authorization Void(APIContext apiContext, string authorizationId) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(authorizationId, "authorizationId"); // Configure and send the request var pattern = "v1/payments/authorization/{0}/void"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { authorizationId }); return(PayPalResource.ConfigureAndExecute <Authorization>(apiContext, HttpMethod.POST, resourcePath)); }
/// <summary> /// Get all invoices of a merchant. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <returns>Invoices</returns> public static Invoices GetAll(APIContext apiContext) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); // Configure and send the request string pattern = "v1/invoicing/invoices"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = ""; return(PayPalResource.ConfigureAndExecute <Invoices>(apiContext, HttpMethod.GET, resourcePath, payLoad)); }
public ApiResponse <LoginRadiusDeleteResponse> DeleteAdditionalPermissionfromContext(string uid, string rolecontextname, AdditionalRolePermissions _AdditionalRolePermissions) { Validate(new ArrayList { uid, rolecontextname }); var resourcePath = SDKUtil.FormatURIPath(new LoginRadiusResoucePath("{0}/rolecontext/{1}/additionalpermission"), new object[] { uid, rolecontextname }); return(ConfigureAndExecute <LoginRadiusDeleteResponse>(RequestType.Identity, HttpMethod.Delete, resourcePath, _AdditionalRolePermissions.ConvertToJson())); }
/// <summary> /// Updates the Webhook identified by webhook_id for the application associated with access token. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="webhookId">ID of the webhook to be updated.</param> /// <param name="patchRequest">PatchRequest</param> /// <returns>Webhook</returns> public static Webhook Update(APIContext apiContext, string webhookId, PatchRequest patchRequest) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(webhookId, "webhookId"); ArgumentValidator.Validate(patchRequest, "patchRequest"); // Configure and send the request var pattern = "v1/notifications/webhooks/{0}"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { webhookId }); return(PayPalResource.ConfigureAndExecute <Webhook>(apiContext, HttpMethod.PATCH, resourcePath, patchRequest.ConvertToJson())); }
public ApiResponse <CustomObjectResponse> GetAccountCustomObject(string uId, string objectname) { Validate(new ArrayList { uId }); var resourcePath = SDKUtil.FormatURIPath(_resoucePath, new object[] { uId }); var addtionalparameter = new QueryParameters { ["objectname"] = objectname }; return(ConfigureAndExecute <CustomObjectResponse>(RequestType.Identity, HttpMethod.Get, resourcePath, addtionalparameter)); }
public ApiResponse <CustomObjectprop> UpdateAccountCustomObjectbytoken(string access_token, string objectRecordId, string objectname, string customObject) { Validate(new ArrayList { objectRecordId, objectname, access_token }); var additionalparams = new QueryParameters { ["objectname"] = objectname, ["access_token"] = access_token }; var resourcePath = SDKUtil.FormatURIPath(("customobject/{0}"), new object[] { objectRecordId }); return(ConfigureAndExecute <CustomObjectprop>(RequestType.Authentication, HttpMethod.Put, resourcePath, additionalparams, customObject)); }
/// <summary> /// Update information in a previously saved card. Only the modified fields need to be passed in the request. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="creditCardId">ID fo the credit card to update.</param> /// <param name="patchRequest">PatchRequest</param> /// <returns>CreditCard</returns> public static CreditCard Update(APIContext apiContext, string creditCardId, PatchRequest patchRequest) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(creditCardId, "creditCardId"); ArgumentValidator.Validate(patchRequest, "patchRequest"); // Configure and send the request var pattern = "v1/vault/credit-cards/{0}"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { creditCardId }); return(PayPalResource.ConfigureAndExecute <CreditCard>(apiContext, HttpMethod.PATCH, resourcePath, patchRequest.ConvertToJson())); }
/// <summary> /// Partially update an existing web experience profile by passing the ID of the profile to the request URI. In addition, pass a patch object in the request JSON that specifies the operation to perform, path of the profile location to update, and a new value if needed to complete the operation. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="profileId">ID fo the web profile to partially update.</param> /// <param name="patchRequest">PatchRequest</param> public static void PartialUpdate(APIContext apiContext, string profileId, PatchRequest patchRequest) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(profileId, "profileId"); ArgumentValidator.Validate(patchRequest, "patchRequest"); // Configure and send the request var pattern = "v1/payment-experience/web-profiles/{0}"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { profileId }); PayPalResource.ConfigureAndExecute(apiContext, HttpMethod.PATCH, resourcePath, patchRequest.ConvertToJson()); }
/// <summary> /// Creates (and processes) a new Refund Transaction added as a related resource. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="captureId">ID of the captured payment resource to refund.</param> /// <param name="refund">Refund</param> /// <returns>Refund</returns> public static Refund Refund(APIContext apiContext, string captureId, Refund refund) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(captureId, "captureId"); ArgumentValidator.Validate(refund, "refund"); // Configure and send the request var pattern = "v1/payments/capture/{0}/refund"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { captureId }); return(PayPalResource.ConfigureAndExecute <Refund>(apiContext, HttpMethod.POST, resourcePath, refund.ConvertToJson())); }
/// <summary> /// Set the balance for an agreement by passing the ID of the agreement to the request URI. In addition, pass a Currency object in the request JSON that specifies the currency type and value of the balance. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="agreementId">ID of the billing agreement to perform the operation against.</param> /// <param name="currency">Currency</param> public static void SetBalance(APIContext apiContext, string agreementId, Currency currency) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(agreementId, "agreementId"); ArgumentValidator.Validate(currency, "currency"); // Configure and send the request var pattern = "v1/payments/billing-agreements/{0}/set-balance"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { agreementId }); PayPalResource.ConfigureAndExecute(apiContext, HttpMethod.POST, resourcePath, currency.ConvertToJson()); }
/// <summary> /// Mark the status of the invoice as refunded. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="invoiceId">ID fo the invoice to mark as refunded.</param> /// <param name="refundDetail">RefundDetail</param> public static void RecordRefund(APIContext apiContext, string invoiceId, RefundDetail refundDetail) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(invoiceId, "invoiceId"); ArgumentValidator.Validate(refundDetail, "refundDetail"); // Configure and send the request var pattern = "v1/invoicing/invoices/{0}/record-refund"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { invoiceId }); PayPalResource.ConfigureAndExecute(apiContext, HttpMethod.POST, resourcePath, refundDetail.ConvertToJson()); }
/// <summary> /// Cancel a billing agreement by passing the ID of the agreement to the request URI. In addition, pass an AgreementStateDescriptor object in the request JSON that includes a note about the reason for changing the state of the agreement and the amount and currency for the agreement. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="agreementId">ID of the billing agreement that will be canceled.</param> /// <param name="agreementStateDescriptor">AgreementStateDescriptor</param> public static void Cancel(APIContext apiContext, string agreementId, AgreementStateDescriptor agreementStateDescriptor) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(agreementId, "agreementId"); ArgumentValidator.Validate(agreementStateDescriptor, "agreementStateDescriptor"); // Configure and send the request var pattern = "v1/payments/billing-agreements/{0}/cancel"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { agreementId }); PayPalResource.ConfigureAndExecute(apiContext, HttpMethod.POST, resourcePath, agreementStateDescriptor.ConvertToJson()); }
/// <summary> /// Creates (and processes) a new Capture Transaction added as a related resource. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="authorizationId">ID of the authorization to capture.</param> /// <param name="capture">Capture</param> /// <returns>Capture</returns> public static Capture Capture(APIContext apiContext, string authorizationId, Capture capture) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(authorizationId, "authorizationId"); ArgumentValidator.Validate(capture, "capture"); // Configure and send the request var pattern = "v1/payments/authorization/{0}/capture"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { authorizationId }); return(PayPalResource.ConfigureAndExecute <Capture>(apiContext, HttpMethod.POST, resourcePath, capture.ConvertToJson())); }
/// <summary> /// Cancels an invoice. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="invoiceId">ID of the invoice to cancel.</param> /// <param name="cancelNotification">CancelNotification</param> public static void Cancel(APIContext apiContext, string invoiceId, CancelNotification cancelNotification) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(invoiceId, "invoiceId"); ArgumentValidator.Validate(cancelNotification, "cancelNotification"); // Configure and send the request var pattern = "v1/invoicing/invoices/{0}/cancel"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { invoiceId }); PayPalResource.ConfigureAndExecute(apiContext, HttpMethod.POST, resourcePath, cancelNotification.ConvertToJson()); }
/// <summary> /// Deletes a web experience profile, by ID. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="profileId">The ID of the profile to delete.</param> public static void Delete(APIContext apiContext, string profileId) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(profileId, "profileId"); // Configure and send the request apiContext.MaskRequestId = true; var pattern = "v1/payment-experience/web-profiles/{0}"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { profileId }); PayPalResource.ConfigureAndExecute(apiContext, HttpMethod.DELETE, resourcePath); }
/// <summary> /// Delete the Credit Card resource for the given identifier. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="creditCardId">Identifier of the credit card resource to obtain the data for.</param> public static void Delete(APIContext apiContext, string creditCardId) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(creditCardId, "creditCardId"); // Configure and send the request apiContext.MaskRequestId = true; var pattern = "v1/vault/credit-cards/{0}"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { creditCardId }); PayPalResource.ConfigureAndExecute(apiContext, HttpMethod.DELETE, resourcePath); }
/// <summary> /// Reauthorizes an expired Authorization. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <returns>Authorization</returns> public Authorization Reauthorize(APIContext apiContext) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(this.id, "Id"); // Configure and send the request object[] parameters = new object[] { this.id }; string pattern = "v1/payments/authorization/{0}/reauthorize"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = this.ConvertToJson(); return(PayPalResource.ConfigureAndExecute <Authorization>(apiContext, HttpMethod.POST, resourcePath, payLoad)); }
/// <summary> /// Execute a billing agreement after buyer approval by passing the payment token to the request URI. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <returns>Agreement</returns> public Agreement Execute(APIContext apiContext) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(this.token, "token"); // Configure and send the request object[] parameters = new object[] { this.token }; string pattern = "v1/payments/billing-agreements/{0}/agreement-execute"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = ""; return(PayPalResource.ConfigureAndExecute <Agreement>(apiContext, HttpMethod.POST, resourcePath, payLoad)); }
/// <summary> /// Deletes an external refund, by invoice ID and transaction ID. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="invoiceId">The ID of the invoice from which to delete the refund transaction.</param> /// <param name="transactionId">The ID of the refund transaction to delete.</param> public static void DeleteExternalRefund(APIContext apiContext, string invoiceId, string transactionId) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(invoiceId, "invoiceId"); ArgumentValidator.Validate(transactionId, "transactionId"); // Configure and send the request apiContext.MaskRequestId = true; var pattern = "v1/invoicing/invoices/{0}/refund-records/{1}"; var resourcePath = SDKUtil.FormatURIPath(pattern, new object[] { invoiceId, transactionId }); PayPalResource.ConfigureAndExecute(apiContext, HttpMethod.DELETE, resourcePath); }
/// <summary> /// Retrieve the details of a particular web experience profile by passing the ID of the profile to the request URI. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="profileId">string</param> /// <returns>WebProfile</returns> public static WebProfile Get(APIContext apiContext, string profileId) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(profileId, "profileId"); // Configure and send the request object[] parameters = new object[] { profileId }; string pattern = "v1/payment-experience/web-profiles/{0}"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = ""; return(PayPalResource.ConfigureAndExecute <WebProfile>(apiContext, HttpMethod.GET, resourcePath, payLoad)); }
/// <summary> /// Retrieves a list of Credit Card resources. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="containerDictionary">Dictionary<String, String></param> /// <returns>CreditCardHistory</returns> public static CreditCardHistory List(APIContext apiContext, Dictionary <String, String> containerDictionary) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(containerDictionary, "containerDictionary"); // Configure and send the request object[] parameters = new object[] { containerDictionary }; string pattern = "v1/vault/credit-card?count={0}&start_id={1}&start_index={2}&start_time={3}&end_time={4}&payer_id={5}"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = ""; return(PayPalResource.ConfigureAndExecute <CreditCardHistory>(apiContext, HttpMethod.GET, resourcePath, payLoad)); }
/// <summary> /// Obtain the Bank Account resource for the given identifier. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="bankAccountId">string</param> /// <returns>BankAccount</returns> public static BankAccount Get(APIContext apiContext, string bankAccountId) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(bankAccountId, "bankAccountId"); // Configure and send the request object[] parameters = new object[] { bankAccountId }; string pattern = "v1/vault/bank-accounts/{0}"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = ""; return(PayPalResource.ConfigureAndExecute <BankAccount>(apiContext, HttpMethod.GET, resourcePath, payLoad)); }
/// <summary> /// Voids (cancels) an Order. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <returns>Order</returns> public Order Void(APIContext apiContext) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(this.id, "Id"); // Configure and send the request object[] parameters = new object[] { this.id }; string pattern = "v1/payments/orders/{0}/do-void"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = ""; return(PayPalResource.ConfigureAndExecute <Order>(apiContext, HttpMethod.POST, resourcePath, payLoad)); }
/// <summary> /// Search for invoice resources. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="search">Search</param> /// <returns>Invoices</returns> public Invoices Search(APIContext apiContext, Search search) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(search, "search"); // Configure and send the request object[] parameters = new object[] { this.id }; string pattern = "v1/invoicing/search"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = search.ConvertToJson(); return(PayPalResource.ConfigureAndExecute <Invoices>(apiContext, HttpMethod.POST, resourcePath, payLoad)); }
public void FormatURIPathMapQueryMapTest() { string pattern = "/a/b/first/second"; Dictionary <string, string> pathParameters = new Dictionary <string, string>(); Dictionary <string, string> queryParameters = new Dictionary <string, string>(); queryParameters.Add("query1", "value1"); queryParameters.Add("query2", "value2"); string uriPath = SDKUtil.FormatURIPath(pattern, pathParameters, queryParameters); Assert.AreEqual(uriPath, "/a/b/first/second?query1=value1&query2=value2&"); }
/// <summary> /// Get call for Refund. /// GET /v1/payments/refund/:refundId /// <param name="accessToken">Access Token</param> /// <param name="refundId">RefundId</param> /// <returns>Returns Refund object</returns> /// </summary> public static Refund Get(string accessToken, string refundId) { if (String.IsNullOrEmpty(refundId)) { throw new System.ArgumentNullException("refundId cannot be null or empty"); } string pattern = "v1/payments/refund/{0}"; object[] container = new Object[] { refundId }; string resourcePath = SDKUtil.FormatURIPath(pattern, container); string payLoad = string.Empty; return(PayPalResource.ConfigureAndExecute <Refund>(accessToken, HttpMethod.GET, resourcePath, payLoad)); }
/// <summary> /// Obtain the Refund transaction resource for the given identifier. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <param name="refundId">string</param> /// <returns>Refund</returns> public static Refund Get(APIContext apiContext, string refundId) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(refundId, "refundId"); // Configure and send the request object[] parameters = new object[] { refundId }; string pattern = "v1/payments/refund/{0}"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = ""; return(PayPalResource.ConfigureAndExecute <Refund>(apiContext, HttpMethod.GET, resourcePath, payLoad)); }
/// <summary> /// Update information in a previously saved card. Only the modified fields need to be passed in the request. /// </summary> /// <param name="apiContext">APIContext used for the API call.</param> /// <returns>CreditCard</returns> public CreditCard Update(APIContext apiContext) { // Validate the arguments to be used in the request ArgumentValidator.ValidateAndSetupAPIContext(apiContext); ArgumentValidator.Validate(this.id, "Id"); // Configure and send the request object[] parameters = new object[] { this.id }; string pattern = "v1/vault/credit-card/{0}"; string resourcePath = SDKUtil.FormatURIPath(pattern, parameters); string payLoad = this.ConvertToJson(); return(PayPalResource.ConfigureAndExecute <CreditCard>(apiContext, HttpMethod.PATCH, resourcePath, payLoad)); }