public function getChecksum() { $checksum = new Checksum(); $checksum->setChecksumType(Checksum::TYPE_PAYPAL)->setAmount($this->getTotalToPay())->setCurrency('EUR')->setDescription('Description')->setReturnUrl($this->getReturnUrl())->setCancelUrl($this->getCancelUrl()); $response = $this->paymill->create($checksum); return $response->getId(); }
/** * Tests the getters and setters of the model * @test */ public function setGetTest() { $sample = array('checksum_type' => 'postfinance_card', 'amount' => '200', 'currency' => 'CHF', 'description' => 'foo bar'); $this->_model->setChecksumType($sample['checksum_type'])->setAmount($sample['amount'])->setCurrency($sample['currency'])->setDescription($sample['description']); $this->assertEquals($this->_model->getChecksumType(), $sample['checksum_type']); $this->assertEquals($this->_model->getAmount(), $sample['amount']); $this->assertEquals($this->_model->getCurrency(), $sample['currency']); $this->assertEquals($this->_model->getDescription(), $sample['description']); return $this->_model; }
/** * Prepares the environment before running a test. */ protected function setUp() { $this->_service = new Request(); $this->_service->setConnectionClass(new Curl(API_TEST_KEY, API_HOST, array(CURLOPT_SSL_VERIFYPEER => SSL_VERIFY_PEER))); $this->_model = new Checksum(); $this->_model->setChecksumType(Checksum::TYPE_PAYPAL); $this->_model->setAmount('200'); $this->_model->setCurrency('EUR'); $this->_model->setDescription('Dummy description'); parent::setUp(); }
/** * Prepares the environment before running a test. */ protected function setUp() { $this->_service = new Request(); $this->_service->setConnectionClass(new Curl(API_TEST_KEY, API_HOST, array(CURLOPT_SSL_VERIFYPEER => SSL_VERIFY_PEER))); $this->_model = new Models\Request\Checksum(); $this->_model->setChecksumType('postfinance_card'); $this->_model->setAmount('200'); $this->_model->setCurrency('CHF'); $this->_model->setDescription('dummy description'); parent::setUp(); }
/** * Prepares the environment before running a test. */ protected function setUp() { $this->_model = new Checksum(); $this->_model->setChecksumType(Checksum::TYPE_PAYPAL); $this->_model->setChecksumAction(Checksum::ACTION_TRANSACTION); $this->_model->setAmount('200'); $this->_model->setCurrency('EUR'); $this->_model->setDescription('Dummy description'); $this->_model->setReturnUrl('http://dummy.url'); $this->_model->setCancelUrl('http://dummy.url'); parent::setUp(); }
/** * Tests the getters and setters of the model * @test */ public function setGetTest() { $sample = array('checksum_type' => Checksum::TYPE_PAYPAL, 'amount' => '200', 'currency' => 'EUR', 'description' => 'foo bar', 'return_url' => 'https://www.example.com', 'cancel_url' => 'https://www.example.com', 'shipping_address' => array('name' => 'Noch ein test', 'street_address' => 'Unit street', 'street_address_additional' => 'uff', 'city' => 'Test city', 'postal_code' => 'BLABLA', 'state' => 'BAVARIA', 'country' => 'DE', 'phone' => '0892353453'), 'billing_address' => array('name' => 'Noch ein test', 'street_address' => 'Unit street', 'street_address_additional' => 'uff', 'city' => 'Test city', 'postal_code' => 'BLABLA', 'state' => 'BAVARIA', 'country' => 'DE', 'phone' => '0892353453'), 'items' => array(array('name' => 'Foo', 'description' => 'Bar', 'item_number' => 'PROD1', 'url' => 'http://www.foo.de', 'amount' => '200', 'quantity' => 1), array('name' => 'Foo', 'description' => 'bock auf testing', 'item_number' => 'PROD2', 'url' => 'http://www.bar.de', 'amount' => '200', 'quantity' => 1)), 'shipping_amount' => '50', 'handling_amount' => '50'); $this->_model->setChecksumType($sample['checksum_type'])->setAmount($sample['amount'])->setCurrency($sample['currency'])->setDescription($sample['description'])->setReturnUrl($sample['return_url'])->setCancelUrl($sample['cancel_url'])->setShippingAddress($sample['shipping_address'])->setBillingAddress($sample['billing_address'])->setItems($sample['items'])->setShippingAmount($sample['shipping_amount'])->setHandlingAmount($sample['handling_amount']); $this->assertEquals($this->_model->getChecksumType(), $sample['checksum_type']); $this->assertEquals($this->_model->getAmount(), $sample['amount']); $this->assertEquals($this->_model->getCurrency(), $sample['currency']); $this->assertEquals($this->_model->getDescription(), $sample['description']); $this->assertEquals($this->_model->getReturnUrl(), $sample['return_url']); $this->assertEquals($this->_model->getCancelUrl(), $sample['cancel_url']); $this->assertEquals($this->_model->getShippingAddress(), $sample['shipping_address']); $this->assertEquals($this->_model->getBillingAddress(), $sample['billing_address']); $this->assertEquals($this->_model->getItems(), $sample['items']); $this->assertEquals($this->_model->getShippingAmount(), $sample['shipping_amount']); $this->assertEquals($this->_model->getHandlingAmount(), $sample['handling_amount']); return $this->_model; }