/// <summary>
        /// Process a Payout Send funds from a selected funding source to a designated credit/debit card account or a prepaid card using an Original Credit Transaction (OCT).
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="octCreatePaymentRequest"></param>
        /// <returns>PtsV2PayoutsPost201Response</returns>
        public PtsV2PayoutsPost201Response OctCreatePayment(OctCreatePaymentRequest octCreatePaymentRequest)
        {
            logger.Debug("CALLING API \"OctCreatePayment\" STARTED");
            this.SetStatusCode(null);
            ApiResponse <PtsV2PayoutsPost201Response> localVarResponse = OctCreatePaymentWithHttpInfo(octCreatePaymentRequest);

            logger.Debug("CALLING API \"OctCreatePayment\" ENDED");
            this.SetStatusCode(localVarResponse.StatusCode);
            return(localVarResponse.Data);
        }
Ejemplo n.º 2
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new OctCreatePaymentRequest();

            var v2PaymentsClientReferenceInformationObj = new InlineResponse201ClientReferenceInformation
            {
                Code = "33557799"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            var senderInformationObj = new V2payoutsSenderInformation
            {
                ReferenceNumber    = "1234567890",
                Address1           = "900 Metro Center Blvd.900",
                CountryCode        = "US",
                Locality           = "Foster City",
                Name               = "Company Name",
                AdministrativeArea = "CA"
            };

            var accountObj = new V2payoutsSenderInformationAccount
            {
                FundsSource = "05"
            };

            senderInformationObj.Account = accountObj;

            requestObj.SenderInformation = senderInformationObj;

            var v2PaymentsProcessingInformationObj = new V2payoutsProcessingInformation
            {
                CommerceIndicator     = "internet",
                BusinessApplicationId = "FD"
            };

            requestObj.ProcessingInformation = v2PaymentsProcessingInformationObj;

            var v2PaymentsOrderInformationObj = new V2payoutsOrderInformation();

            var v2PaymentsOrderInformationAmountDetailsObj = new V2payoutsOrderInformationAmountDetails
            {
                TotalAmount = "100.00",
                Currency    = "USD"
            };

            v2PaymentsOrderInformationObj.AmountDetails = v2PaymentsOrderInformationAmountDetailsObj;

            requestObj.OrderInformation = v2PaymentsOrderInformationObj;

            var merchantInformationObj = new V2payoutsMerchantInformation();

            var merchantDescriptorObj = new V2payoutsMerchantInformationMerchantDescriptor
            {
                Country            = "US",
                PostalCode         = "94440",
                Locality           = "FC",
                Name               = "Sending Company Name",
                AdministrativeArea = "CA"
            };

            merchantInformationObj.MerchantDescriptor = merchantDescriptorObj;

            requestObj.MerchantInformation = merchantInformationObj;

            var v2PaymentsPaymentInformationObj = new V2payoutsPaymentInformation();

            var v2PaymentsPaymentInformationCardObj = new V2payoutsPaymentInformationCard
            {
                ExpirationYear  = "2025",
                Number          = "4111111111111111",
                ExpirationMonth = "12",
                Type            = "001"
            };

            v2PaymentsPaymentInformationObj.Card = v2PaymentsPaymentInformationCardObj;

            requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;

            var recipientInformationObj = new V2payoutsRecipientInformation
            {
                FirstName          = "John",
                LastName           = "Doe",
                Address1           = "Paseo Padre Boulevard",
                Locality           = "Foster City",
                AdministrativeArea = "CA",
                PostalCode         = "94400",
                PhoneNumber        = "6504320556",
                Country            = "US"
            };

            requestObj.RecipientInformation = recipientInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payouts",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new DefaultApi(configurationSwagger);
                var result = apiInstance.OctCreatePaymentWithHttpInfo(requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Process a Payout Send funds from a selected funding source to a designated credit/debit card account or a prepaid card using an Original Credit Transaction (OCT).
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="octCreatePaymentRequest"></param>
        /// <returns>Task of ApiResponse (PtsV2PayoutsPost201Response)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <PtsV2PayoutsPost201Response> > OctCreatePaymentAsyncWithHttpInfo(OctCreatePaymentRequest octCreatePaymentRequest)
        {
            // verify the required parameter 'octCreatePaymentRequest' is set
            if (octCreatePaymentRequest == null)
            {
                throw new ApiException(400, "Missing required parameter 'octCreatePaymentRequest' when calling PayoutsApi->OctCreatePayment");
            }

            var    localVarPath         = $"/pts/v2/payouts";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json;charset=utf-8"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/hal+json;charset=utf-8"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (octCreatePaymentRequest != null && octCreatePaymentRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(octCreatePaymentRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = octCreatePaymentRequest; // byte array
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                       Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                       localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("OctCreatePayment", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <PtsV2PayoutsPost201Response>(localVarStatusCode,
                                                                 localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                                 (PtsV2PayoutsPost201Response)Configuration.ApiClient.Deserialize(localVarResponse, typeof(PtsV2PayoutsPost201Response)))); // Return statement
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Process a Payout Send funds from a selected funding source to a designated credit/debit card account or a prepaid card using an Original Credit Transaction (OCT).
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="octCreatePaymentRequest"></param>
        /// <returns>Task of PtsV2PayoutsPost201Response</returns>
        public async System.Threading.Tasks.Task <PtsV2PayoutsPost201Response> OctCreatePaymentAsync(OctCreatePaymentRequest octCreatePaymentRequest)
        {
            ApiResponse <PtsV2PayoutsPost201Response> localVarResponse = await OctCreatePaymentAsyncWithHttpInfo(octCreatePaymentRequest);

            return(localVarResponse.Data);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Process a Payout Send funds from a selected funding source to a designated credit/debit card account or a prepaid card using an Original Credit Transaction (OCT).
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="octCreatePaymentRequest"></param>
        /// <returns>PtsV2PayoutsPost201Response</returns>
        public PtsV2PayoutsPost201Response OctCreatePayment(OctCreatePaymentRequest octCreatePaymentRequest)
        {
            ApiResponse <PtsV2PayoutsPost201Response> localVarResponse = OctCreatePaymentWithHttpInfo(octCreatePaymentRequest);

            return(localVarResponse.Data);
        }
        public static PtsV2PayoutsPost201Response Run()
        {
            string clientReferenceInformationCode = "111111113";
            Ptsv2payoutsClientReferenceInformation clientReferenceInformation = new Ptsv2payoutsClientReferenceInformation(
                Code: clientReferenceInformationCode
                );

            string orderInformationAmountDetailsTotalAmount = "111.00";
            string orderInformationAmountDetailsCurrency    = "USD";
            Ptsv2payoutsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2payoutsOrderInformationAmountDetails(
                TotalAmount: orderInformationAmountDetailsTotalAmount,
                Currency: orderInformationAmountDetailsCurrency
                );

            Ptsv2payoutsOrderInformation orderInformation = new Ptsv2payoutsOrderInformation(
                AmountDetails: orderInformationAmountDetails
                );

            string merchantInformationMerchantDescriptorName               = "Sending Company Name";
            string merchantInformationMerchantDescriptorLocality           = "FC";
            string merchantInformationMerchantDescriptorCountry            = "US";
            string merchantInformationMerchantDescriptorAdministrativeArea = "CA";
            string merchantInformationMerchantDescriptorPostalCode         = "94440";
            Ptsv2payoutsMerchantInformationMerchantDescriptor merchantInformationMerchantDescriptor = new Ptsv2payoutsMerchantInformationMerchantDescriptor(
                Name: merchantInformationMerchantDescriptorName,
                Locality: merchantInformationMerchantDescriptorLocality,
                Country: merchantInformationMerchantDescriptorCountry,
                AdministrativeArea: merchantInformationMerchantDescriptorAdministrativeArea,
                PostalCode: merchantInformationMerchantDescriptorPostalCode
                );

            Ptsv2payoutsMerchantInformation merchantInformation = new Ptsv2payoutsMerchantInformation(
                MerchantDescriptor: merchantInformationMerchantDescriptor
                );

            string recipientInformationFirstName                  = "John";
            string recipientInformationLastName                   = "Doe";
            string recipientInformationAddress1                   = "Paseo Padre Boulevard";
            string recipientInformationLocality                   = "Foster City";
            string recipientInformationAdministrativeArea         = "CA";
            string recipientInformationCountry                    = "US";
            string recipientInformationPostalCode                 = "94400";
            string recipientInformationPhoneNumber                = "6504320556";
            Ptsv2payoutsRecipientInformation recipientInformation = new Ptsv2payoutsRecipientInformation(
                FirstName: recipientInformationFirstName,
                LastName: recipientInformationLastName,
                Address1: recipientInformationAddress1,
                Locality: recipientInformationLocality,
                AdministrativeArea: recipientInformationAdministrativeArea,
                Country: recipientInformationCountry,
                PostalCode: recipientInformationPostalCode,
                PhoneNumber: recipientInformationPhoneNumber
                );

            string senderInformationReferenceNumber    = "1234567890";
            string senderInformationAccountFundsSource = "05";
            string senderInformationAccountNumber      = "1234567890123456789012345678901234";
            Ptsv2payoutsSenderInformationAccount senderInformationAccount = new Ptsv2payoutsSenderInformationAccount(
                FundsSource: senderInformationAccountFundsSource,
                Number: senderInformationAccountNumber
                );

            string senderInformationName                    = "Company Name";
            string senderInformationAddress1                = "900 Metro Center Blvd.900";
            string senderInformationLocality                = "Foster City";
            string senderInformationAdministrativeArea      = "CA";
            string senderInformationCountryCode             = "US";
            Ptsv2payoutsSenderInformation senderInformation = new Ptsv2payoutsSenderInformation(
                ReferenceNumber: senderInformationReferenceNumber,
                Account: senderInformationAccount,
                Name: senderInformationName,
                Address1: senderInformationAddress1,
                Locality: senderInformationLocality,
                AdministrativeArea: senderInformationAdministrativeArea,
                CountryCode: senderInformationCountryCode
                );

            string processingInformationBusinessApplicationId       = "FD";
            string processingInformationNetworkRoutingOrder         = "V8";
            string processingInformationCommerceIndicator           = "internet";
            Ptsv2payoutsProcessingInformation processingInformation = new Ptsv2payoutsProcessingInformation(
                BusinessApplicationId: processingInformationBusinessApplicationId,
                NetworkRoutingOrder: processingInformationNetworkRoutingOrder,
                CommerceIndicator: processingInformationCommerceIndicator
                );

            string paymentInformationCustomerCustomerId = "7500BB199B4270EFE05340588D0AFCAD";
            Ptsv2paymentsPaymentInformationCustomer paymentInformationCustomer = new Ptsv2paymentsPaymentInformationCustomer(
                CustomerId: paymentInformationCustomerCustomerId
                );

            Ptsv2payoutsPaymentInformation paymentInformation = new Ptsv2payoutsPaymentInformation(
                Customer: paymentInformationCustomer
                );

            var requestObj = new OctCreatePaymentRequest(
                ClientReferenceInformation: clientReferenceInformation,
                OrderInformation: orderInformation,
                MerchantInformation: merchantInformation,
                RecipientInformation: recipientInformation,
                SenderInformation: senderInformation,
                ProcessingInformation: processingInformation,
                PaymentInformation: paymentInformation
                );

            try
            {
                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);

                var apiInstance = new PayoutsApi(clientConfig);
                PtsV2PayoutsPost201Response result = apiInstance.OctCreatePayment(requestObj);
                Console.WriteLine(result);
                return(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
                return(null);
            }
        }
Ejemplo n.º 7
0
        public static void Run()
        {
            var requestObj = new OctCreatePaymentRequest();

            var clientReferenceInformationObj = new PtsV2IncrementalAuthorizationPatch201ResponseClientReferenceInformation
            {
                Code = "33557799"
            };

            requestObj.ClientReferenceInformation = clientReferenceInformationObj;

            var senderInformationObj = new Ptsv2payoutsSenderInformation
            {
                ReferenceNumber    = "1234567890",
                Address1           = "900 Metro Center Blvd.900",
                CountryCode        = "US",
                Locality           = "San Francisco",
                Name               = "Thomas Jefferson",
                AdministrativeArea = "CA"
            };

            var accountObj = new Ptsv2payoutsSenderInformationAccount
            {
                Number      = "1234567890123456789012345678901234",
                FundsSource = "01"
            };

            senderInformationObj.Account = accountObj;

            requestObj.SenderInformation = senderInformationObj;

            var processingInformationObj = new Ptsv2payoutsProcessingInformation
            {
                CommerceIndicator     = "internet",
                BusinessApplicationId = "FD",
                NetworkRoutingOrder   = "ECG"
            };

            requestObj.ProcessingInformation = processingInformationObj;

            var orderInformationObj = new Ptsv2payoutsOrderInformation();

            var amountDetailsObj = new Ptsv2payoutsOrderInformationAmountDetails
            {
                TotalAmount = "100.00",
                Currency    = "USD"
            };

            orderInformationObj.AmountDetails = amountDetailsObj;

            requestObj.OrderInformation = orderInformationObj;

            var merchantInformationObj = new Ptsv2payoutsMerchantInformation
            {
                CategoryCode = 123
            };

            var merchantDescriptorObj = new Ptsv2payoutsMerchantInformationMerchantDescriptor
            {
                Country            = "US",
                PostalCode         = "94440",
                Locality           = "FC",
                Name               = "Thomas",
                AdministrativeArea = "CA"
            };

            merchantInformationObj.MerchantDescriptor = merchantDescriptorObj;

            requestObj.MerchantInformation = merchantInformationObj;

            var paymentInformationObj = new Ptsv2payoutsPaymentInformation();

            var cardObj = new Ptsv2payoutsPaymentInformationCard
            {
                ExpirationYear    = "2025",
                Number            = "4111111111111111",
                ExpirationMonth   = "12",
                Type              = "001",
                SourceAccountType = "CH"
            };

            paymentInformationObj.Card = cardObj;

            requestObj.PaymentInformation = paymentInformationObj;

            var recipientInformationObj = new Ptsv2payoutsRecipientInformation
            {
                FirstName          = "John",
                LastName           = "Doe",
                Address1           = "Paseo Padre Boulevard",
                Locality           = "San Francisco",
                AdministrativeArea = "CA",
                PostalCode         = "94400",
                PhoneNumber        = "6504320556",
                DateOfBirth        = "19801009",
                Country            = "US"
            };

            requestObj.RecipientInformation = recipientInformationObj;

            try
            {
                var configDictionary = new Configuration().GetConfiguration();
                var clientConfig     = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary);
                var apiInstance      = new PayoutsApi(clientConfig);

                var result = apiInstance.OctCreatePaymentWithHttpInfo(requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
        /// <summary>
        /// Process a Payout Send funds from a selected funding source to a designated credit/debit card account or a prepaid card using an Original Credit Transaction (OCT).
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="octCreatePaymentRequest"></param>
        /// <returns>Task of PtsV2PayoutsPost201Response</returns>
        public async System.Threading.Tasks.Task <PtsV2PayoutsPost201Response> OctCreatePaymentAsync(OctCreatePaymentRequest octCreatePaymentRequest)
        {
            logger.Debug("CALLING API \"OctCreatePaymentAsync\" STARTED");
            this.SetStatusCode(null);
            ApiResponse <PtsV2PayoutsPost201Response> localVarResponse = await OctCreatePaymentAsyncWithHttpInfo(octCreatePaymentRequest);

            logger.Debug("CALLING API \"OctCreatePaymentAsync\" ENDED");
            this.SetStatusCode(localVarResponse.StatusCode);
            return(localVarResponse.Data);
        }
        /// <summary>
        /// Process a Payout Send funds from a selected funding source to a designated credit/debit card account or a prepaid card using an Original Credit Transaction (OCT).
        /// </summary>
        /// <exception cref="CyberSource.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="octCreatePaymentRequest"></param>
        /// <returns>ApiResponse of PtsV2PayoutsPost201Response</returns>
        public ApiResponse <PtsV2PayoutsPost201Response> OctCreatePaymentWithHttpInfo(OctCreatePaymentRequest octCreatePaymentRequest)
        {
            LogUtility logUtility = new LogUtility();

            // verify the required parameter 'octCreatePaymentRequest' is set
            if (octCreatePaymentRequest == null)
            {
                logger.Error("ApiException : Missing required parameter 'octCreatePaymentRequest' when calling PayoutsApi->OctCreatePayment");
                throw new ApiException(400, "Missing required parameter 'octCreatePaymentRequest' when calling PayoutsApi->OctCreatePayment");
            }

            var    localVarPath         = $"/pts/v2/payouts";
            var    localVarPathParams   = new Dictionary <string, string>();
            var    localVarQueryParams  = new Dictionary <string, string>();
            var    localVarHeaderParams = new Dictionary <string, string>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <string, string>();
            var    localVarFileParams   = new Dictionary <string, FileParameter>();
            object localVarPostBody     = null;

            // to determine the Content-Type header
            string[] localVarHttpContentTypes = new string[] {
                "application/json;charset=utf-8"
            };
            string localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            string[] localVarHttpHeaderAccepts = new string[] {
                "application/hal+json;charset=utf-8"
            };
            string localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (octCreatePaymentRequest != null && octCreatePaymentRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(octCreatePaymentRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = octCreatePaymentRequest; // byte array
            }

            if (logUtility.IsMaskingEnabled(logger))
            {
                logger.Debug($"HTTP Request Body :\n{logUtility.MaskSensitiveData(localVarPostBody.ToString())}");
            }
            else
            {
                logger.Debug($"HTTP Request Body :\n{localVarPostBody}");
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)Configuration.ApiClient.CallApi(localVarPath,
                                                                                            Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("OctCreatePayment", localVarResponse);
                if (exception != null)
                {
                    logger.Error($"Exception : {exception.Message}");
                    throw exception;
                }
            }

            return(new ApiResponse <PtsV2PayoutsPost201Response>(localVarStatusCode,
                                                                 localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                                 (PtsV2PayoutsPost201Response)Configuration.ApiClient.Deserialize(localVarResponse, typeof(PtsV2PayoutsPost201Response)))); // Return statement
        }