Exemplo n.º 1
0
 /**
  * @test
  */
 public function shouldAllowCreatePaymentWithStandardActionsAdded()
 {
     $apiMock = $this->createApiMock();
     $payment = PaymentFactory::create($apiMock);
     $this->assertInstanceOf('Payum\\Core\\Payment', $payment);
     $this->assertAttributeCount(1, 'apis', $payment);
     $actions = $this->readAttribute($payment, 'actions');
     $this->assertInternalType('array', $actions);
     $this->assertNotEmpty($actions);
 }
Exemplo n.º 2
0
    /**
     * @test
     *
     * @expectedException \Payum\Core\Exception\LogicException
     * @expectedExceptionMessage The username, password, signature fields are required.
     */
    public function shouldThrowIfRequiredOptionsNotPassed()
    {
        $factory = new PaymentFactory();

        $factory->create();
    }
Exemplo n.º 3
0
 /**
  * @test
  * 
  * @depends createBillingAgrement
  */
 public function createRecurringPaymnt($captureBillingAgreement)
 {
     $payment = PaymentFactory::create(new Api(new Curl(), array('username' => 'a_username', 'password' => 'a_pasword', 'signature' => 'a_signature', 'sandbox' => true)));
     //@testo:start
     //@testo:source
     //@testo:uncomment:use Payum\Paypal\ExpressCheckout\Nvp\Api;
     //@testo:uncomment:use Payum\Paypal\ExpressCheckout\Nvp\Request\Api\CreateRecurringPaymentProfileRequest;
     //@testo:uncomment:use Payum\Core\Request\SyncRequest;
     $billingAgreementDetails = $captureBillingAgreement->getModel();
     $recurringPaymentDetails = new \ArrayObject(array('TOKEN' => $billingAgreementDetails['TOKEN'], 'PROFILESTARTDATE' => date(DATE_ATOM), 'DESC' => $billingAgreementDetails['L_BILLINGAGREEMENTDESCRIPTION0'], 'AMT' => 1.45, 'CURRENCYCODE' => 'USD', 'BILLINGPERIOD' => Api::BILLINGPERIOD_DAY, 'BILLINGFREQUENCY' => 2));
     //@testo:end
     $recurringPaymentDetails['PROFILEID'] = 'aProfileid';
     //@testo:start
     $payment->execute(new CreateRecurringPaymentProfileRequest($recurringPaymentDetails));
     $payment->execute(new SyncRequest($recurringPaymentDetails));
     $recurringPaymentStatus = new BinaryMaskStatusRequest($recurringPaymentDetails);
     $payment->execute($recurringPaymentStatus);
     if ($recurringPaymentStatus->isSuccess()) {
         //@testo:uncomment:echo 'We are done';
     }
     //@testo:uncomment:echo "Hmm. We are not. Let's check other possible statuses!";
     //@testo:end
     $this->assertTrue($recurringPaymentStatus->isFailed());
 }