示例#1
0
 /// <summary>Snippet for GetCustomerLabel</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetCustomerLabel()
 {
     // Create client
     CustomerLabelServiceClient customerLabelServiceClient = CustomerLabelServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER]/customerLabels/[CUSTOMER_LABEL]";
     // Make the request
     CustomerLabel response = customerLabelServiceClient.GetCustomerLabel(resourceName);
 }
 /// <summary>Snippet for GetCustomerLabel</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetCustomerLabelResourceNames()
 {
     // Create client
     CustomerLabelServiceClient customerLabelServiceClient = CustomerLabelServiceClient.Create();
     // Initialize request argument(s)
     CustomerLabelName resourceName = CustomerLabelName.FromCustomerLabel("[CUSTOMER_ID]", "[LABEL_ID]");
     // Make the request
     CustomerLabel response = customerLabelServiceClient.GetCustomerLabel(resourceName);
 }
        /// <summary>Snippet for GetCustomerLabelAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetCustomerLabelAsync()
        {
            // Create client
            CustomerLabelServiceClient customerLabelServiceClient = await CustomerLabelServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER_ID]/customerLabels/[LABEL_ID]";
            // Make the request
            CustomerLabel response = await customerLabelServiceClient.GetCustomerLabelAsync(resourceName);
        }
        /// <summary>Snippet for GetCustomerLabelAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetCustomerLabelResourceNamesAsync()
        {
            // Create client
            CustomerLabelServiceClient customerLabelServiceClient = await CustomerLabelServiceClient.CreateAsync();

            // Initialize request argument(s)
            CustomerLabelName resourceName = CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]");
            // Make the request
            CustomerLabel response = await customerLabelServiceClient.GetCustomerLabelAsync(resourceName);
        }
 /// <summary>Snippet for GetCustomerLabel</summary>
 public void GetCustomerLabel()
 {
     // Snippet: GetCustomerLabel(string, CallSettings)
     // Create client
     CustomerLabelServiceClient customerLabelServiceClient = CustomerLabelServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER_ID]/customerLabels/[LABEL_ID]";
     // Make the request
     CustomerLabel response = customerLabelServiceClient.GetCustomerLabel(resourceName);
     // End snippet
 }
示例#6
0
 /// <summary>Snippet for GetCustomerLabel</summary>
 public void GetCustomerLabelResourceNames()
 {
     // Snippet: GetCustomerLabel(CustomerLabelName, CallSettings)
     // Create client
     CustomerLabelServiceClient customerLabelServiceClient = CustomerLabelServiceClient.Create();
     // Initialize request argument(s)
     CustomerLabelName resourceName = CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]");
     // Make the request
     CustomerLabel response = customerLabelServiceClient.GetCustomerLabel(resourceName);
     // End snippet
 }
示例#7
0
 /// <summary>Snippet for GetCustomerLabel</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetCustomerLabelRequestObject()
 {
     // Create client
     CustomerLabelServiceClient customerLabelServiceClient = CustomerLabelServiceClient.Create();
     // Initialize request argument(s)
     GetCustomerLabelRequest request = new GetCustomerLabelRequest
     {
         ResourceNameAsCustomerLabelName = CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]"),
     };
     // Make the request
     CustomerLabel response = customerLabelServiceClient.GetCustomerLabel(request);
 }
        /// <summary>Snippet for GetCustomerLabelAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetCustomerLabelRequestObjectAsync()
        {
            // Create client
            CustomerLabelServiceClient customerLabelServiceClient = await CustomerLabelServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetCustomerLabelRequest request = new GetCustomerLabelRequest
            {
                ResourceNameAsCustomerLabelName = CustomerLabelName.FromCustomerLabel("[CUSTOMER_ID]", "[LABEL_ID]"),
            };
            // Make the request
            CustomerLabel response = await customerLabelServiceClient.GetCustomerLabelAsync(request);
        }
 /// <summary>Snippet for GetCustomerLabel</summary>
 public void GetCustomerLabelRequestObject()
 {
     // Snippet: GetCustomerLabel(GetCustomerLabelRequest, CallSettings)
     // Create client
     CustomerLabelServiceClient customerLabelServiceClient = CustomerLabelServiceClient.Create();
     // Initialize request argument(s)
     GetCustomerLabelRequest request = new GetCustomerLabelRequest
     {
         ResourceNameAsCustomerLabelName = CustomerLabelName.FromCustomerLabel("[CUSTOMER_ID]", "[LABEL_ID]"),
     };
     // Make the request
     CustomerLabel response = customerLabelServiceClient.GetCustomerLabel(request);
     // End snippet
 }
