diff --git a/php/src/Snagshout/Promote/Client.php b/php/src/Snagshout/Promote/Client.php index 4a77f90..ed8a72c 100644 --- a/php/src/Snagshout/Promote/Client.php +++ b/php/src/Snagshout/Promote/Client.php @@ -158,6 +158,30 @@ public function reviewDeal(int $campaign, \Snagshout\Promote\Model\ReviewFoundRe { return $this->executePsr7Endpoint(new \Snagshout\Promote\Endpoint\ReviewDeal($campaign, $body), $fetch); } + /** + * + * + * @param \Snagshout\Promote\Model\CompleteFacebookOrderRequestBody $body + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|\Psr\Http\Message\ResponseInterface + */ + public function completeFacebookOrder(\Snagshout\Promote\Model\CompleteFacebookOrderRequestBody $body, string $fetch = self::FETCH_OBJECT) + { + return $this->executePsr7Endpoint(new \Snagshout\Promote\Endpoint\CompleteFacebookOrder($body), $fetch); + } + /** + * + * + * @param \Snagshout\Promote\Model\CreateFacebookOrderRequestBody $body + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|\Psr\Http\Message\ResponseInterface + */ + public function createFacebookOrder(\Snagshout\Promote\Model\CreateFacebookOrderRequestBody $body, string $fetch = self::FETCH_OBJECT) + { + return $this->executePsr7Endpoint(new \Snagshout\Promote\Endpoint\CreateFacebookOrder($body), $fetch); + } /** * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * diff --git a/php/src/Snagshout/Promote/Endpoint/CompleteFacebookOrder.php b/php/src/Snagshout/Promote/Endpoint/CompleteFacebookOrder.php new file mode 100644 index 0000000..20f2330 --- /dev/null +++ b/php/src/Snagshout/Promote/Endpoint/CompleteFacebookOrder.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * This file is part of the Merchant package + */ + +namespace Snagshout\Promote\Endpoint; + +class CompleteFacebookOrder extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7HttplugEndpoint +{ + /** + * + * + * @param \Snagshout\Promote\Model\CompleteFacebookOrderRequestBody $body + */ + public function __construct(\Snagshout\Promote\Model\CompleteFacebookOrderRequestBody $body) + { + $this->body = $body; + } + + use \Jane\OpenApiRuntime\Client\Psr7HttplugEndpointTrait; + + public function getMethod() : string + { + return 'PATCH'; + } + public function getUri() : string + { + return '/facebook/order'; + } + public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, \Http\Message\StreamFactory $streamFactory = null) : array + { + return $this->getSerializedBody($serializer); + } + public function getExtraHeaders() : array + { + return ['Accept' => ['application/json']]; + } + /** + * {@inheritdoc} + * + * + */ + protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer) + { + if (204 === $status) { + return null; + } + } +} diff --git a/php/src/Snagshout/Promote/Endpoint/CreateFacebookOrder.php b/php/src/Snagshout/Promote/Endpoint/CreateFacebookOrder.php new file mode 100644 index 0000000..9dde39d --- /dev/null +++ b/php/src/Snagshout/Promote/Endpoint/CreateFacebookOrder.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * This file is part of the Merchant package + */ + +namespace Snagshout\Promote\Endpoint; + +class CreateFacebookOrder extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7HttplugEndpoint +{ + /** + * + * + * @param \Snagshout\Promote\Model\CreateFacebookOrderRequestBody $body + */ + public function __construct(\Snagshout\Promote\Model\CreateFacebookOrderRequestBody $body) + { + $this->body = $body; + } + + use \Jane\OpenApiRuntime\Client\Psr7HttplugEndpointTrait; + + public function getMethod() : string + { + return 'POST'; + } + public function getUri() : string + { + return '/facebook/order'; + } + public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, \Http\Message\StreamFactory $streamFactory = null) : array + { + return $this->getSerializedBody($serializer); + } + public function getExtraHeaders() : array + { + return ['Accept' => ['application/json']]; + } + /** + * {@inheritdoc} + * + * + */ + protected function transformResponseBody(string $body, int $status, \Symfony\Component\Serializer\SerializerInterface $serializer) + { + if (204 === $status) { + return null; + } + } +} diff --git a/php/src/Snagshout/Promote/Endpoint/GetVersion.php b/php/src/Snagshout/Promote/Endpoint/GetVersion.php index 6caca7e..20ffb4c 100644 --- a/php/src/Snagshout/Promote/Endpoint/GetVersion.php +++ b/php/src/Snagshout/Promote/Endpoint/GetVersion.php @@ -13,6 +13,7 @@ class GetVersion extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7HttplugEndpoint { + use \Jane\OpenApiRuntime\Client\Psr7HttplugEndpointTrait; public function getMethod() : string diff --git a/php/src/Snagshout/Promote/Endpoint/IndexDeals.php b/php/src/Snagshout/Promote/Endpoint/IndexDeals.php index 0bd30bb..17306c4 100644 --- a/php/src/Snagshout/Promote/Endpoint/IndexDeals.php +++ b/php/src/Snagshout/Promote/Endpoint/IndexDeals.php @@ -13,6 +13,7 @@ class IndexDeals extends \Jane\OpenApiRuntime\Client\BaseEndpoint implements \Jane\OpenApiRuntime\Client\Psr7HttplugEndpoint { + use \Jane\OpenApiRuntime\Client\Psr7HttplugEndpointTrait; public function getMethod() : string diff --git a/php/src/Snagshout/Promote/Model/CompleteFacebookOrderRequestBody.php b/php/src/Snagshout/Promote/Model/CompleteFacebookOrderRequestBody.php new file mode 100644 index 0000000..d0a8d6e --- /dev/null +++ b/php/src/Snagshout/Promote/Model/CompleteFacebookOrderRequestBody.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * This file is part of the Merchant package + */ + +namespace Snagshout\Promote\Model; + +class CompleteFacebookOrderRequestBody +{ + /** + * The Facebook shopper's email address. + * + * @var string + */ + protected $email; + /** + * The unique Facebook user ID. + * + * @var string + */ + protected $fbUserId; + /** + * The Facebook shopper's email address. + * + * @return string + */ + public function getEmail() : ? string + { + return $this->email; + } + /** + * The Facebook shopper's email address. + * + * @param string $email + * + * @return self + */ + public function setEmail(? string $email) : self + { + $this->email = $email; + + return $this; + } + /** + * The unique Facebook user ID. + * + * @return string + */ + public function getFbUserId() : ? string + { + return $this->fbUserId; + } + /** + * The unique Facebook user ID. + * + * @param string $fbUserId + * + * @return self + */ + public function setFbUserId(? string $fbUserId) : self + { + $this->fbUserId = $fbUserId; + + return $this; + } +} diff --git a/php/src/Snagshout/Promote/Model/CreateFacebookOrderRequestBody.php b/php/src/Snagshout/Promote/Model/CreateFacebookOrderRequestBody.php new file mode 100644 index 0000000..02a9847 --- /dev/null +++ b/php/src/Snagshout/Promote/Model/CreateFacebookOrderRequestBody.php @@ -0,0 +1,72 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * This file is part of the Merchant package + */ + +namespace Snagshout\Promote\Model; + +class CreateFacebookOrderRequestBody +{ + /** + * The Facebook Ad ID. + * + * @var string + */ + protected $adId; + /** + * The Facebook unique user ID. + * + * @var string + */ + protected $userId; + /** + * The Facebook Ad ID. + * + * @return string + */ + public function getAdId() : ? string + { + return $this->adId; + } + /** + * The Facebook Ad ID. + * + * @param string $adId + * + * @return self + */ + public function setAdId(? string $adId) : self + { + $this->adId = $adId; + + return $this; + } + /** + * The Facebook unique user ID. + * + * @return string + */ + public function getUserId() : ? string + { + return $this->userId; + } + /** + * The Facebook unique user ID. + * + * @param string $userId + * + * @return self + */ + public function setUserId(? string $userId) : self + { + $this->userId = $userId; + + return $this; + } +} diff --git a/php/src/Snagshout/Promote/Model/Deal.php b/php/src/Snagshout/Promote/Model/Deal.php index 9865523..b199871 100644 --- a/php/src/Snagshout/Promote/Model/Deal.php +++ b/php/src/Snagshout/Promote/Model/Deal.php @@ -205,6 +205,12 @@ class Deal * @var bool */ protected $available; + /** + * + * + * @var mixed + */ + protected $metadata; /** * * @@ -933,6 +939,28 @@ public function setAvailable(? bool $available) : self return $this; } + /** + * + * + * @return mixed + */ + public function getMetadata() + { + return $this->metadata; + } + /** + * + * + * @param mixed $metadata + * + * @return self + */ + public function setMetadata($metadata) : self + { + $this->metadata = $metadata; + + return $this; + } /** * * diff --git a/php/src/Snagshout/Promote/Model/SyncDealRequestBody.php b/php/src/Snagshout/Promote/Model/SyncDealRequestBody.php index 0a5f762..107bdd1 100644 --- a/php/src/Snagshout/Promote/Model/SyncDealRequestBody.php +++ b/php/src/Snagshout/Promote/Model/SyncDealRequestBody.php @@ -19,6 +19,12 @@ class SyncDealRequestBody * @var string */ protected $url; + /** + * Campaign note. + * + * @var string + */ + protected $note; /** * Deal state on the partner site. * @@ -47,6 +53,28 @@ public function setUrl(? string $url) : self return $this; } + /** + * Campaign note. + * + * @return string + */ + public function getNote() : ? string + { + return $this->note; + } + /** + * Campaign note. + * + * @param string $note + * + * @return self + */ + public function setNote(? string $note) : self + { + $this->note = $note; + + return $this; + } /** * Deal state on the partner site. * diff --git a/php/src/Snagshout/Promote/Normalizer/CompleteFacebookOrderRequestBodyNormalizer.php b/php/src/Snagshout/Promote/Normalizer/CompleteFacebookOrderRequestBodyNormalizer.php new file mode 100644 index 0000000..07fddd5 --- /dev/null +++ b/php/src/Snagshout/Promote/Normalizer/CompleteFacebookOrderRequestBodyNormalizer.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * This file is part of the Merchant package + */ + +namespace Snagshout\Promote\Normalizer; + +use Symfony\Component\Serializer\Exception\InvalidArgumentException; +use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; +use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; +use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; +use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; +use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; +use Symfony\Component\Serializer\Normalizer\NormalizerInterface; + +class CompleteFacebookOrderRequestBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + public function supportsDenormalization($data, $type, $format = null) + { + return $type === 'Snagshout\\Promote\\Model\\CompleteFacebookOrderRequestBody'; + } + public function supportsNormalization($data, $format = null) + { + return $data instanceof \Snagshout\Promote\Model\CompleteFacebookOrderRequestBody; + } + public function denormalize($data, $class, $format = null, array $context = []) + { + if (!is_object($data)) { + throw new InvalidArgumentException(); + } + $object = new \Snagshout\Promote\Model\CompleteFacebookOrderRequestBody(); + if (property_exists($data, 'email')) { + $object->setEmail($data->{'email'}); + } + if (property_exists($data, 'fbUserId')) { + $object->setFbUserId($data->{'fbUserId'}); + } + + return $object; + } + public function normalize($object, $format = null, array $context = []) + { + $data = new \stdClass(); + if (null !== $object->getEmail()) { + $data->{'email'} = $object->getEmail(); + } + if (null !== $object->getFbUserId()) { + $data->{'fbUserId'} = $object->getFbUserId(); + } + + return $data; + } +} diff --git a/php/src/Snagshout/Promote/Normalizer/CreateFacebookOrderRequestBodyNormalizer.php b/php/src/Snagshout/Promote/Normalizer/CreateFacebookOrderRequestBodyNormalizer.php new file mode 100644 index 0000000..35ae046 --- /dev/null +++ b/php/src/Snagshout/Promote/Normalizer/CreateFacebookOrderRequestBodyNormalizer.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * This file is part of the Merchant package + */ + +namespace Snagshout\Promote\Normalizer; + +use Symfony\Component\Serializer\Exception\InvalidArgumentException; +use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; +use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; +use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; +use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; +use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; +use Symfony\Component\Serializer\Normalizer\NormalizerInterface; + +class CreateFacebookOrderRequestBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + public function supportsDenormalization($data, $type, $format = null) + { + return $type === 'Snagshout\\Promote\\Model\\CreateFacebookOrderRequestBody'; + } + public function supportsNormalization($data, $format = null) + { + return $data instanceof \Snagshout\Promote\Model\CreateFacebookOrderRequestBody; + } + public function denormalize($data, $class, $format = null, array $context = []) + { + if (!is_object($data)) { + throw new InvalidArgumentException(); + } + $object = new \Snagshout\Promote\Model\CreateFacebookOrderRequestBody(); + if (property_exists($data, 'adId')) { + $object->setAdId($data->{'adId'}); + } + if (property_exists($data, 'userId')) { + $object->setUserId($data->{'userId'}); + } + + return $object; + } + public function normalize($object, $format = null, array $context = []) + { + $data = new \stdClass(); + if (null !== $object->getAdId()) { + $data->{'adId'} = $object->getAdId(); + } + if (null !== $object->getUserId()) { + $data->{'userId'} = $object->getUserId(); + } + + return $data; + } +} diff --git a/php/src/Snagshout/Promote/Normalizer/DealNormalizer.php b/php/src/Snagshout/Promote/Normalizer/DealNormalizer.php index 773904b..9459b8a 100644 --- a/php/src/Snagshout/Promote/Normalizer/DealNormalizer.php +++ b/php/src/Snagshout/Promote/Normalizer/DealNormalizer.php @@ -149,6 +149,9 @@ public function denormalize($data, $class, $format = null, array $context = []) if (property_exists($data, 'available')) { $object->setAvailable($data->{'available'}); } + if (property_exists($data, 'metadata')) { + $object->setMetadata($data->{'metadata'}); + } if (property_exists($data, 'remainingQuantity')) { $object->setRemainingQuantity($data->{'remainingQuantity'}); } @@ -279,6 +282,9 @@ public function normalize($object, $format = null, array $context = []) if (null !== $object->getAvailable()) { $data->{'available'} = $object->getAvailable(); } + if (null !== $object->getMetadata()) { + $data->{'metadata'} = $object->getMetadata(); + } if (null !== $object->getRemainingQuantity()) { $data->{'remainingQuantity'} = $object->getRemainingQuantity(); } diff --git a/php/src/Snagshout/Promote/Normalizer/NormalizerFactory.php b/php/src/Snagshout/Promote/Normalizer/NormalizerFactory.php index c7efaba..66e6d65 100644 --- a/php/src/Snagshout/Promote/Normalizer/NormalizerFactory.php +++ b/php/src/Snagshout/Promote/Normalizer/NormalizerFactory.php @@ -31,6 +31,8 @@ public static function create() $normalizers[] = new MediumNormalizer(); $normalizers[] = new DealNormalizer(); $normalizers[] = new FollowupNormalizer(); + $normalizers[] = new CompleteFacebookOrderRequestBodyNormalizer(); + $normalizers[] = new CreateFacebookOrderRequestBodyNormalizer(); $normalizers[] = new VersionNormalizer(); $normalizers[] = new ErrorNormalizer(); $normalizers[] = new InitializeMigrationBodyNormalizer(); diff --git a/php/src/Snagshout/Promote/Normalizer/SyncDealRequestBodyNormalizer.php b/php/src/Snagshout/Promote/Normalizer/SyncDealRequestBodyNormalizer.php index 3bb6384..cd307d9 100644 --- a/php/src/Snagshout/Promote/Normalizer/SyncDealRequestBodyNormalizer.php +++ b/php/src/Snagshout/Promote/Normalizer/SyncDealRequestBodyNormalizer.php @@ -40,6 +40,9 @@ public function denormalize($data, $class, $format = null, array $context = []) if (property_exists($data, 'url')) { $object->setUrl($data->{'url'}); } + if (property_exists($data, 'note')) { + $object->setNote($data->{'note'}); + } if (property_exists($data, 'state')) { $object->setState($data->{'state'}); } @@ -52,6 +55,9 @@ public function normalize($object, $format = null, array $context = []) if (null !== $object->getUrl()) { $data->{'url'} = $object->getUrl(); } + if (null !== $object->getNote()) { + $data->{'note'} = $object->getNote(); + } if (null !== $object->getState()) { $data->{'state'} = $object->getState(); }