Inheritance: extends PHPUnit_Framework_TestCase
Exemple #1
1
 public static function createSale()
 {
     $sale = new Sale();
     $sale->setAmount(AmountTest::createAmount());
     $sale->setCreateTime(self::$createTime);
     $sale->setId(self::$id);
     $sale->setParentPayment(self::$parentPayment);
     $sale->setState(self::$state);
     return $sale;
 }
Exemple #2
1
 private function createSale()
 {
     $sale = new Sale();
     $sale->setAmount(AmountTest::createAmount());
     $sale->setCreateTime(self::$createTime);
     $sale->setId(self::$id);
     $sale->setParentPayment(self::$parentPayment);
     $sale->setState(self::$state);
     $this->tFee = new Currency();
     $this->tFee->setCurrency('AUD');
     $this->tFee->setValue('0.10');
     $sale->setTransactionFee($this->tFee);
     return $sale;
 }
Exemple #3
0
 /**
  * @depends testSerializationDeserialization
  * @param Sale $obj
  */
 public function testGetters($obj)
 {
     $this->assertEquals($obj->getId(), "TestSample");
     $this->assertEquals($obj->getPurchaseUnitReferenceId(), "TestSample");
     $this->assertEquals($obj->getAmount(), AmountTest::getObject());
     $this->assertEquals($obj->getPaymentMode(), "TestSample");
     $this->assertEquals($obj->getState(), "TestSample");
     $this->assertEquals($obj->getReasonCode(), "TestSample");
     $this->assertEquals($obj->getProtectionEligibility(), "TestSample");
     $this->assertEquals($obj->getProtectionEligibilityType(), "TestSample");
     $this->assertEquals($obj->getClearingTime(), "TestSample");
     $this->assertEquals($obj->getPaymentHoldStatus(), "TestSample");
     $this->assertEquals($obj->getPaymentHoldReasons(), "TestSample");
     $this->assertEquals($obj->getTransactionFee(), CurrencyTest::getObject());
     $this->assertEquals($obj->getReceivableAmount(), CurrencyTest::getObject());
     $this->assertEquals($obj->getExchangeRate(), "TestSample");
     $this->assertEquals($obj->getFmfDetails(), FmfDetailsTest::getObject());
     $this->assertEquals($obj->getReceiptId(), "TestSample");
     $this->assertEquals($obj->getParentPayment(), "TestSample");
     $this->assertEquals($obj->getProcessorResponse(), ProcessorResponseTest::getObject());
     $this->assertEquals($obj->getBillingAgreementId(), "TestSample");
     $this->assertEquals($obj->getCreateTime(), "TestSample");
     $this->assertEquals($obj->getUpdateTime(), "TestSample");
     $this->assertEquals($obj->getLinks(), LinksTest::getObject());
 }
Exemple #4
0
 /**
  * @depends testSerializationDeserialization
  * @param ExternalFunding $obj
  */
 public function testGetters($obj)
 {
     $this->assertEquals($obj->getReferenceId(), "TestSample");
     $this->assertEquals($obj->getCode(), "TestSample");
     $this->assertEquals($obj->getFundingAccountId(), "TestSample");
     $this->assertEquals($obj->getDisplayText(), "TestSample");
     $this->assertEquals($obj->getAmount(), AmountTest::getObject());
 }
