예제 #1
1
파일: Paypal.php 프로젝트: pckg/payment
 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();
 }
예제 #2
0
 /**
  * Test the Parameterize function of the model
  * @test
  * @depends setGetTest
  */
 public function parameterizeTest(Request\Checksum $model)
 {
     $parameterArray = array();
     $parameterArray['checksum_type'] = 'postfinance_card';
     $parameterArray['amount'] = '200';
     $parameterArray['currency'] = 'CHF';
     $parameterArray['description'] = 'foo bar';
     $creationArray = $model->parameterize("getOne");
     $this->assertEquals($creationArray, $parameterArray);
 }
예제 #3
0
 /**
  * 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();
 }
예제 #4
0
 /**
  * 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();
 }
예제 #5
0
 /**
  * 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();
 }
예제 #6
0
 /**
  * Test the Parameterize function of the model
  *
  * @param Checksum $model
  *
  * @test
  * @depends setGetTest
  */
 public function parameterizeTestCreate(Checksum $model)
 {
     $parameterArray = array();
     $parameterArray['checksum_type'] = Checksum::TYPE_PAYPAL;
     $parameterArray['amount'] = '200';
     $parameterArray['currency'] = 'EUR';
     $parameterArray['description'] = 'foo bar';
     $parameterArray['return_url'] = 'https://www.example.com';
     $parameterArray['cancel_url'] = 'https://www.example.com';
     $parameterArray['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');
     $parameterArray['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');
     $parameterArray['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));
     $parameterArray['shipping_amount'] = '50';
     $parameterArray['handling_amount'] = '50';
     $creationArray = $model->parameterize("create");
     $this->assertEquals($creationArray, $parameterArray);
 }