Example #1
0
 /**
  * @param LoggerInterface $logger
  *
  * @return EncoderInterface
  */
 public function build(LoggerInterface $logger)
 {
     $encoder = new Encoder($logger);
     foreach ($this->getStrategies() as $strategy) {
         $encoder->addStrategy($strategy);
     }
     return $encoder;
 }
 public function testRealExample()
 {
     $credentials = new TestCredentials();
     $order = $this->getOrder();
     $algorithm = new Md5Algorithm();
     $encoder = new Encoder($this->getLogger());
     $encoder->addStrategy(new Md5Strategy());
     $signatureCalculator = new OrderSignatureCalculator($encoder, $this->getParametersSorter(), $this->getLogger());
     $this->assertEquals('signature=0fcbdfd920b218edd56366966bef2dcc;algorithm=MD5;sender=145227', $signatureCalculator->calculate($order, $credentials, $algorithm));
 }
Example #3
0
 /**
  * @throws EncoderException
  * @expectedException \Team3\PayU\SignatureCalculator\Encoder\EncoderException
  */
 public function testExceptionWhenNoStrategies()
 {
     $encoder = new Encoder($this->getLogger());
     $encoder->encode(self::DATA, new Md5Algorithm());
 }