-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
96 changed files
with
4,483 additions
and
1,082 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* Class CreateCreditCardDataProviderInterface | ||
* | ||
* | ||
* @author Open Source Team | ||
* @copyright 2021 Pagar.me (https://pagar.me) | ||
* @license https://pagar.me Copyright | ||
* | ||
* @link https://pagar.me | ||
*/ | ||
|
||
namespace Pagarme\Pagarme\Api; | ||
|
||
|
||
interface GooglePayRequestDataProviderInterface extends BaseRequestDataProviderInterface | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function getCustomerAddressStreet($shipping); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getCustomerAddressNumber($shipping); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getCustomerAddressComplement($shipping); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getCustomerAddressDistrict($shipping); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Pagarme\Pagarme\Api; | ||
|
||
interface KycLinkResponseInterface | ||
{ | ||
const DATA_URL = 'url'; | ||
const DATA_QR_CODE = 'qrCode'; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getUrl(); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getQrCode(); | ||
|
||
/** | ||
* @param string $url | ||
* @return $this | ||
*/ | ||
public function setUrl(string $url); | ||
|
||
/** | ||
* @param string $qrCode | ||
* @return $this | ||
*/ | ||
public function setQrCode(string $qrCode); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
/** | ||
* @author Open Source Team | ||
* @copyright 2024 Pagar.me (https://pagar.me) | ||
* @license https://pagar.me Copyright | ||
* | ||
* @link https://pagar.me | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Pagarme\Pagarme\Block\Customer\Marketplace; | ||
|
||
use Magento\Customer\Model\Session; | ||
use Pagarme\Pagarme\Model\Recipient; | ||
use Magento\Framework\View\Element\Template; | ||
use Magento\Framework\View\Element\Template\Context; | ||
use Pagarme\Pagarme\Model\ResourceModel\Recipients\CollectionFactory; | ||
|
||
class Kyc extends Template | ||
{ | ||
/** | ||
* @var Session | ||
*/ | ||
protected $customerSession; | ||
|
||
/** | ||
* @var CollectionFactory | ||
*/ | ||
protected $collectionFactory; | ||
|
||
/** | ||
* @param Context $context | ||
* @param Session $customerSession | ||
* @param CollectionFactory $collectionFactory | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Template\Context $context, | ||
Session $customerSession, | ||
CollectionFactory $collectionFactory, | ||
array $data = []) | ||
{ | ||
$this->customerSession = $customerSession; | ||
$this->collectionFactory = $collectionFactory; | ||
parent::__construct($context, $data); | ||
} | ||
|
||
|
||
/** | ||
* @return Recipient | ||
*/ | ||
public function getRecipient() | ||
{ | ||
return $this->collectionFactory->create()->addFieldToFilter( | ||
'external_id', | ||
['eq' => $this->getCustomerId()] | ||
)->getFirstItem(); | ||
} | ||
|
||
/** | ||
* Get customerId | ||
* | ||
* @return int | ||
*/ | ||
protected function getCustomerId() | ||
{ | ||
return $this->customerSession->getCustomerId(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
|
||
namespace Pagarme\Pagarme\Block\Payment\Info; | ||
|
||
use Exception; | ||
use Magento\Payment\Block\Info\Cc; | ||
use Pagarme\Core\Kernel\Services\OrderService; | ||
use Pagarme\Pagarme\Concrete\Magento2CoreSetup; | ||
use Pagarme\Core\Kernel\ValueObjects\Id\OrderId; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Pagarme\Core\Kernel\Exceptions\InvalidParamException; | ||
use Pagarme\Pagarme\Concrete\Magento2PlatformOrderDecorator; | ||
|
||
abstract class BaseCardInfo extends Cc | ||
{ | ||
|
||
/** | ||
* @return array | ||
* @throws InvalidParamException | ||
* @throws LocalizedException | ||
* @throws Exception | ||
*/ | ||
public function getTransactionInfo() | ||
{ | ||
Magento2CoreSetup::bootstrap(); | ||
$orderService = new OrderService(); | ||
|
||
$orderEntityId = $this->getInfo()->getOrder()->getIncrementId(); | ||
$platformOrder = $this->loadPlatformOrderByIncrementId($orderEntityId); | ||
|
||
$orderPagarmeId = $platformOrder->getPagarmeId(); | ||
|
||
if ($orderPagarmeId === null) { | ||
return []; | ||
} | ||
|
||
$orderObject = $this->getOrderObjectByPagarmeId($orderService, $orderPagarmeId); | ||
|
||
if ($orderObject === null || !is_object($orderObject)) { | ||
return []; | ||
} | ||
|
||
$charge = current($orderObject->getCharges()); | ||
$lastFourDigitsWithDots = sprintf( | ||
"**** **** **** %s", | ||
$charge->getLastTransaction()->getCardData()->getLastFourDigits()->getValue() | ||
); | ||
return array_merge( | ||
$charge->getAcquirerTidCapturedAndAuthorize(), | ||
['tid' => $charge->getLastTransaction()->getAcquirerTid() ?? ""], | ||
['cardBrand' => $charge->getLastTransaction()->getCardData()->getBrand()->getName() ?? ""], | ||
['installments' => $this->getInfo()->getAdditionalInformation('cc_installments') ?? ""], | ||
['lastFour' => $lastFourDigitsWithDots], | ||
['acquirerMessage' => $charge->getLastTransaction()->getAcquirerMessage() ?? ""] | ||
); | ||
} | ||
|
||
/** | ||
* @param mixed $orderService | ||
* @param mixed $pagarmeId | ||
* @return mixed | ||
*/ | ||
protected function getOrderObjectByPagarmeId($orderService, $pagarmeId) | ||
{ | ||
$orderId = new OrderId($pagarmeId); | ||
return $orderService->getOrderByPagarmeId($orderId); | ||
} | ||
/** | ||
* @param mixed $incrementId | ||
* @return Magento2PlatformOrderDecorator | ||
*/ | ||
protected function loadPlatformOrderByIncrementId($incrementId) | ||
{ | ||
$platformOrder = new Magento2PlatformOrderDecorator(); | ||
$platformOrder->loadByIncrementId($incrementId); | ||
return $platformOrder; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.