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