Example #1
0
 /**
  * @param Order $order
  * @return Payment
  */
 protected function createPayment(Order $order)
 {
     /** @var $payment Payment */
     $payment = $this->registry->getStorage(Payment::class)->create();
     $payment->setNumber($order->getId()->getValue());
     $payment->setCurrencyCode($this->currency);
     $payment->setTotalAmount($order->getTotal()->getAmount());
     $payment->setClientId($order->getCustomer()->getId()->getValue());
     $payment->setClientEmail($order->getCustomer()->getEmail());
     $payment->setDescription('Payment for order #' . $order->getId()->getValue());
     return $payment;
 }
 /**
  * @test
  */
 public function shouldReturnStorageSetToContainer()
 {
     $gateways = array();
     $storages = array('stdClass' => 'fooStorageServiceId');
     $container = new Container();
     $container->set('fooStorageServiceId', $this->getMock('Payum\\Core\\Storage\\StorageInterface'));
     $registry = new ContainerAwareRegistry($gateways, $storages);
     $registry->setContainer($container);
     $this->assertSame($container->get('fooStorageServiceId'), $registry->getStorage('stdClass'));
 }