示例#10
0
        /// <summary>Snippet for GetCustomerLabelAsync</summary>
        public async Task GetCustomerLabelAsync()
        {
            // Snippet: GetCustomerLabelAsync(string, CallSettings)
            // Additional: GetCustomerLabelAsync(string, CancellationToken)
            // Create client
            CustomerLabelServiceClient customerLabelServiceClient = await CustomerLabelServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER]/customerLabels/[CUSTOMER_LABEL]";
            // Make the request
            CustomerLabel response = await customerLabelServiceClient.GetCustomerLabelAsync(resourceName);

            // End snippet
        }
示例#11
0
        /// <summary>Snippet for GetCustomerLabelAsync</summary>
        public async Task GetCustomerLabelResourceNamesAsync()
        {
            // Snippet: GetCustomerLabelAsync(CustomerLabelName, CallSettings)
            // Additional: GetCustomerLabelAsync(CustomerLabelName, CancellationToken)
            // Create client
            CustomerLabelServiceClient customerLabelServiceClient = await CustomerLabelServiceClient.CreateAsync();

            // Initialize request argument(s)
            CustomerLabelName resourceName = CustomerLabelName.FromCustomerCustomerLabel("[CUSTOMER]", "[CUSTOMER_LABEL]");
            // Make the request
            CustomerLabel response = await customerLabelServiceClient.GetCustomerLabelAsync(resourceName);

            // End snippet
        }
示例#12
0
        /// <summary>
        /// 保存客户标签
        /// </summary>
        /// <param name="customerLabel">客户标签</param>
        /// <returns></returns>
        public bool SaveCustomerLabel(CustomerLabel customerLabel)
        {
            if (customerLabel == null || string.IsNullOrEmpty(customerLabel.ServiceSpaceID))
            {
                return(false);
            }

            DataEntity labelDataEntity = new DataEntity();

            labelDataEntity.Add("ID", string.IsNullOrEmpty(customerLabel.ID) ? "" : customerLabel.ID);
            labelDataEntity.Add("Name", string.IsNullOrEmpty(customerLabel.Name) ? "" : customerLabel.Name);
            labelDataEntity.Add("ServiceSpaceId", string.IsNullOrEmpty(customerLabel.ServiceSpaceID) ? "" : customerLabel.ServiceSpaceID);
            bool isSuccessed = _customerProvider.SaveCustomerLabel(labelDataEntity);

            return(isSuccessed);
        }
示例#13
0
        /// <summary>
        /// 获取客户标签
        /// </summary>
        /// <param name="id">标签id</param>
        /// <returns></returns>
        public CustomerLabel GetCustomerLabel(string id)
        {
            CustomerLabel label           = null;
            DataEntity    labelDataEntity = _customerProvider.GetCustomerLabel(id);

            if (labelDataEntity != null)
            {
                label = new CustomerLabel()
                {
                    ID             = labelDataEntity["ID"].Value.ToString(),
                    Name           = labelDataEntity["Name"].Value.ToString(),
                    ServiceSpaceID = labelDataEntity["ServiceSpaceId"].Value.ToString()
                };
            }
            return(label);
        }
        /// <summary>Snippet for GetCustomerLabelAsync</summary>
        public async Task GetCustomerLabelRequestObjectAsync()
        {
            // Snippet: GetCustomerLabelAsync(GetCustomerLabelRequest, CallSettings)
            // Additional: GetCustomerLabelAsync(GetCustomerLabelRequest, CancellationToken)
            // Create client
            CustomerLabelServiceClient customerLabelServiceClient = await CustomerLabelServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetCustomerLabelRequest request = new GetCustomerLabelRequest
            {
                ResourceNameAsCustomerLabelName = CustomerLabelName.FromCustomerLabel("[CUSTOMER_ID]", "[LABEL_ID]"),
            };
            // Make the request
            CustomerLabel response = await customerLabelServiceClient.GetCustomerLabelAsync(request);

            // End snippet
        }
