public function setUp()
 {
     $this->_payloadStub = $this->getMock(self::PAYMENT_PAYLOAD_CLASS);
     $paymentIterable = $this->getMock(self::PAYMENT_ITERABLE_CLASS);
     $paymentIterable->expects($this->any())->method('getEmptyStoredValueCardPayment')->will($this->returnValue($this->_payloadStub));
     $this->_paymentContainer = $this->getMock(self::PAYMENT_CONTAINER_CLASS);
     $this->_paymentContainer->expects($this->any())->method('getPayments')->will($this->returnValue($paymentIterable));
     $this->_giftcardStub = $this->getModelMock('ebayenterprise_giftcard/giftcard');
     $this->_giftcardContainerStub = $this->getModelMock('ebayenterprise_giftcard/container', ['getRedeemedGiftCards']);
     $this->_giftcardContainerStub->expects($this->any())->method('getRedeemedGiftCards')->will($this->returnValue(array($this->_giftcardStub)));
     $this->_orderStub = $this->getModelMock('sales/order');
 }
 public function setUp()
 {
     $this->_payloadStub = $this->getMock(self::PAYMENT_PAYLOAD_CLASS);
     $paymentIterable = $this->getMock(self::PAYMENT_ITERABLE_CLASS);
     $paymentIterable->expects($this->any())->method('getEmptyCreditCardPayment')->will($this->returnValue($this->_payloadStub));
     $this->_paymentContainer = $this->getMock(self::PAYMENT_CONTAINER_CLASS);
     $this->_paymentContainer->expects($this->any())->method('getPayments')->will($this->returnValue($paymentIterable));
     $methodCode = Mage::getModel('ebayenterprise_creditcard/method_ccpayment')->getCode();
     $this->_paymentStub = $this->getModelMock('sales/order_payment', ['getId', 'getCcNumberEnc', 'decrypt']);
     $this->_paymentStub->setMethod($methodCode)->setCreatedAt('2012-01-01 00:00:00')->setCcExpYear(2020)->setCcExpMonth(1)->setAdditionalInformation('start_date', '2012-01-01 00:00:00');
     $this->_orderStub = $this->getModelMock('sales/order', ['getAllPayments']);
     $this->_orderStub->expects($this->once())->method('getAllPayments')->will($this->returnValue([$this->_paymentStub]));
 }
 public function setUp()
 {
     $this->_payloadStub = $this->getMock(self::PAYMENT_PAYLOAD_CLASS);
     $paymentIterable = $this->getMock(self::PAYMENT_ITERABLE_CLASS);
     $paymentIterable->expects($this->any())->method('getEmptyPayPalPayment')->will($this->returnValue($this->_payloadStub));
     $this->_paymentContainer = $this->getMock(self::PAYMENT_CONTAINER_CLASS);
     $this->_paymentContainer->expects($this->any())->method('getPayments')->will($this->returnValue($paymentIterable));
     $payment1 = $this->getModelMock('sales/order_payment', ['getId']);
     $payment1->expects($this->any())->method('getId')->will($this->returnValue(1));
     $payment1->setCreatedAt('2012-01-01 00:00:00')->setMethod(Mage::getModel('ebayenterprise_paypal/method_express')->getCode());
     $payment2 = $this->getModelMock('sales/order_payment', ['getId']);
     $payment2->expects($this->any())->method('getId')->will($this->returnValue(2));
     $payment2->setMethod('non-paypal');
     $this->_paymentStubs[] = $payment1;
     $this->_paymentStubs[] = $payment2;
     $this->_orderStub = $this->getModelMock('sales/order', ['getAllPayments']);
     $this->_orderStub->expects($this->once())->method('getAllPayments')->will($this->returnValue($this->_paymentStubs));
 }
 public function setUp()
 {
     $this->_processedPayments = new SplObjectStorage();
     $this->_payloadStub = $this->getMock(self::PAYMENT_PAYLOAD_CLASS);
     $paymentIterable = $this->getMock(self::PAYMENT_ITERABLE_CLASS);
     $paymentIterable->expects($this->any())->method('getEmptyPrepaidCreditCardPayment')->will($this->returnValue($this->_payloadStub));
     $this->_paymentContainer = $this->getMock(self::PAYMENT_CONTAINER_CLASS);
     $this->_paymentContainer->expects($this->any())->method('getPayments')->will($this->returnValue($paymentIterable));
     $paymentMethod = $this->getModelMock('payment/method_abstract', ['getCode']);
     $paymentMethod->expects($this->any())->method('getCode')->will($this->returnValue('abstractPaymentMethodStub'));
     $plainPayment = $this->getModelMock('sales/order_payment', ['getId', 'getMethod']);
     $plainPayment->expects($this->any())->method('getId')->will($this->returnValue(1));
     $plainPayment->expects($this->any())->method('getMethod')->will($this->returnValue($paymentMethod));
     $discoverCardPayment = $this->getModelMock('sales/order_payment', ['getId', 'getCcType', 'getMethod']);
     $discoverCardPayment->expects($this->any())->method('getId')->will($this->returnValue(2));
     $discoverCardPayment->expects($this->any())->method('getCcType')->will($this->returnValue('DC'));
     $discoverCardPayment->expects($this->any())->method('getMethod')->will($this->returnValue($paymentMethod));
     $freePayment = $this->getModelMock('sales/order_payment', ['getId', 'getMethod']);
     $freePayment->expects($this->any())->method('getId')->will($this->returnValue(3));
     $freePayment->expects($this->any())->method('getMethod')->will($this->returnValue(Mage::getModel('payment/method_free')->getCode()));
     $this->_paymentStubs = [$plainPayment, $discoverCardPayment, $freePayment];
     $this->_orderStub = $this->getModelMock('sales/order', ['getAllPayments']);
 }