28 private $objectManager;
38 private $dateTimeFactory;
48 $this->dateTimeFactory = $this->objectManager->create(DateTimeFactory::class);
49 $this->caseBuilder = $this->objectManager->create(CreateCaseBuilder::class);
60 public function testCreateCaseBuilderWithFullSetOfData()
63 $order = $this->objectManager->create(Order::class);
64 $order->loadByIncrementId(
'100000001');
75 $productMetadata = $this->objectManager->create(ProductMetadataInterface::class);
78 $signifydOrderSessionId = $this->objectManager->create(SignifydOrderSessionId::class);
82 'orderSessionId' => $signifydOrderSessionId->get(
$order->getQuoteId()),
83 'browserIpAddress' =>
$order->getRemoteIp(),
84 'orderId' =>
$order->getIncrementId(),
85 'createdAt' => date(
'c', strtotime(date(
'Y-m-d 00:00:55'))),
86 'paymentGateway' =>
'paypal_account',
87 'transactionId' =>
$payment->getLastTransId(),
88 'currency' =>
$order->getOrderCurrencyCode(),
89 'avsResponseCode' =>
'',
90 'cvvResponseCode' =>
'',
91 'orderChannel' =>
'WEB',
92 'totalPrice' =>
$order->getGrandTotal(),
95 'shipper' =>
'Flat Rate',
96 'shippingMethod' =>
'Fixed',
97 'shippingPrice' =>
$order->getShippingAmount()
106 'itemUrl' =>
$orderItems[0]->getProduct()->getProductUrl(),
107 'itemWeight' =>
$orderItems[0]->getProduct()->getWeight()
114 'itemUrl' =>
$orderItems[1]->getProduct()->getProductUrl(),
115 'itemWeight' =>
$orderItems[1]->getProduct()->getWeight()
118 'paymentMethod' =>
'PAYPAL_ACCOUNT' 121 'cardHolderName' =>
'firstname lastname',
123 'expiryMonth' =>
$payment->getCcExpMonth(),
124 'expiryYear' =>
$payment->getCcExpYear(),
125 'billingAddress' => [
126 'streetAddress' =>
'street',
138 'deliveryAddress' => [
139 'streetAddress' =>
'6161 West Centinela Avenue',
150 'phone' =>
$order->getBillingAddress()->getTelephone(),
152 'createdDate' => $this->formatDate(
$customer->getCreatedAt()),
153 'lastUpdateDate' => $this->formatDate(
$customer->getUpdatedAt()),
154 'aggregateOrderCount' => 2,
155 'aggregateOrderDollars' => 150.0
157 'seller' => $this->getSellerData(),
158 'platformAndClient' => [
159 'storePlatform' => $productMetadata->getName() .
' ' . $productMetadata->getEdition(),
160 'storePlatformVersion' => $productMetadata->getVersion(),
161 'signifydClientApp' => $productMetadata->getName(),
162 'signifydClientAppVersion' =>
'1.0' 168 $this->caseBuilder->build(
$order->getEntityId())
179 public function testCreateCaseBuilderWithVirtualProductAndGuest()
182 $order = $this->objectManager->create(Order::class);
183 $order->loadByIncrementId(
'100000002');
185 $scope = $this->objectManager->get(ScopeInterface::class);
192 $productMetadata = $this->objectManager->create(ProductMetadataInterface::class);
195 $quoteSessionId = $this->objectManager->create(SignifydOrderSessionId::class);
199 'orderSessionId' => $quoteSessionId->get(
$order->getQuoteId()),
200 'browserIpAddress' =>
$order->getRemoteIp(),
201 'orderId' =>
$order->getIncrementId(),
202 'createdAt' =>
'2016-12-12T12:00:55+00:00',
203 'paymentGateway' =>
$payment->getMethod(),
204 'transactionId' =>
$payment->getLastTransId(),
205 'currency' =>
$order->getOrderCurrencyCode(),
206 'avsResponseCode' =>
'Y',
207 'cvvResponseCode' =>
'M',
208 'orderChannel' =>
'PHONE',
209 'totalPrice' =>
$order->getGrandTotal(),
216 'itemUrl' =>
$product->getProductUrl()
219 'paymentMethod' =>
'PAYMENT_CARD' 222 'cardHolderName' =>
'firstname lastname',
223 'billingAddress' => [
224 'streetAddress' =>
'street',
232 'seller' => $this->getSellerData(),
233 'platformAndClient' => [
234 'storePlatform' => $productMetadata->getName() .
' ' . $productMetadata->getEdition(),
235 'storePlatformVersion' => $productMetadata->getVersion(),
236 'signifydClientApp' => $productMetadata->getName(),
237 'signifydClientAppVersion' =>
'1.0' 243 $this->caseBuilder->build(
$order->getEntityId())
252 private function getSellerData()
255 'name' =>
'Sample Store',
256 'domain' =>
'm2.com',
257 'shipFromAddress' => [
258 'streetAddress' =>
'6161 West Centinela Avenue',
259 'unit' =>
'app. 111',
260 'city' =>
'Culver City',
261 'provinceCode' =>
'AE',
262 'postalCode' =>
'90230',
263 'countryCode' =>
'US',
265 'corporateAddress' => [
266 'streetAddress' =>
'5th Avenue',
268 'city' =>
'New York',
269 'provinceCode' =>
'MH',
270 'postalCode' =>
'19032',
271 'countryCode' =>
'US',
282 private function formatDate($date)
284 $result = $this->dateTimeFactory->create(
286 new \DateTimeZone(
'UTC')
289 return $result->format(\DateTime::ATOM);
if(defined('TESTS_MAGENTO_INSTALLATION') &&TESTS_MAGENTO_INSTALLATION==='enabled') $bootstrap
static getObjectManager()