示例#15
0
        public async Task GetCustomerLabelAsync2()
        {
            Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new Mock <CustomerLabelService.CustomerLabelServiceClient>(MockBehavior.Strict);
            GetCustomerLabelRequest request = new GetCustomerLabelRequest
            {
                ResourceName = new CustomerLabelName("[CUSTOMER]", "[CUSTOMER_LABEL]").ToString(),
            };
            CustomerLabel expectedResponse = new CustomerLabel
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCustomerLabelAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <CustomerLabel>(Task.FromResult(expectedResponse), null, null, null, null));
            CustomerLabelServiceClient client = new CustomerLabelServiceClientImpl(mockGrpcClient.Object, null);
            CustomerLabel response            = await client.GetCustomerLabelAsync(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#16
0
        public void GetCustomerLabel2()
        {
            Mock <CustomerLabelService.CustomerLabelServiceClient> mockGrpcClient = new Mock <CustomerLabelService.CustomerLabelServiceClient>(MockBehavior.Strict);
            GetCustomerLabelRequest request = new GetCustomerLabelRequest
            {
                ResourceName = new CustomerLabelName("[CUSTOMER]", "[CUSTOMER_LABEL]").ToString(),
            };
            CustomerLabel expectedResponse = new CustomerLabel
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCustomerLabel(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            CustomerLabelServiceClient client = new CustomerLabelServiceClientImpl(mockGrpcClient.Object, null);
            CustomerLabel response            = client.GetCustomerLabel(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#17
0
 void ReleaseDesignerOutlets()
 {
     if (CustomerLabel != null)
     {
         CustomerLabel.Dispose();
         CustomerLabel = null;
     }
     if (DiscountLabel != null)
     {
         DiscountLabel.Dispose();
         DiscountLabel = null;
     }
     if (DiscountTitleLabel != null)
     {
         DiscountTitleLabel.Dispose();
         DiscountTitleLabel = null;
     }
     if (PauseButton != null)
     {
         PauseButton.Dispose();
         PauseButton = null;
     }
     if (ScanButton != null)
     {
         ScanButton.Dispose();
         ScanButton = null;
     }
     if (SearchBarContainerView != null)
     {
         SearchBarContainerView.Dispose();
         SearchBarContainerView = null;
     }
     if (TableView != null)
     {
         TableView.Dispose();
         TableView = null;
     }
     if (TaxLabel != null)
     {
         TaxLabel.Dispose();
         TaxLabel = null;
     }
     if (TaxTitleLabel != null)
     {
         TaxTitleLabel.Dispose();
         TaxTitleLabel = null;
     }
     if (TotalLabel != null)
     {
         TotalLabel.Dispose();
         TotalLabel = null;
     }
     if (TotalTitleLabel != null)
     {
         TotalTitleLabel.Dispose();
         TotalTitleLabel = null;
     }
     if (TrashButton != null)
     {
         TrashButton.Dispose();
         TrashButton = null;
     }
 }
示例#18
0
        private static async Task Execute()
        {
            var client = new RavelinClient("sk_live_XXXXXXXX");             // change with a valid key

            var customerEvent = new CustomerEvent
            {
                Customer = new Customer
                {
                    CustomerId          = "61283761287361",
                    RegistrationTimeUtc = DateTime.UtcNow.AddDays(-5),
                    Name                 = "Mark Twain",
                    GivenName            = "Mark",
                    FamilyName           = "Twain",
                    DateOfBirth          = "1980-01-27",
                    Gender               = "Male",
                    Email                = "*****@*****.**",
                    EmailVerifiedTimeUtc = DateTime.UtcNow.AddDays(-5),
                    Username             = "******",
                    Location             = new Location
                    {
                        Street1    = "James St",
                        City       = "Darwen",
                        Region     = "Blackburn with Darwen",
                        PostalCode = "BB3 1AS",
                        Country    = "GBR",
                        Latitude   = 53.697471,
                        Longitude  = -2.470891
                    },
                    Custom = new
                    {
                        Newsletter = false,
                        InvitedBy  = "7198737117"
                    }
                }
            };

            OutputResponse(await client.SendEvent(EventType.Customer, customerEvent));

            var loginEvent = new LoginEvent
            {
                CustomerId = "61283761287361",
                Device     = new Device
                {
                    DeviceId        = "2b6f0cc904d137be2e1730235f5664094b831186",
                    Type            = "phone",
                    Manufacturer    = "apple",
                    Model           = "iPhone8,1",
                    OperatingSystem = "iOS 8",
                    IpAddress       = "22.231.113.64"
                }
            };

            OutputResponse(await client.SendEvent(EventType.Login, loginEvent));

            var orderEvent = new OrderEvent
            {
                CustomerId = "61283761287361",
                Order      = new Order
                {
                    OrderId    = "n1QSYK0ceGNZqU28ien3",
                    Price      = 4675,
                    Currency   = "GBP",
                    Market     = "europe",
                    Country    = "GBR",
                    MarketCity = "london",
                    Items      = new List <Item>
                    {
                        new Item
                        {
                            Sku      = "3726-8",
                            Name     = "Women's Arch Sweater M 55",
                            Price    = 1990,
                            Currency = "GBP",
                            Quantity = 2
                        },
                        new Item
                        {
                            Sku      = "3731-4",
                            Name     = "Women's Yellow Tee M 54",
                            Price    = 695,
                            Currency = "GBP",
                            Quantity = 1
                        }
                    },
                    From = new Location
                    {
                        Street1    = "19 Gosport Walk",
                        PostalCode = "N17 9QD",
                        Region     = "London",
                        Country    = "GBR"
                    },
                    To = new Location
                    {
                        Street1    = "73 Braganza St",
                        PostalCode = "SE17 3RD",
                        Region     = "London",
                        Country    = "GBR"
                    },
                    CreationTimeUtc  = DateTime.UtcNow,
                    ExecutionTimeUtc = DateTime.UtcNow,
                    Status           = new OrderStatus(OrderStage.Pending)
                    {
                        Actor = "buyer"
                    }
                },
                DeviceId = "2b6f0cc904d137be2e1730235f5664094b831186"
            };

            OutputResponse(await client.SendEvent(EventType.Order, orderEvent));

            //order event with tickets ticket items
            var eventDate        = DateTime.UtcNow.AddDays(60);
            var orderTicketEvent = new OrderEvent
            {
                CustomerId = "61283761287361",
                Order      = new Order
                {
                    OrderId    = "n1QSYK0ceGNZqU28ien3",
                    Price      = 4675,
                    Currency   = "GBP",
                    Market     = "europe",
                    Country    = "GBR",
                    MarketCity = "london",
                    Items      = new List <Item>
                    {
                        new Item
                        {
                            Sku         = "1111",
                            Name        = "World Concert Series -Seat A",
                            Price       = 100,
                            Currency    = "GBP",
                            Quantity    = 1,
                            EventTicket = new EventTicket()
                            {
                                Event = new EventInformation()
                                {
                                    Venue = new Venue()
                                    {
                                        Location = new Location()
                                        {
                                            Street1 = "Peninsula Square, London SE10 0DX",
                                            Region  = "London",
                                            Country = "GBR",
                                        },
                                        Name = "The O2 Arena"
                                    },
                                    Description  = "World Concert Series",
                                    Name         = "World Concert Series",
                                    Category     = EventCategory.Music,
                                    StartTimeUtc = eventDate,
                                    EndTimeUtc   = eventDate.AddHours(2),
                                    EventId      = "EVT1"
                                },
                                Guest = new Guest()
                                {
                                    Name        = "Mark Twain",
                                    FamilyName  = "Twain",
                                    GivenName   = "Mark",
                                    IsPurchaser = true
                                },
                                Ticket = new Ticket()
                                {
                                    Refundable = true,
                                    TicketId   = "TKT1",
                                    TicketType = "Seat A",
                                }
                            }
                        },
                        new Item
                        {
                            Sku         = "2222",
                            Name        = "World Concert Series -Seat B",
                            Price       = 200,
                            Currency    = "GBP",
                            Quantity    = 1,
                            EventTicket = new EventTicket()
                            {
                                Event = new EventInformation()
                                {
                                    Venue = new Venue()
                                    {
                                        Location = new Location()
                                        {
                                            Street1 = "Peninsula Square, London SE10 0DX",
                                            Region  = "London",
                                            Country = "GBR",
                                        },
                                        Name = "The O2 Arena"
                                    },
                                    Description  = "World Concert Series",
                                    Name         = "World Concert Series",
                                    Category     = EventCategory.Music,
                                    StartTimeUtc = eventDate,
                                    EndTimeUtc   = eventDate.AddHours(2),
                                    EventId      = "EVT1"
                                },
                                Guest = new Guest()
                                {
                                    Name        = "Jane Twain",
                                    FamilyName  = "Twain",
                                    GivenName   = "Jane",
                                    IsPurchaser = false
                                },
                                Ticket = new Ticket()
                                {
                                    Refundable = true,
                                    TicketId   = "TKT2",
                                    TicketType = "Seat B",
                                }
                            }
                        }
                    },
                    From = new Location
                    {
                        Street1    = "19 Gosport Walk",
                        PostalCode = "N17 9QD",
                        Region     = "London",
                        Country    = "GBR"
                    },
                    To = new Location
                    {
                        Street1    = "73 Braganza St",
                        PostalCode = "SE17 3RD",
                        Region     = "London",
                        Country    = "GBR"
                    },
                    CreationTimeUtc  = DateTime.UtcNow,
                    ExecutionTimeUtc = DateTime.UtcNow,
                    Status           = new OrderStatus(OrderStage.Pending)
                    {
                        Actor = "buyer"
                    }
                },
                DeviceId = "2b6f0cc904d137be2e1730235f5664094b831186"
            };

            OutputResponse(await client.SendEvent(EventType.Order, orderTicketEvent));

            // Send card payment method event
            var paymentMethodEvent = new PaymentMethodEvent
            {
                CustomerId    = "61283761287361",
                PaymentMethod = new PaymentMethod
                {
                    PaymentMethodId        = "783917",
                    InstrumentId           = "card_16nWlGHD2LFseSsHaUp9kIW2",
                    RegistrationTimeUtc    = DateTime.UtcNow,
                    NickName               = "MasterCard **** 4242",
                    MethodType             = PaymentMethodType.Card,
                    CardBin                = "123456",
                    CardLastFour           = "4242",
                    CardType               = CardType.Mastercard,
                    ExpiryMonth            = 6,
                    ExpiryYear             = 2019,
                    SuccessfulRegistration = true,
                    CountryIssued          = "GBR",
                    Active         = true,
                    BillingAddress = new Location
                    {
                        Street1    = "73 Braganza St",
                        PostalCode = "SE17 3RD",
                        Region     = "London",
                        Country    = "GBR"
                    },
                    Banned = false
                }
            };

            OutputResponse(await client.SendEvent(EventType.PaymentMethod, paymentMethodEvent));

            var preTransactionEvent = new PreTransactionEvent
            {
                CustomerId      = "61283761287361",
                PaymentMethodId = "783917",
                OrderId         = "n1QSYK0ceGNZqU28ien3",
                Transaction     = new PreTransaction
                {
                    TransactionId  = "f61f8594e06459fa046707c36159bb36",
                    Email          = "*****@*****.**",
                    Debit          = 4675,
                    Credit         = 0,
                    Currency       = "GBP",
                    Type           = TransactionType.AuthCapture,
                    Gateway        = "stripe",
                    SecureProtocol = new SecureProtocol
                    {
                        Attempted    = true,
                        StartTimeUtc = DateTime.UtcNow
                    }
                }
            };

            OutputScoredResponse(await client.SendEventAndScore(EventType.PreTransaction, preTransactionEvent));

            var transactionEvent = new TransactionEvent
            {
                CustomerId      = "61283761287361",
                PaymentMethodId = "783917",
                OrderId         = "n1QSYK0ceGNZqU28ien3",
                Transaction     = new Transaction
                {
                    TransactionId    = "f61f8594e06459fa046707c36159bb36",
                    Email            = "*****@*****.**",
                    Debit            = 4675,
                    Credit           = 0,
                    Currency         = "GBP",
                    Success          = true,
                    AuthCode         = "1000",
                    Gateway          = "stripe",
                    GatewayReference = "tr_16oaY72eZvKYlo2CE5ZDq9Vh",
                    AvsResultCode    = new AvsResult
                    {
                        Street     = "A",
                        PostalCode = "M"
                    },
                    CvvResultCode  = "M",
                    Type           = TransactionType.AuthCapture,
                    SecureProtocol = new SecureProtocol
                    {
                        Attempted    = true,
                        Success      = true,
                        StartTimeUtc = DateTime.UtcNow,
                        EndTimeUtc   = DateTime.UtcNow
                    }
                }
            };

            OutputScoredResponse(await client.SendEventAndScore(EventType.Transaction, transactionEvent));

            // Update pending order to accepted order status stage
            orderEvent = new OrderEvent
            {
                CustomerId = "61283761287361",
                Order      = new Order
                {
                    OrderId          = "n1QSYK0ceGNZqU28ien3",
                    Price            = 4675,
                    ExecutionTimeUtc = DateTime.UtcNow,
                    Status           = new OrderStatus(OrderStage.Accepted)
                    {
                        Actor = "seller"
                    }
                }
            };

            OutputResponse(await client.SendEvent(EventType.Order, orderEvent));

            // Check-out (All-in-One) with PAN (sent to vault)

            var checkoutEvent = new CheckoutEvent
            {
                Customer = new Customer
                {
                    CustomerId          = "71983561248363",
                    RegistrationTimeUtc = DateTime.UtcNow.AddDays(-2),
                    GivenName           = "Arya",
                    FamilyName          = "Wayne",
                    Gender   = "Female",
                    Email    = "*****@*****.**",
                    Username = "******",
                    Location = new Location
                    {
                        Street1    = "Baker St",
                        City       = "London",
                        Region     = "London",
                        PostalCode = "NW1 6XE",
                        Country    = "GBR",
                        Latitude   = 51.523774,
                        Longitude  = -0.158537
                    }
                },
                Order = new Order
                {
                    OrderId  = "g1QSYD0ceGNZqU28iev3",
                    Price    = 4675,
                    Currency = "GBP",
                    Items    = new List <Item>
                    {
                        new Item
                        {
                            Sku      = "3726-8",
                            Name     = "Women's Arch Sweater M 55",
                            Price    = 1990,
                            Currency = "GBP",
                            Quantity = 2
                        },
                        new Item
                        {
                            Sku      = "3731-4",
                            Name     = "Women's Yellow Tee M 54",
                            Price    = 695,
                            Currency = "GBP",
                            Quantity = 1
                        }
                    }
                },
                PaymentMethod = new PaymentMethod
                {
                    PaymentMethodId        = "453237",
                    InstrumentId           = "card_19nWlGHD2LFseSsHaUp9kIW3",
                    RegistrationTimeUtc    = DateTime.UtcNow,
                    NickName               = "MasterCard **** 2424",
                    MethodType             = PaymentMethodType.Card,
                    CardBin                = "654321",
                    CardLastFour           = "2424",
                    CardType               = CardType.Mastercard,
                    ExpiryMonth            = 8,
                    ExpiryYear             = 2020,
                    SuccessfulRegistration = true,
                    PrepaidCard            = false,
                    CountryIssued          = "GBR",
                    Active = true,
                    Banned = false,
                    Pan    = "5454545454545454"
                },
                Transaction = new Transaction
                {
                    TransactionId    = "d12f8594e06459fa046707c53159bb30",
                    Email            = "*****@*****.**",
                    Debit            = 4675,
                    Credit           = 0,
                    Currency         = "GBP",
                    Success          = true,
                    Gateway          = "stripe",
                    GatewayReference = "tr_67oaY72eZvKYlo2CE5ZDq9Vh",
                    Type             = TransactionType.AuthCapture
                }
            };

            OutputScoredResponse(await client.SendEventAndScore(EventType.Checkout, checkoutEvent));

            // Chargeback

            var chargebackEvent = new ChargebackEvent(new Chargeback
            {
                ChargebackId     = "dp_15RsQX2eZvKYlo2C0MFNUWJC",
                Gateway          = "stripe",
                GatewayReference = "ch_15RsQR2eZvKYlo2CA8IfzCX0",
                Reason           = "general",
                Status           = ChargebackStatus.Lost,
                Amount           = 195,
                Currency         = "USD",
                DisputeTimeUtc   = DateTime.UtcNow.AddHours(-2),
                NonFraud         = true
            });

            OutputResponse(await client.SendEvent(EventType.Chargeback, chargebackEvent));

            // Backfill Events

            var backfillCustomerEvent = new CustomerEvent
            {
                Customer = new Customer
                {
                    CustomerId          = "35248561944321",
                    RegistrationTimeUtc = DateTime.UtcNow.AddDays(-20),
                    GivenName           = "John",
                    FamilyName          = "Butler",
                    Gender   = "Male",
                    Email    = "*****@*****.**",
                    Username = "******"
                },
                Timestamp = DateTime.UtcNow.AddDays(-20)
            };

            OutputBackfillResponse(await client.SendBackfillEvent(EventType.Customer, backfillCustomerEvent));

            var backfillCheckoutEvent = new CheckoutEvent
            {
                CustomerId = "35248561944321",
                Order      = new Order
                {
                    OrderId  = "h1DSYD0ceNPSqU28isd3",
                    Price    = 4675,
                    Currency = "GBP",
                    Items    = new List <Item>
                    {
                        new Item
                        {
                            Sku      = "3726-8",
                            Name     = "Women's Arch Sweater M 55",
                            Price    = 1990,
                            Currency = "GBP",
                            Quantity = 2
                        },
                        new Item
                        {
                            Sku      = "3731-4",
                            Name     = "Women's Yellow Tee M 54",
                            Price    = 695,
                            Currency = "GBP",
                            Quantity = 1
                        }
                    }
                },
                PaymentMethod = new PaymentMethod
                {
                    PaymentMethodId        = "533228",
                    InstrumentId           = "card_19nWlGDR2LFseSsSaUk9kIC3",
                    RegistrationTimeUtc    = DateTime.UtcNow.AddDays(-6),
                    NickName               = "MasterCard **** 3213",
                    MethodType             = PaymentMethodType.Card,
                    CardBin                = "742589",
                    CardLastFour           = "3213",
                    CardType               = CardType.Mastercard,
                    ExpiryMonth            = 7,
                    ExpiryYear             = 2019,
                    SuccessfulRegistration = true,
                    PrepaidCard            = false,
                    CountryIssued          = "GBR",
                    Active = true,
                    Banned = false
                },
                Transaction = new Transaction
                {
                    TransactionId    = "k12f8594e06gj9fa046707c53155fb30",
                    Email            = "*****@*****.**",
                    Debit            = 4675,
                    Credit           = 0,
                    Currency         = "GBP",
                    Success          = true,
                    Gateway          = "stripe",
                    GatewayReference = "tr_67oaY72eYhOPlo2CE5ZDq5gKh",
                    Type             = TransactionType.AuthCapture
                },
                Timestamp = DateTime.UtcNow.AddDays(-6)
            };

            OutputBackfillResponse(await client.SendBackfillEvent(EventType.Checkout, backfillCheckoutEvent));

            //Customer Label
            var label = new CustomerLabel
            {
                CustomerId = "61283761287361",
                Comment    = "Test comment",
                Label      = Label.Genuine,
                Reviewer   = new Reviewer {
                    Name = "John Reviewer", Email = "*****@*****.**"
                }
            };

            OutputResponse(await client.SetCustomerLabel(label));

            Console.WriteLine("\n\nPress <Enter> to continue.");
            Console.ReadLine();
        }
示例#19
0
 public async Task <Response> SetCustomerLabel(CustomerLabel customerLabel)
 {
     return(new Response(await RequestAsync(client.BaseAddress + BuildUrl("label/customer"),
                                            customerLabel?.Serialize() ?? string.Empty).ConfigureAwait(false)));
 }