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\Order\Transformer\UserOrder\Strategy;
 6 
 7 use Team3\PayU\Order\Model\OrderInterface;
 8 use Team3\PayU\Order\Transformer\UserOrder\TransformerProperties;
 9 use Team3\PayU\Order\Transformer\UserOrder\TransformerPropertiesRegExp;
10 use Team3\PayU\PropertyExtractor\ExtractorResult;
11 
12 class UrlsTransformer implements UserOrderTransformerStrategyInterface
13 {
14     /**
15      * @inheritdoc
16      */
17     public function transform(
18         OrderInterface $order,
19         ExtractorResult $extractorResult
20     ) {
21         $this->copyValue(
22             $order,
23             $extractorResult
24         );
25     }
26 
27     /**
28      * @inheritdoc
29      */
30     public function supports($propertyName)
31     {
32         return 1 === preg_match(
33             TransformerPropertiesRegExp::URL_REGEXP,
34             $propertyName
35         );
36     }
37 
38     /**
39      * @param OrderInterface  $order
40      * @param ExtractorResult $extractorResult
41      */
42     private function copyValue(
43         OrderInterface $order,
44         ExtractorResult $extractorResult
45     ) {
46         switch ($extractorResult->getPropertyName()) {
47             case TransformerProperties::URLS_NOTIFY:
48                 $order->setNotifyUrl($extractorResult->getValue());
49                 break;
50             case TransformerProperties::URLS_CONTINUE:
51                 $order->setContinueUrl($extractorResult->getValue());
52                 break;
53             case TransformerProperties::URLS_ORDER:
54                 $order->setOrderUrl($extractorResult->getValue());
55                 break;
56             default:
57         }
58     }
59 }
60 
PayU integration by Krzysztof Gzocha API documentation generated by ApiGen