Exemplo n.º 1
0
        public void PayoutOrderSuccess()
        {
            // Arrange
            MGPayoutResult expectedResult = new MGPayoutResult()
            {
                IsSuccess = true,
                Code      = "200",
                Message   = null,
                Data      = new MGPayoutData {
                    orderID = "123456", merchantOrderID = "merch-order"
                }
            };
            string   messageSuccess = "{ \"code\": \"200\", \"data\": { \"orderID\": \"123456\", \"merchantOrderID\": \"merch-order\"} }";
            var      httpMock       = Mocks.GetMockedHttp(HttpStatusCode.OK, messageSuccess);
            MGClient client         = Mocks.GetMockedMGClient(httpClient: httpMock);
            var      payoutRequest  = new MGPayoutRequest
            {
                MerchantOrderID           = "Q44mHY18",
                CustomerBankCode          = "BBL",
                OrderAmount               = "100.00",
                CustomerBankAccountNumber = "1234567",
                CustomerBankAccountName   = "Don Jhoe",
                CustomerEmail             = "*****@*****.**",
                CustomerBankBranch        = "bankBranch",
                CustomerBankProvince      = "province",
                CustomerBankArea          = "bankArea",
                CustomerBankRoutingNumber = "000",
                OrderCurrency             = "USD",
                MerchantOrderDesc         = "desc",
                CustomerFirstName         = "John",
                CustomerLastName          = "Doe",
                CustomerBankAddress       = "The Moon, hill 42",
                CustomerBankZipCode       = "1303",
                CustomerPhone             = "123",
                CustomerIP  = "127.0.0.1",
                RedirectUrl = "https://example-merchant.com/payment/return",
                CheckoutUrl = "https://example-merchant.com/deposit",
                CallbackUrl = "https://example-merchant.com/callback",
            };

            // Act
            MGPayoutResult actual = client.InitPayout(payoutRequest).Result;

            // Assert
            Assert.IsTrue(actual.IsSuccess);
            Assert.AreEqual(expectedResult.Code, actual.Code);
            Assert.AreEqual(expectedResult.Message, actual.Message);
            Assert.AreEqual(expectedResult.Data.orderID, actual.Data.orderID);
            Assert.AreEqual(expectedResult.Data.merchantOrderID, actual.Data.merchantOrderID);
        }
Exemplo n.º 2
0
        public static void PayoutExample(MGClient client)
        {
            // Assemble payout order data
            MGPayoutRequest payoutRequest = new MGPayoutRequest
            {
                MerchantOrderID           = "Q44mHY18",
                CustomerBankCode          = "BBL",
                OrderAmount               = "100.00",
                CustomerBankAccountNumber = "1234567",
                CustomerBankAccountName   = "Don Jhoe",
                CustomerEmail             = "*****@*****.**",
                CustomerBankBranch        = "bankBranch",
                CustomerBankProvince      = "province",
                CustomerBankArea          = "bankArea",
                CustomerBankRoutingNumber = "000",
                OrderCurrency             = "USD",
                MerchantOrderDesc         = "desc",
                CustomerFirstName         = "John",
                CustomerLastName          = "Doe",
                CustomerBankAddress       = "The Moon, hill 42",
                CustomerBankZipCode       = "1303",
                CustomerPhone             = "123",
                CustomerIP  = "127.0.0.1",
                RedirectUrl = "https://example-merchant.com/payment/return",
                CheckoutUrl = "https://example-merchant.com/deposit",
                CallbackUrl = "https://ens39ypv7jld8.x.pipedream.net",
            };

            // Initiate deposit order request
            MGPayoutResult resp = client.InitPayout(payoutRequest).Result;

            // Check the request status
            if (!resp.IsSuccess)
            {
                // handle unsuccessful request
                string reasonForFailure = resp.Message;
                // ...
                return;
            }

            // Capture ZotaPay order id
            string zotapayOrderId = resp.Data.orderID;

            Console.WriteLine(zotapayOrderId);
        }