Example #1
0
 /**
  * @param Payment $payment
  * @return Payment
  */
 public function signPayment(Payment $payment)
 {
     $payment->setSkinCode($this->context->getSkinCode());
     $payment->setMerchantAccount($this->context->getMerchantAccount());
     if ($this->context->isGaTrackingEnabled()) {
         $payment = GaTracking::addTrackingParameters($payment);
     }
     // sign shopper if is not null
     $shopper = $payment->getShopper();
     if ($shopper) {
         $signedShopper = $this->signShopper($shopper);
         $payment->setShopper($signedShopper);
     }
     // sign delivery address if is not null
     $deliveryAddress = $payment->getDeliveryAddress();
     if ($deliveryAddress) {
         $deliveryAddress = $this->signAddress($deliveryAddress);
         $payment->setDeliveryAddress($deliveryAddress);
     }
     // sign billing address if is not null
     $billingAddress = $payment->getBillingAddress();
     if ($billingAddress) {
         $billingAddress = $this->signAddress($billingAddress);
         $payment->setBillingAddress($billingAddress);
     }
     $signature = $this->context->getSignaturesGenerator()->generatePaymentSignature($payment);
     $payment->sign($signature);
     return $payment;
 }
Example #2
0
 /**
  * @param Payment $payment
  * @return Payment
  */
 public static function addTrackingParameters(Payment $payment)
 {
     $resURL = $payment->getResURL();
     $url = new Url($resURL);
     $url->setQueryParameter('utm_nooverride', 1);
     $payment->setResURL($url->getAbsoluteUrl());
     return $payment;
 }
Example #3
0
 /**
  * Set specific payment properties
  *
  * @param Payment $payment
  * @return void
  */
 public function initializePayment(Payment $payment)
 {
     $payment->setMerchantReference('12345678');
     $payment->setPaymentAmount(10000);
     $today = new DateTime();
     $shipDate = $today->modifyClone('+ 10 days');
     $payment->setShipBeforeDate($shipDate);
     $sessionValidity = $today->modifyClone('+ 30 minutes');
     $payment->setSessionValidity($sessionValidity);
 }
Example #4
0
 /**
  * Set specific payment properties
  *
  * @param Payment $payment
  * @return void
  */
 function initializePayment(Payment $payment)
 {
     $payment->setMerchantReference($this->merchantReference);
     $payment->setCurrencyCode($this->currencyCode);
     $payment->setPaymentAmount($this->paymentAmount);
     $payment->setSessionValidity($this->sessionValidity);
     $payment->setShipBeforeDate($this->shipBeforeDate);
 }
Example #5
0
 /**
  * @param Payment $payment
  *
  * @return string
  */
 public function generatePaymentSignature(Payment $payment)
 {
     $values = $payment->getSignatureValues();
     $values = $this->filterValues($values);
     return $this->generateSignature($values);
 }
Example #6
0
 private function setReturnUrl(Payment $payment)
 {
     $payment->setResURL($this->link('//return!'));
 }