/// <summary>
        /// Resource /{merchantId}/hostedmandatemanagements
        /// - <a href="https://epayments-api.developer-ingenico.com/s2sapi/v1/en_US/dotnet/hostedmandatemanagements/create.html">Create hosted mandate management</a>
        /// </summary>
        /// <param name="body">CreateHostedMandateManagementRequest</param>
        /// <param name="context">CallContext</param>
        /// <returns>CreateHostedMandateManagementResponse</returns>
        /// <exception cref="ValidationException">if the request was not correct and couldn't be processed (HTTP status code BadRequest)</exception>
        /// <exception cref="AuthorizationException">if the request was not allowed (HTTP status code Forbidden)</exception>
        /// <exception cref="IdempotenceException">if an idempotent request caused a conflict (HTTP status code Conflict)</exception>
        /// <exception cref="ReferenceException">if an object was attempted to be referenced that doesn't exist or has been removed,
        ///            or there was a conflict (HTTP status code NotFound, Conflict or Gone)</exception>
        /// <exception cref="GlobalCollectException">if something went wrong at the Ingenico ePayments platform,
        ///            the Ingenico ePayments platform was unable to process a message from a downstream partner/acquirer,
        ///            or the service that you're trying to reach is temporary unavailable (HTTP status code InternalServerError, BadGateway or ServiceUnavailable)</exception>
        /// <exception cref="ApiException">if the Ingenico ePayments platform returned any other error</exception>
        public async Task <CreateHostedMandateManagementResponse> Create(CreateHostedMandateManagementRequest body, CallContext context = null)
        {
            string uri = InstantiateUri("/v1/{merchantId}/hostedmandatemanagements", null);

            try
            {
                return(await _communicator.Post <CreateHostedMandateManagementResponse>(
                           uri,
                           ClientHeaders,
                           null,
                           body,
                           context));
            }
            catch (ResponseException e)
            {
                object errorObject = _communicator.Marshaller.Unmarshal <ErrorResponse>(e.Body);
                throw CreateException(e.StatusCode, e.Body, errorObject, context);
            }
        }
예제 #2
0
        public async void Example()
        {
#pragma warning disable 0168
            using (Client client = GetClient())
            {
                HostedMandateInfo createMandateInfo = new HostedMandateInfo();
                createMandateInfo.CustomerReference = "idonthaveareference";
                createMandateInfo.RecurrenceType    = "RECURRING";
                createMandateInfo.SignatureType     = "UNSIGNED";

                HostedMandateManagementSpecificInput hostedMandateManagementSpecificInput = new HostedMandateManagementSpecificInput();
                hostedMandateManagementSpecificInput.Locale    = "fr_FR";
                hostedMandateManagementSpecificInput.ReturnUrl = "http://www.example.com";
                hostedMandateManagementSpecificInput.Variant   = "101";

                CreateHostedMandateManagementRequest body = new CreateHostedMandateManagementRequest();
                body.CreateMandateInfo = createMandateInfo;
                body.HostedMandateManagementSpecificInput = hostedMandateManagementSpecificInput;

                CreateHostedMandateManagementResponse response = await client.Merchant("merchantId").Hostedmandatemanagements().Create(body);
            }
#pragma warning restore 0168
        }