public static IServiceCollection RegisterAppleReceiptVerificator(this IServiceCollection services, Action <AppleReceiptVerificationSettings>?configureOptions = null) { services.RegisterAppleReceiptParser(); if (configureOptions != null) { services.Configure(configureOptions); } var verificationSettings = new AppleReceiptVerificationSettings(); var appleProductionUrl = verificationSettings.ProductionUrl; var appleSandboxUrl = verificationSettings.SandboxUrl; services.AddRefitClient <IProductionRestService>() .ConfigureHttpClient((serviceProvider, httpClient) => httpClient.BaseAddress = new Uri(appleProductionUrl)); services.AddRefitClient <ISandboxRestService>() .ConfigureHttpClient((serviceProvider, httpClient) => httpClient.BaseAddress = new Uri(appleSandboxUrl)); services.AddRefitClient <IRestService>() .ConfigureHttpClient((serviceProvider, httpClient) => httpClient.BaseAddress = new Uri( serviceProvider.GetRequiredService <IOptions <AppleReceiptVerificationSettings> >() .Value.VerifyUrl)); services.TryAddScoped <IAppleReceiptVerificatorService, AppleReceiptVerificatorService>(); return(services); }
public AppleReceiptVerificatorService(IRestService restService, ILogger log, IAppleReceiptParserService receiptParserService, AppleReceiptVerificationSettings settings, IAppleReceiptCustomVerificatorService customValidation) { _restService = restService; _log = log; _receiptParserService = receiptParserService; _settings = settings; _customValidation = customValidation; }
public void TestFixtureSetUp() { ContainerBuilder containerBuilder = new ContainerBuilder(); containerBuilder.RegisterType <AppleReceiptCustomVerificatorService>() .As <IAppleReceiptCustomVerificatorService>(); AppleReceiptVerificationSettings settings = new AppleReceiptVerificationSettings("XXXX", AppleReceiptVerificationType.Sandbox, new[] { "com.mbaasy.ios.demo" }, new LoggerConfiguration(), true); AppleReceiptVerificatorModule module = new AppleReceiptVerificatorModule(settings); containerBuilder.RegisterModule(module); _container = containerBuilder.Build(ContainerBuildOptions.IgnoreStartableComponents); }
internal void Apply(AppleReceiptVerificationSettings @that) { @that.VerifyReceiptSharedSecret = SharedSecret; @that.VerificationType = Environment.ToVerificationType(); @that.AllowedBundleIds = new[] { PackageName }; }
public AppleReceiptVerificatorModule(AppleReceiptVerificationSettings settings) { _settings = settings; }