PayU integration by Krzysztof Gzocha
  • Namespace
  • Class

Namespaces

  • Team3
    • PayU
      • Annotation
      • Communication
        • CurlRequestBuilder
        • HttpStatusParser
        • Notification
        • Process
          • NotificationProcess
          • ResponseDeserializer
        • Request
          • Model
        • Response
          • Model
        • Sender
      • Configuration
        • Credentials
      • Order
        • Autocomplete
          • Strategy
        • Model
          • Buyer
          • Money
          • Products
          • ShippingMethods
          • Traits
        • Transformer
          • UserOrder
            • Strategy
              • Product
              • ShippingMethod
      • PropertyExtractor
        • Reader
      • Serializer
      • SignatureCalculator
        • Encoder
          • Algorithms
          • Strategy
        • ParametersSorter
        • Validator
      • ValidatorBuilder

Classes

  • Team3\PayU\ValidatorBuilder\ValidatorBuilder

Interfaces

  • Team3\PayU\ValidatorBuilder\ValidatorBuilderInterface
 1 <?php
 2 /**
 3  * @author Krzysztof Gzocha <krzysztof.gzocha@xsolve.pl>
 4  */
 5 namespace Team3\PayU\SignatureCalculator\Encoder\Strategy;
 6 
 7 use Team3\PayU\SignatureCalculator\Encoder\Algorithms\AlgorithmInterface;
 8 use Team3\PayU\SignatureCalculator\Encoder\Algorithms\Sha256Algorithm;
 9 use Team3\PayU\SignatureCalculator\Encoder\EncoderException;
10 
11 class Sha256Strategy implements EncoderStrategyInterface
12 {
13     /**
14      * @param AlgorithmInterface $algorithm
15      *
16      * @return bool
17      */
18     public function supports(AlgorithmInterface $algorithm)
19     {
20         return $algorithm instanceof Sha256Algorithm;
21     }
22 
23     /**
24      * @param string $data
25      *
26      * @return string
27      * @throws EncoderException
28      */
29     public function encode($data)
30     {
31         if (!function_exists('hash')) {
32             throw new EncoderException(
33                 'There is no hash function defined. Could not encode data.'
34             );
35         }
36 
37         return hash('sha256', $data);
38     }
39 }
40 
PayU integration by Krzysztof Gzocha API documentation generated by ApiGen