Example #1
0
 /**
  * Tests a successful GetSoldItems request of the Afterbuy XML Client
  */
 public function testGetSoldItemsSuccess()
 {
     $this->setMockHandlerForSuccessTest('GetSoldItems/ResponseOnSuccessBuyerInfo.xml');
     $soldItems = $this->client->getSoldItems();
     $this->assertInstanceOf(GetSoldItemsResponse::class, $soldItems);
     $result = $soldItems->getResult();
     $this->assertInstanceOf(GetSoldItemsResult::class, $result);
     $this->assertEmpty($result->getErrors());
     $orders = $result->getOrders();
     $this->assertContainsOnlyInstancesOf(GetSoldItemsOrder::class, $orders);
     $this->assertCount(1, $orders);
     /** @var GetSoldItemsOrder $order */
     $order = reset($orders);
     $this->assertInstanceOf(GetSoldItemsOrder::class, $order);
     $this->assertNull($order->getAdditionalInfo());
     $this->assertNull($order->getPaymentInfo());
     $this->assertNull($order->getShippingInfo());
     $buyerInfo = $order->getBuyerInfo();
     $this->assertInstanceOf(BuyerInfo::class, $buyerInfo);
     $billingAddress = $buyerInfo->getBillingAddress();
     $this->assertInstanceOf(BillingAddress::class, $billingAddress);
     $this->assertEquals(123, $billingAddress->getAfterbuyUserId());
     $this->assertEquals(1234, $billingAddress->getAfterbuyUserIdAlt());
     $this->assertEquals('user id platform', $billingAddress->getUserIdPlatform());
     $this->assertEquals('firstname', $billingAddress->getFirstName());
     $this->assertEquals('lastname', $billingAddress->getLastName());
     $this->assertEquals('title', $billingAddress->getTitle());
     $this->assertEquals('company', $billingAddress->getCompany());
     $this->assertEquals('street', $billingAddress->getStreet());
     $this->assertEquals('street 2', $billingAddress->getStreet2());
     $this->assertEquals('abc123', $billingAddress->getPostalCode());
     $this->assertEquals('state', $billingAddress->getStateOrProvince());
     $this->assertEquals('city', $billingAddress->getCity());
     $this->assertEquals('phone', $billingAddress->getPhone());
     $this->assertEquals('country', $billingAddress->getCountry());
     $this->assertEquals('de', $billingAddress->getCountryIso());
     $this->assertEquals('fax', $billingAddress->getFax());
     $this->assertEquals('*****@*****.**', $billingAddress->getMail());
     $this->assertFalse($billingAddress->isMerchant());
     $this->assertEquals('tax id number', $billingAddress->getTaxIdNumber());
     $shippingAddress = $buyerInfo->getShippingAddress();
     $this->assertInstanceOf(ShippingAddress::class, $shippingAddress);
     $this->assertEquals('firstname2', $shippingAddress->getFirstName());
     $this->assertEquals('lastname2', $shippingAddress->getLastName());
     $this->assertEquals('company2', $shippingAddress->getCompany());
     $this->assertEquals('street2', $shippingAddress->getStreet());
     $this->assertEquals('street 22', $shippingAddress->getStreet2());
     $this->assertEquals('abc1232', $shippingAddress->getPostalCode());
     $this->assertEquals('state2', $shippingAddress->getStateOrProvince());
     $this->assertEquals('city2', $shippingAddress->getCity());
     $this->assertEquals('phone2', $shippingAddress->getPhone());
     $this->assertEquals('country2', $shippingAddress->getCountry());
     $this->assertEquals('es', $shippingAddress->getCountryIso());
 }