Exemple #1
0
        public void TestParse()
        {
            const string appleAppReceipt =
                "MIIcSAYJKoZIhvcNAQcCoIIcOTCCHDUCAQExCzAJBgUrDgMCGgUAMIIL+QYJKoZIhvcNAQcBoIIL6gSCC+YxggviMAoCAQgCAQEEAhYAMAoCARQCAQEEAgwAMAsCAQECAQEEAwIBADALAgEDAgEBBAMMATEwCwIBCwIBAQQDAgEAMAsCAQ4CAQEEAwIBWjALAgEPAgEBBAMCAQAwCwIBEAIBAQQDAgEAMAsCARkCAQEEAwIBAzAMAgEKAgEBBAQWAjQrMA0CAQ0CAQEEBQIDAV+QMA0CARMCAQEEBQwDMS4wMA4CAQkCAQEEBgIEUDIzNDAYAgEEAgECBBDE3UBUsLYaB761hfaoQuBIMBsCAQACAQEEEwwRUHJvZHVjdGlvblNhbmRib3gwHAIBBQIBAQQULgoRW+rBxXAjpb03NJlVqa2Z200wHQIBAgIBAQQVDBNjb20ubWJhYXN5Lmlvcy5kZW1vMB4CAQwCAQEEFhYUMjAxNS0wOC0xM1QwNzo1MDo0NlowHgIBEgIBAQQWFhQyMDEzLTA4LTAxVDA3OjAwOjAwWjBLAgEHAgEBBEPixSwGknvYHA7GNo11ue/NJtHjgD6PTlcYOBGS4D+bAG3hIUBsvRx0RDoaF7CUW1XeUoKFE/jqIHH5AzsHl3pS/WYgMGECAQYCAQEEWRhf33g2yaZFPTmP34+a61oc/n3P7iVoZOuazq1x1u1JXgIDY2hJpxZU4y6o5FBZ8JZC+6uvjOlYYiOd9QfeqHBV4YwCU5Mbd5L2aJji1yJYTDmqHEroWyJ4MIIBTwIBEQIBAQSCAUUxggFBMAsCAgasAgEBBAIWADALAgIGrQIBAQQCDAAwCwICBrACAQEEAhYAMAsCAgayAgEBBAIMADALAgIGswIBAQQCDAAwCwICBrQCAQEEAgwAMAsCAga1AgEBBAIMADALAgIGtgIBAQQCDAAwDAICBqUCAQEEAwIBATAMAgIGqwIBAQQDAgEBMAwCAgauAgEBBAMCAQAwDAICBq8CAQEEAwIB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LpBfGdL2I3ymDFJWiQbCuuNRa/PfGBFpMc0PGSqyQ0C5GFULTDVU=";

            byte[] data = Convert.FromBase64String(appleAppReceipt);
            IAppleReceiptParserService parserService = _container.Resolve <IAppleReceiptParserService>();
            AppleAppReceipt            receipt       = parserService.GetAppleReceiptFromBytes(data);

            if (receipt != null)
            {
                Assert.AreEqual(receipt.ApplicationVersion, "1");
                Assert.AreEqual(receipt.OriginalApplicationVersion, "1.0");
                Assert.AreEqual(receipt.ReceiptCreationDateDt, new DateTime(2015, 8, 13, 10, 50, 46));
                Assert.AreEqual(receipt.PurchaseReceipts.Count, 7);
                Assert.IsTrue(
                    receipt.PurchaseReceipts.Count(purchaseReceipt => purchaseReceipt.ProductId == "consumable") == 1);
                Assert.AreEqual(
                    receipt.PurchaseReceipts
                    .FirstOrDefault(appleInAppPurchaseReceipt => appleInAppPurchaseReceipt.ProductId == "monthly")
                    ?.OriginalTransactionId, "1000000166965150");
                Assert.AreEqual(receipt.BundleId, "com.mbaasy.ios.demo");
            }
            else
            {
                throw new Exception("Not parsed");
            }
        }
 public AppleReceiptLibrariesExamplesController(AppConfig config,
                                                IAppleReceiptVerificatorService appleVerificationService,
                                                IAppleReceiptParserService appleParserService)
 {
     _config = config;
     _appleVerificationService = appleVerificationService;
     _appleParserService       = appleParserService;
 }
Exemple #3
0
 public AppleReceiptVerificatorService(IRestService restService, ILogger log,
                                       IAppleReceiptParserService receiptParserService,
                                       AppleReceiptVerificationSettings settings,
                                       IAppleReceiptCustomVerificatorService customValidation)
 {
     _restService          = restService;
     _log                  = log;
     _receiptParserService = receiptParserService;
     _settings             = settings;
     _customValidation     = customValidation;
 }
Exemple #4
0
 public AppleReceiptVerificatorService(
     IRestService restService,
     ILogger <AppleReceiptVerificatorService> logger,
     IAppleReceiptParserService receiptParserService,
     IOptionsSnapshot <AppleReceiptVerificationSettings> settings,
     IAppleReceiptCustomVerificatorService?customValidation = null
     )
 {
     _restService          = restService;
     _logger               = logger;
     _receiptParserService = receiptParserService;
     _settings             = settings;
     _customValidation     = customValidation;
 }
 public AppleReceiptVerificatorService(
     IRestService serviceFromConfiguration,
     IProductionRestService productionService,
     ISandboxRestService sandboxService,
     ILogger <AppleReceiptVerificatorService> logger,
     IAppleReceiptParserService receiptParserService,
     IOptionsSnapshot <AppleReceiptVerificationSettings> settings,
     IAppleReceiptCustomVerificatorService?customValidation = null
     )
 {
     _serviceFromConfiguration = serviceFromConfiguration;
     _productionService        = productionService;
     _sandboxService           = sandboxService;
     _logger = logger;
     _receiptParserService = receiptParserService;
     _settings             = settings;
     _customValidation     = customValidation;
 }
Exemple #6
0
        private static void RegisterServices()
        {
            var services = new ServiceCollection();

            services.RegisterAppleReceiptVerificator(options =>
            {
                options.VerifyReceiptSharedSecret = "EnterYourSharedSecret";
                options.VerificationType          = AppleReceiptVerificationType.Sandbox;
                options.AllowedBundleIds          = new[] { "EnterYourBundleID" };
            });
            services.RegisterAppleReceiptParser();
            using var serviceProvider = services.BuildServiceProvider();

            _parserService = serviceProvider
                             .GetService <IAppleReceiptParserService>();

            _verificatorService = serviceProvider
                                  .GetService <IAppleReceiptVerificatorService>();
        }