Ejemplo n.º 1
0
        public static void Run()
        {
            const string reportName = "testrest_subcription_v1";

            var request = new RequestBody1(
                ReportDefinitionName: "TransactionRequestClass",
                ReportMimeType: RequestBody1.ReportMimeTypeEnum.ApplicationXml,
                ReportFields: new List <string>()
            {
                "Request.RequestID", "Request.TransactionDate", "Request.MerchantID"
            },
                ReportName: reportName,
                ReportFrequency: RequestBody1.ReportFrequencyEnum.WEEKLY,
                Timezone: "GMT",
                StartTime: "0115",
                StartDay: 1);

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

                apiInstance.CreateSubscription(request);

                DeleteSubscriptionOfReportNameByOrganization.ReportNameToDelete = reportName;
                DeleteSubscriptionOfReportNameByOrganization.Run();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
        public static void Run()
        {
            string reportDefinitionName = "TransactionRequestClass";

            List <string> reportFields = new List <string>();

            reportFields.Add("Request.RequestID");
            reportFields.Add("Request.TransactionDate");
            reportFields.Add("Request.MerchantID");
            string reportMimeType  = "application/xml";
            string reportFrequency = "WEEKLY";
            string reportName      = "testrest_subcription_v1";
            string timezone        = "GMT";
            string startTime       = "0900";
            int    startDay        = 1;
            var    requestObj      = new CreateReportSubscriptionRequest(
                ReportDefinitionName: reportDefinitionName,
                ReportFields: reportFields,
                ReportMimeType: reportMimeType,
                ReportFrequency: reportFrequency,
                ReportName: reportName,
                Timezone: timezone,
                StartTime: startTime,
                StartDay: startDay
                );

            string organizationId = null;

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

                var apiInstance = new ReportSubscriptionsApi(clientConfig);
                apiInstance.CreateSubscription(requestObj, organizationId);

                DeleteSubscriptionOfReportNameByOrganization.ReportNameToDelete = reportName;
                DeleteSubscriptionOfReportNameByOrganization.Run();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API : " + e.Message);
            }
        }