예제 #1
0
        internal BaseApi(MomoConfig config)
        {
            ValidateConfig(config);
            _config = config;
            Client  = new HttpClientFactory(_config).GetClient();

            Client.Configure(settings =>
            {
                settings.BeforeCallAsync = BeforeCallAsync;
                settings.OnErrorAsync    = ThrowMomoErrorInstead;
                settings.JsonSerializer  = new NewtonsoftJsonSerializer(new JsonSerializerSettings
                {
                    ContractResolver = new CamelCasePropertyNamesContractResolver()
                });
            });
        }
예제 #2
0
        private void ValidateConfig(MomoConfig config)
        {
            if (string.IsNullOrEmpty(config.SubscriptionKey))
            {
                throw new ArgumentException("The subscription key cannot be null");
            }

            if (string.IsNullOrEmpty(config.UserId))
            {
                throw new ArgumentException("The user id cannot be null");
            }

            if (string.IsNullOrEmpty(config.UserSecret))
            {
                throw new ArgumentException("The user secret cannot be null");
            }
        }
 public DisbursementsClient(MomoConfig config) : base(config)
 {
     SubscriptionKey = config.SubscriptionKey;
 }
예제 #4
0
 public CollectionsClient(MomoConfig config) : base(config)
 {
     SubscriptionKey = config.SubscriptionKey;
 }
예제 #5
0
 public RemittancesClient(MomoConfig config) : base(config)
 {
     SubscriptionKey = config.SubscriptionKey;
 }
예제 #6
0
 internal HttpClientFactory(MomoConfig config)
 {
     _config = config;
 }