예제 #1
0
 public SchibstedPaymentMethodService(SchibstedPageBuilder pageBuilder, SchibstedSha256Computer sha256Computer, ILoggingService loggingService, IAbsoluteUrlService absoluteUrlService)
 {
     _absoluteUrlService = absoluteUrlService;
     PageBuilder         = pageBuilder;
     Sha256Computer      = sha256Computer;
     LoggingService      = loggingService;
 }
예제 #2
0
 public SchibstedPageBuilder(SchibstedSha256Computer sha256Computer, ILoggingService loggingService, IAbsoluteUrlService absoluteUrlService, ICallbackUrl callbackUrl)
 {
     _absoluteUrlService = absoluteUrlService;
     _callbackUrl        = callbackUrl;
     Sha256Computer      = sha256Computer;
     LoggingService      = loggingService;
     LocalizationContext = new CustomGlobalization();
 }
예제 #3
0
 public SchibstedRecurringPaymentMethodService(
     SchibstedPageBuilder pageBuilder,
     SchibstedSha256Computer sha256Computer,
     ILoggingService loggingService,
     IAbsoluteUrlService absoluteUrlService) : base(pageBuilder, sha256Computer, loggingService, absoluteUrlService)
 {
     _absoluteUrlService = absoluteUrlService;
 }
예제 #4
0
        public SppCallbackContainer DecodeSignedRequest(string signedRequest, string signatureSecret)
        {
            var requestArr = signedRequest.Split('.');
            var encodedSig = requestArr[0];
            var payload    = requestArr[1];

            var hashComputer = new SchibstedSha256Computer();
            var expectedSig  = hashComputer.ComputeHash(payload, signatureSecret, true);

            var data = Base64UrlDecode(payload);

            if (expectedSig != encodedSig)
            {
                throw new SecurityException("Checksum verification failed");
            }

            var jsonSerializer = new DataContractJsonSerializer(typeof(SppCallbackContainer));
            var ms             = new MemoryStream(Encoding.UTF8.GetBytes(data));

            return(jsonSerializer.ReadObject(ms) as SppCallbackContainer);
        }