public function testSetterGetterWithValidData()
 {
     $billpayPayInitParameter = new BillpayPayInitParameter();
     $billpayPayInitParameter->setLegalform(self::LEGALFORM)->setAddressAddition(self::ADDRESSADDITION)->setDateofBirth(self::DATEOFBIRTH)->setDeliveryGender(self::DELIVERY_GENDER)->setDeliveryFirstname(self::DELIVERY_FIRSTNAME)->setDeliveryLastname(self::DELIVERY_LASTNAME)->setDeliveryStreet(self::DELIVERY_STREET)->setDeliveryAddressAddition(self::DELIVERY_ADDRESSADDITION)->setDeliveryZip(self::DELIVERY_ZIP)->setDeliveryCity(self::DELIVERY_CITY)->setDeliveryCountry(self::DELIVERY_COUNTRY)->setDeliveryPhone(self::DELIVERY_PHONE);
     $this->assertEquals(self::LEGALFORM, $billpayPayInitParameter->getLegalform());
     $this->assertEquals(self::ADDRESSADDITION, $billpayPayInitParameter->getAddressAddition());
     $this->assertEquals(self::DATEOFBIRTH, $billpayPayInitParameter->getDateofBirth());
     $this->assertEquals(self::DELIVERY_GENDER, $billpayPayInitParameter->getDeliveryGender());
     $this->assertEquals(self::DELIVERY_FIRSTNAME, $billpayPayInitParameter->getDeliveryFirstname());
     $this->assertEquals(self::DELIVERY_LASTNAME, $billpayPayInitParameter->getDeliveryLastname());
     $this->assertEquals(self::DELIVERY_STREET, $billpayPayInitParameter->getDeliveryStreet());
     $this->assertEquals(self::DELIVERY_ADDRESSADDITION, $billpayPayInitParameter->getDeliveryAddressAddition());
     $this->assertEquals(self::DELIVERY_ZIP, $billpayPayInitParameter->getDeliveryZip());
     $this->assertEquals(self::DELIVERY_CITY, $billpayPayInitParameter->getDeliveryCity());
     $this->assertEquals(self::DELIVERY_COUNTRY, $billpayPayInitParameter->getDeliveryCountry());
     $this->assertEquals(self::DELIVERY_PHONE, $billpayPayInitParameter->getDeliveryPhone());
     $this->assertCount(0, $billpayPayInitParameter->getInvalidData());
 }
Exemplo n.º 2
0
 public function testCreatePayInit()
 {
     $saferpay = new Saferpay();
     $saferpay->setHttpClient(new BuzzClient());
     $payInitParameter = new PayInitParameter();
     $payInitParameter->setAccountid('99867-94913159');
     $payInitParameter->setAmount(1200);
     $payInitParameter->setCurrency('CHF');
     $payInitParameter->setDescription(sprintf('Ordernumber: %s', '000001'));
     $payInitParameter->setOrderid(1);
     $payInitParameter->setSuccesslink('http://test.lo?status=success');
     $payInitParameter->setFaillink('http://test.lo?status=fail');
     $payInitParameter->setBacklink('http://test.lo?status=back');
     $payInitParameter->setProviderset(array(BillpayPayInitParameterInterface::PROVIDERSET_BILLPAY_INVOICE));
     $payInitParameter->setGender(PayInitParameterInterface::GENDER_COMPANY);
     $payInitParameter->setFirstname('John');
     $payInitParameter->setLastname('Doe');
     $payInitParameter->setStreet('Samplestreet 0');
     $payInitParameter->setZip('00000');
     $payInitParameter->setCity('Samplecity');
     $payInitParameter->setCountry('US');
     $payInitParameter->setLangid('EN');
     $payInitParameter->setPhone('+10000000000');
     $payInitParameter->setEmail('*****@*****.**');
     $billpayPayInitParameter = new BillpayPayInitParameter();
     $billpayPayInitParameter->setLegalform(BillpayPayInitParameterInterface::LEGALFORM_MISC);
     $billpayPayInitParameter->setDeliveryGender(PayInitParameterInterface::GENDER_COMPANY);
     $billpayPayInitParameter->setDeliveryFirstname('John');
     $billpayPayInitParameter->setDeliveryLastname('Doe');
     $billpayPayInitParameter->setDeliveryStreet('Samplestreet 0');
     $billpayPayInitParameter->setDeliveryZip('00000');
     $billpayPayInitParameter->setDeliveryCity('Samplecity');
     $billpayPayInitParameter->setDeliveryCountry('US');
     $billpayPayInitParameter->setDeliveryPhone('+10000000000');
     $payInitParameterCollection = new Collection($payInitParameter->getRequestUrl());
     $payInitParameterCollection->addCollectionItem($payInitParameter);
     $payInitParameterCollection->addCollectionItem($billpayPayInitParameter);
     $url = $saferpay->createPayInit($payInitParameterCollection);
     $this->assertStringStartsWith('https://www.saferpay.com/vt2/Pay.aspx', $url);
 }