Esempio n. 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()
                });
            });
        }
Esempio n. 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;
 }
Esempio n. 4
0
 public CollectionsClient(MomoConfig config) : base(config)
 {
     SubscriptionKey = config.SubscriptionKey;
 }
 public RemittancesClient(MomoConfig config) : base(config)
 {
     SubscriptionKey = config.SubscriptionKey;
 }
Esempio n. 6
0
 internal HttpClientFactory(MomoConfig config)
 {
     _config = config;
 }