Exemple #5
0
 public function setup()
 {
     $this->captures['partial'] = self::createCapture();
     $capture = self::createCapture();
     $capture->setAmount(AmountTest::createAmount());
     $capture->setLinks(array(LinksTest::createLinks()));
     $this->captures['full'] = $capture;
 }
 /**
  * @depends testSerializationDeserialization
  * @param RefundRequest $obj
  */
 public function testGetters($obj)
 {
     $this->assertEquals($obj->getAmount(), AmountTest::getObject());
     $this->assertEquals($obj->getDescription(), "TestSample");
     $this->assertEquals($obj->getRefundSource(), "TestSample");
     $this->assertEquals($obj->getReason(), "TestSample");
     $this->assertEquals($obj->getInvoiceNumber(), "TestSample");
     $this->assertEquals($obj->getRefundAdvice(), true);
 }
 public static function createTransaction()
 {
     $transaction = new Transaction();
     $transaction->setAmount(AmountTest::createAmount());
     $transaction->setDescription(self::$description);
     $transaction->setItemList(ItemListTest::createItemList());
     $transaction->setPayee(PayeeTest::createPayee());
     $transaction->setRelatedResources(array(RelatedResourcesTest::createRelatedResources()));
     return $transaction;
 }
 public static function createOrder()
 {
     $order = new Order();
     $order->setId(self::$id);
     $order->setCreateTime(self::$createTime);
     $order->setUpdateTime(self::$updateTime);
     $order->setState(self::$state);
     $order->setAmount(AmountTest::createAmount());
     return $order;
 }
Exemple #9
0
 public static function createAuthorization()
 {
     $authorization = new Authorization();
     $authorization->setCreateTime(self::$create_time);
     $authorization->setId(self::$id);
     $authorization->setState(self::$state);
     $authorization->setAmount(AmountTest::createAmount());
     $authorization->setLinks(array(LinksTest::createLinks()));
     return $authorization;
 }
 public static function createRefund()
 {
     $refund = new Refund();
     $refund->setCreateTime(self::$createTime);
     $refund->setAmount(AmountTest::createAmount());
     $refund->setCaptureId(self::$captureId);
     $refund->setId(self::$id);
     $refund->setLinks(array(LinksTest::getObject()));
     $refund->setParentPayment(self::$parentPayment);
     return $refund;
 }
Exemple #11
0
 public static function createRefund()
 {
     $refund = new Refund();
     $refund->setAmount(AmountTest::createAmount());
     $refund->setCapture_id(self::$captureId);
     $refund->setCreate_time(self::$createTime);
     $refund->setDescription(self::$description);
     $refund->setId(self::$id);
     $refund->setLinks(array(LinkTest::createLink()));
     $refund->setParent_payment(self::$parentPayment);
     return $refund;
 }
 /**
  * @depends testSerializationDeserialization
  * @param Capture $obj
  */
 public function testGetters($obj)
 {
     $this->assertEquals($obj->getId(), "TestSample");
     $this->assertEquals($obj->getAmount(), AmountTest::getObject());
     $this->assertEquals($obj->getIsFinalCapture(), true);
     $this->assertEquals($obj->getState(), "TestSample");
     $this->assertEquals($obj->getParentPayment(), "TestSample");
     $this->assertEquals($obj->getTransactionFee(), CurrencyTest::getObject());
     $this->assertEquals($obj->getCreateTime(), "TestSample");
     $this->assertEquals($obj->getUpdateTime(), "TestSample");
     $this->assertEquals($obj->getLinks(), LinksTest::getObject());
 }
Exemple #13
0
 public static function createTransaction()
 {
     $transaction = new Transaction();
     $transaction->setAmount(AmountTest::createAmount());
     $transaction->setDescription(self::$description);
     $transaction->setInvoiceNumber(self::$invoiceNumber);
     $transaction->setCustom(self::$custom);
     $transaction->setSoftDescriptor(self::$softDescriptor);
     $transaction->setItemList(ItemListTest::createItemList());
     $transaction->setPayee(PayeeTest::createPayee());
     $transaction->setRelatedResources(array(RelatedResourcesTest::createRelatedResources()));
     return $transaction;
 }
Exemple #14
0
 /**
  * @depends testSerializationDeserialization
  * @param Refund $obj
  */
 public function testGetters($obj)
 {
     $this->assertEquals($obj->getId(), "TestSample");
     $this->assertEquals($obj->getAmount(), AmountTest::getObject());
     $this->assertEquals($obj->getState(), "TestSample");
     $this->assertEquals($obj->getReason(), "TestSample");
     $this->assertEquals($obj->getSaleId(), "TestSample");
     $this->assertEquals($obj->getCaptureId(), "TestSample");
     $this->assertEquals($obj->getParentPayment(), "TestSample");
     $this->assertEquals($obj->getDescription(), "TestSample");
     $this->assertEquals($obj->getCreateTime(), "TestSample");
     $this->assertEquals($obj->getUpdateTime(), "TestSample");
     $this->assertEquals($obj->getLinks(), LinksTest::getObject());
 }
