Custom provider labels
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
- DaleWastell
- Posts: 4
- Joined: 18 Jun 2022, 08:00
Custom provider labels
Hello Aimeos,
Thank you for this awesome package. We in Mayapur are busy implementing it for our international multi million dollar donation and volinteer based community project: Temple of Vedic Planetarium (TOVP) and have some very specific payment gateway requirements which appear to fall outside the scope of Omnipay.
I am using the latest versions of Aimeos and PHP to date.
Firstly, a small documentation change:
in the sample code: new \Aimeos\MW\Criteria\Attribute\Standard
needs to change to: new \Aimeos\Base\Criteria\Attribute\Standard
It would also be useful to know that the new provider needs to be placed in the /MShop/Service/Provider/Payment folder.
I copied the structure of DirectDebit.php for some reference but am having an issue in the label (snips below). What am I missing?
I would also like to know how to add in a country dropbox.
Code:
<?php
namespace Aimeos\MShop\Service\Provider\Payment;
class MayapurPaymentPortal
extends \Aimeos\MShop\Service\Provider\Payment\Base
implements \Aimeos\MShop\Service\Provider\Payment\Iface
{
private $feConfig = array(
'MayapurPaymentPortal.first_name' => array(
'code' => 'mayapurpaymentportal.first_name',
'internalcode' => 'MPPFirstName',
'label' => 'First Name',
'type' => 'string',
'internaltype' => 'string',
'default' => '',
'required' => true
),
'MayapurPaymentPortal.last_name' => array(
'code' => 'MayapurPaymentPortal.last_name',
'internalcode' => 'MPPLastName',
'label' => 'Last Name',
'type' => 'string',
'internaltype' => 'string',
'default' => '',
'required' => true
),
);
public function getConfigFE( \Aimeos\MShop\Order\Item\Base\Iface $basket ) : array
{
$feconfig = $this->feConfig;
return $this->getConfigItems( $feconfig );
}
public function setConfigFE( \Aimeos\MShop\Order\Item\Base\Service\Iface $orderServiceItem,
array $attributes ) : \Aimeos\MShop\Order\Item\Base\Service\Iface
{
$orderServiceItem = $this->setAttributes( $orderServiceItem, $attributes, 'payment' );
return $orderServiceItem;
}
public function checkConfigFE( array $attributes ) : array
{
return $this->checkConfig( $this->feConfig, $attributes );
}
public function process(\Aimeos\MShop\Order\Item\Iface $order,
array $params = []): ?\Aimeos\MShop\Common\Helper\Form\Iface
{
$basket = $this->getOrderBase( $order->getBaseId() );
$total = $basket->getPrice()->getValue() + $basket->getPrice()->getCosts();
// define the payment information that should be sent to the external payment gateway
$list = [
'MayapurPaymentPortal.pancode' => new \Aimeos\Base\Criteria\Attribute\Standard( [//local / international
'label' => 'Pan Code',
'code' => 'MayapurPaymentPortal.pancode',
'internalcode' => 'MPPFirstName',
'internaltype' => 'string',
'type' => 'string',
'default' => "",
'public' => true,
] ),
];
$gatewayUrl = 'http://127.0.0.1:8000/PGSim.php';
return new \Aimeos\MShop\Common\Helper\Form\Standard( $gatewayUrl, 'POST', $list );
}
}
?>
Thank you in advance
Thank you for this awesome package. We in Mayapur are busy implementing it for our international multi million dollar donation and volinteer based community project: Temple of Vedic Planetarium (TOVP) and have some very specific payment gateway requirements which appear to fall outside the scope of Omnipay.
I am using the latest versions of Aimeos and PHP to date.
Firstly, a small documentation change:
in the sample code: new \Aimeos\MW\Criteria\Attribute\Standard
needs to change to: new \Aimeos\Base\Criteria\Attribute\Standard
It would also be useful to know that the new provider needs to be placed in the /MShop/Service/Provider/Payment folder.
I copied the structure of DirectDebit.php for some reference but am having an issue in the label (snips below). What am I missing?
I would also like to know how to add in a country dropbox.
Code:
<?php
namespace Aimeos\MShop\Service\Provider\Payment;
class MayapurPaymentPortal
extends \Aimeos\MShop\Service\Provider\Payment\Base
implements \Aimeos\MShop\Service\Provider\Payment\Iface
{
private $feConfig = array(
'MayapurPaymentPortal.first_name' => array(
'code' => 'mayapurpaymentportal.first_name',
'internalcode' => 'MPPFirstName',
'label' => 'First Name',
'type' => 'string',
'internaltype' => 'string',
'default' => '',
'required' => true
),
'MayapurPaymentPortal.last_name' => array(
'code' => 'MayapurPaymentPortal.last_name',
'internalcode' => 'MPPLastName',
'label' => 'Last Name',
'type' => 'string',
'internaltype' => 'string',
'default' => '',
'required' => true
),
);
public function getConfigFE( \Aimeos\MShop\Order\Item\Base\Iface $basket ) : array
{
$feconfig = $this->feConfig;
return $this->getConfigItems( $feconfig );
}
public function setConfigFE( \Aimeos\MShop\Order\Item\Base\Service\Iface $orderServiceItem,
array $attributes ) : \Aimeos\MShop\Order\Item\Base\Service\Iface
{
$orderServiceItem = $this->setAttributes( $orderServiceItem, $attributes, 'payment' );
return $orderServiceItem;
}
public function checkConfigFE( array $attributes ) : array
{
return $this->checkConfig( $this->feConfig, $attributes );
}
public function process(\Aimeos\MShop\Order\Item\Iface $order,
array $params = []): ?\Aimeos\MShop\Common\Helper\Form\Iface
{
$basket = $this->getOrderBase( $order->getBaseId() );
$total = $basket->getPrice()->getValue() + $basket->getPrice()->getCosts();
// define the payment information that should be sent to the external payment gateway
$list = [
'MayapurPaymentPortal.pancode' => new \Aimeos\Base\Criteria\Attribute\Standard( [//local / international
'label' => 'Pan Code',
'code' => 'MayapurPaymentPortal.pancode',
'internalcode' => 'MPPFirstName',
'internaltype' => 'string',
'type' => 'string',
'default' => "",
'public' => true,
] ),
];
$gatewayUrl = 'http://127.0.0.1:8000/PGSim.php';
return new \Aimeos\MShop\Common\Helper\Form\Standard( $gatewayUrl, 'POST', $list );
}
}
?>
Thank you in advance
Re: Custom provider labels
Thanks for the hints. This has been changed in the master branch and will be released soon:DaleWastell wrote: ↑28 Jun 2022, 09:35 Firstly, a small documentation change:
in the sample code: new \Aimeos\MW\Criteria\Attribute\Standard
needs to change to: new \Aimeos\Base\Criteria\Attribute\Standard
It would also be useful to know that the new provider needs to be placed in the /MShop/Service/Provider/Payment folder.
https://aimeos.org/docs/master/provider ... e/payment/
How to add selections for custom attributes is explained here:
https://aimeos.org/docs/latest/provider ... figuration
Use "select" or "list" as type and add the list of countries to the "default" property.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star