-
Notifications
You must be signed in to change notification settings - Fork 8
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
12 changed files
with
232 additions
and
153 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
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,56 @@ | ||
<?php | ||
/** | ||
* Copyright © MercadoPago. All rights reserved. | ||
* | ||
* @author Mercado Pago | ||
* @license See LICENSE for license details. | ||
*/ | ||
|
||
namespace MercadoPago\AdbPayment\Gateway\Request; | ||
|
||
use InvalidArgumentException; | ||
use Magento\Payment\Gateway\Data\PaymentDataObjectInterface; | ||
use Magento\Payment\Gateway\Request\BuilderInterface; | ||
|
||
/** | ||
* Gateway requests for Payment Metadata by Two Cards. | ||
*/ | ||
class MetadataTwoCcPaymentDataRequest implements BuilderInterface | ||
{ | ||
/** | ||
* Checkout block name. | ||
*/ | ||
public const CHECKOUT = 'checkout'; | ||
|
||
/** | ||
* Checkout Type block name. | ||
*/ | ||
public const CHECKOUT_TYPE = 'checkout_type'; | ||
|
||
/** | ||
* Build. | ||
* | ||
* @param array $buildSubject | ||
*/ | ||
public function build(array $buildSubject) | ||
{ | ||
if (!isset($buildSubject['payment']) | ||
|| !$buildSubject['payment'] instanceof PaymentDataObjectInterface | ||
) { | ||
throw new InvalidArgumentException('Payment data object should be provided'); | ||
} | ||
$result = []; | ||
|
||
$result[MetadataPaymentDataRequest::METADATA] = [ | ||
self::CHECKOUT => 'custom', | ||
self::CHECKOUT_TYPE => 'two_cards', | ||
]; | ||
|
||
$result[MetadataPaymentDataRequest::METADATA][MetadataPaymentDataRequest::CPP_EXTRA] = [ | ||
self::CHECKOUT => 'custom', | ||
self::CHECKOUT_TYPE => 'two_cards', | ||
]; | ||
|
||
return $result; | ||
} | ||
} |
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
Oops, something went wrong.