Exemple #15
0
 /**
  * @depends testSerializationDeserialization
  * @param CartBase $obj
  */
 public function testGetters($obj)
 {
     $this->assertEquals($obj->getAmount(), AmountTest::getObject());
     $this->assertEquals($obj->getPayee(), PayeeTest::getObject());
     $this->assertEquals($obj->getDescription(), "TestSample");
     $this->assertEquals($obj->getNoteToPayee(), "TestSample");
     $this->assertEquals($obj->getCustom(), "TestSample");
     $this->assertEquals($obj->getInvoiceNumber(), "TestSample");
     $this->assertEquals($obj->getSoftDescriptor(), "TestSample");
     $this->assertEquals($obj->getPaymentOptions(), PaymentOptionsTest::getObject());
     $this->assertEquals($obj->getItemList(), ItemListTest::getObject());
     $this->assertEquals($obj->getNotifyUrl(), "http://www.google.com");
     $this->assertEquals($obj->getOrderUrl(), "http://www.google.com");
 }
Exemple #16
0
 public function testOperations()
 {
     $payment = PaymentTest::createNewPayment();
     $payment->create();
     $transactions = $payment->getTransactions();
     $resources = $transactions[0]->getRelated_resources();
     $saleId = $resources[0]->getSale()->getId();
     $sale = Sale::get($saleId);
     $this->assertNotNull($sale);
     $refund = new Refund();
     $refund->setAmount(AmountTest::createAmount());
     $sale->refund($refund);
     $this->setExpectedException('\\InvalidArgumentException');
     $sale->refund(NULL);
 }
 /**
  * @depends testSerializationDeserialization
  * @param Order $obj
  */
 public function testGetters($obj)
 {
     $this->assertEquals($obj->getId(), "TestSample");
     $this->assertEquals($obj->getPurchaseUnitReferenceId(), "TestSample");
     $this->assertEquals($obj->getAmount(), AmountTest::getObject());
     $this->assertEquals($obj->getPaymentMode(), "TestSample");
     $this->assertEquals($obj->getState(), "TestSample");
     $this->assertEquals($obj->getReasonCode(), "TestSample");
     $this->assertEquals($obj->getPendingReason(), "TestSample");
     $this->assertEquals($obj->getProtectionEligibility(), "TestSample");
     $this->assertEquals($obj->getProtectionEligibilityType(), "TestSample");
     $this->assertEquals($obj->getParentPayment(), "TestSample");
     $this->assertEquals($obj->getFmfDetails(), FmfDetailsTest::getObject());
     $this->assertEquals($obj->getCreateTime(), "TestSample");
     $this->assertEquals($obj->getUpdateTime(), "TestSample");
     $this->assertEquals($obj->getLinks(), LinksTest::getObject());
 }
Exemple #18
0
 public static function createNewPayment()
 {
     $payer = new Payer();
     $payer->setPaymentMethod("credit_card");
     $payer->setFundingInstruments(array(FundingInstrumentTest::createFundingInstrument()));
     $transaction = new Transaction();
     $transaction->setAmount(AmountTest::createAmount());
     $transaction->setDescription("This is the payment description.");
     $redirectUrls = new RedirectUrls();
     $redirectUrls->setReturnUrl("http://localhost/return");
     $redirectUrls->setCancelUrl("http://localhost/cancel");
     $payment = new Payment();
     $payment->setIntent("sale");
     $payment->setRedirectUrls($redirectUrls);
     $payment->setPayer($payer);
     $payment->setTransactions(array($transaction));
     return $payment;
 }