Skip to content

Commit

Permalink
Merge pull request #25 from vippsas/publication-1.2.1
Browse files Browse the repository at this point in the history
Publication v.1.2.1
  • Loading branch information
voleye authored Feb 7, 2019
2 parents ef6c1fb + 8b075e5 commit d9a20e1
Show file tree
Hide file tree
Showing 70 changed files with 4,582 additions and 486 deletions.
83 changes: 83 additions & 0 deletions Api/Data/QuoteAttemptInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php
/**
* Copyright 2018 Vipps
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
*/

namespace Vipps\Payment\Api\Data;

/**
* Interface QuoteInterface
* @api
*/
interface QuoteAttemptInterface
{
/**
* @const string
*/
const ENTITY_ID = 'entity_id';

/**
* @const string Vipps Quote Id.
*/
const PARENT_ID = 'parent_id';

/**
* @const string
*/
const MESSAGE = 'message';

/**
* @const string
*/
const CREATED_AT = 'created_at';

/**
* @param int $parentId
* @return self
*/
public function setParentId(int $parentId);

/**
* @param string $message
* @return string
*/
public function setMessage(string $message);

/**
* @param string $createdAt
* @return string
*/
public function setCreatedAt(string $createdAt);

/**
* @return int
*/
public function getParentId();

/**
* @return int
*/
public function getEntityId();

/**
* @return string
*/
public function getMessage();

/**
* @return string
*/
public function getCreatedAt();
}
133 changes: 133 additions & 0 deletions Api/Data/QuoteInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?php
/**
* Copyright 2018 Vipps
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
*/

namespace Vipps\Payment\Api\Data;

use Vipps\Payment\Model\Quote;

/**
* Interface QuoteInterface
* @api
*/
interface QuoteInterface extends QuoteStatusInterface
{
/**
* @const string
*/
const ENTITY_ID = 'entity_id';

/**
* @const string
*/
const QUOTE_ID = 'quote_id';

/**
* @const string
*/
const RESERVED_ORDER_ID = 'reserved_order_id';

/**
* @const string
*/
const CREATED_AT = 'created_at';

/**
* @const string
*/
const UPDATED_AT = 'updated_at';

/**
* @const string
*/
const ATTEMPTS = 'attempts';

/**
* @const string
*/
const STORE_ID = 'store_id';

/**
* @param int $quoteId
* @return self
*/
public function setQuoteId(int $quoteId);

/**
* @param string|null $reservedOrderId
* @return self
*/
public function setReservedOrderId($reservedOrderId);

/**
* @param string $createdAt
* @return self
*/
public function setCreatedAt(string $createdAt);

/**
* @param string $updatedAt
* @return self
*/
public function setUpdatedAt(string $updatedAt);

/**
* @param int $attempts
* @return self
*/
public function setAttempts(int $attempts);

/**
* @return int
*/
public function getQuoteId();

/**
* @return string
*/
public function getReservedOrderId();

/**
* @return string
*/
public function getCreatedAt();

/**
* @return string
*/
public function getUpdatedAt();

/**
* @return int
*/
public function getAttempts();

/**
* @return int
*/
public function getEntityId();

/**
* @return int
*/
public function getStoreId();

/**
* @param int $storeId
* @return self
*/
public function setStoreId(int $storeId);
}
49 changes: 49 additions & 0 deletions Api/Data/QuoteStatusInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/**
* Copyright 2018 Vipps
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
*/

namespace Vipps\Payment\Api\Data;

/**
* Interface QuoteInterface
* @api
*/
interface QuoteStatusInterface
{
/**
* @const string(10)
*/
const FIELD_STATUS = 'status';

const STATUS_NEW = 'new';
const STATUS_EXPIRED = 'expired';
const STATUS_PLACED = 'placed';
const STATUS_PROCESSING = 'processing';
const STATUS_PLACE_FAILED = 'place_failed';
const STATUS_CANCELED = 'canceled';
const STATUS_CANCEL_FAILED = 'cancel_failed';

/**
* @return string
*/
public function getStatus();

/**
* @param string $status
* @return self
*/
public function setStatus(string $status);
}
35 changes: 35 additions & 0 deletions Api/Quote/AttemptRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Copyright 2018 Vipps
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
*/

namespace Vipps\Payment\Api\Quote;

use Magento\Framework\Exception\CouldNotSaveException;
use Vipps\Payment\Api\Data\QuoteAttemptInterface;

/**
* Interface AttemptRepositoryInterface
* @api
*/
interface AttemptRepositoryInterface
{
/**
* @param QuoteAttemptInterface $attempt
* @return QuoteAttemptInterface
* @throws CouldNotSaveException
*/
public function save(QuoteAttemptInterface $attempt);
}
40 changes: 40 additions & 0 deletions Api/Quote/CancelFacadeInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
/**
* Copyright 2018 Vipps
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
*/

namespace Vipps\Payment\Api\Quote;

use Magento\Quote\Api\Data\CartInterface;
use Vipps\Payment\Api\Data\QuoteInterface;
use Vipps\Payment\Gateway\Transaction\Transaction;

/**
* Cancels Vipps payment everywhere.
* @api
*/
interface CancelFacadeInterface
{
/**
* Cancel Vipps payment transaction both, Magento and Vipps.
*
* @param QuoteInterface $vippsQuote
* @param CartInterface|null $quote
*/
public function cancel(
QuoteInterface $vippsQuote,
CartInterface $quote
);
}
50 changes: 50 additions & 0 deletions Api/QuoteManagementInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* Copyright 2018 Vipps
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
*/

namespace Vipps\Payment\Api;

use Magento\Quote\Api\Data\CartInterface;
use Vipps\Payment\Api\Data\QuoteInterface;
use Vipps\Payment\Model\Quote;

/**
* Interface QuoteManagementInterface
* @api
*/
interface QuoteManagementInterface
{
/**
* @param CartInterface $cart
* @return QuoteInterface
*/
public function create(CartInterface $cart);

/**
* @param CartInterface $cart
* @return Quote
* @throws \Magento\Framework\Exception\CouldNotSaveException
*/
public function getByQuote(CartInterface $cart);

/**
* Loads Vipps monitoring as extension attribute.
*
* @param CartInterface $quote
* @throws \Magento\Framework\Exception\CouldNotSaveException
*/
public function loadExtensionAttribute(CartInterface $quote);
}
Loading

0 comments on commit d9a20e1

Please sign in to comment.