Basket data in Payment Provider
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 28
- Joined: 17 Aug 2023, 00:16
Basket data in Payment Provider
Laravel: 11.0
Aimeos: 2024.04
PHP: 8.2
Environment: Linux
Hello, I am developing a Payment Service provider. I need customer data to capture the payment as per the Payment gateway that I am using. The process method for the provider take Order Invoice object as parameter. How do I get basket address in the Payment provider. The addresses field in Order Invoice object is an empty array.
I thought using a decorator might solve this problem. Can you please point me right direction as to how get basket address in Payment provider using decorators or without them?
Aimeos: 2024.04
PHP: 8.2
Environment: Linux
Hello, I am developing a Payment Service provider. I need customer data to capture the payment as per the Payment gateway that I am using. The process method for the provider take Order Invoice object as parameter. How do I get basket address in the Payment provider. The addresses field in Order Invoice object is an empty array.
I thought using a decorator might solve this problem. Can you please point me right direction as to how get basket address in Payment provider using decorators or without them?
-
- Posts: 28
- Joined: 17 Aug 2023, 00:16
Re: Basket data in Payment Provider
I am using following method to access address in payment provider. Let me know if there is a better way
Code: Select all
public function process(
\Aimeos\MShop\Order\Item\Iface $order,
array $params = []
): ?\Aimeos\MShop\Common\Helper\Form\Iface {
// perform your actions
$context = $this->context();
$orderId = $params["order.id"];
$orderAddress = \Aimeos\Controller\Frontend::create( $context, 'basket' )->load( $orderId, ['order/address'], false );
return parent::process($order, $params);
}
Re: Basket data in Payment Provider
The order items already contains the address and you can use this to get the billing address:
See: https://github.com/aimeos/aimeos-core/b ... e.php#L274
Code: Select all
$order->getAddress('payment');
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

-
- Posts: 28
- Joined: 17 Aug 2023, 00:16
Re: Basket data in Payment Provider
This does not work. It returns null.
-
- Posts: 28
- Joined: 17 Aug 2023, 00:16
Re: Basket data in Payment Provider
I am using JsonAPI to place order by making post request to basket. While writing a payment provider, the $order object is "order/service" object and it does not have address.
https://github.com/aimeos/ai-client-jso ... 11-L305C17
https://github.com/aimeos/ai-client-jso ... 11-L305C17
Re: Basket data in Payment Provider
Does it work for you if you replace the line which this one instead:
Code: Select all
return \Aimeos\Controller\Frontend::create( $context, 'basket' )->load( $id, ['order/address', 'order/service'], false );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

-
- Posts: 28
- Joined: 17 Aug 2023, 00:16
Re: Basket data in Payment Provider
Yes, this is exactly what I thought. However, implementing this would require changes to the core Aimeos codebase. If this solution is acceptable, I would like to submit a pull request to the Aimeos project.
Re: Basket data in Payment Provider
Yes, please create a PR and we are happy to merge the change into the core. It will be part of the next minor release then.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

-
- Posts: 28
- Joined: 17 Aug 2023, 00:16
Re: Basket data in Payment Provider
Thank you for your response.