I am creating a Prestashop Payment Integration module for FSSnet (Indian payment gateway).
I need to pass some user defined fields to the Payment gateway, some of which comes from the current specified Order Shipping address (like Phone number, etc.)
While I have extracted most of the fields after scouring through various public classes and global variables, I am still left with Address details.
FYI, I need values like following from AddressCore class (aliased as Address, present in /classes/Address.php):
/** @var string Firstname */
public $firstname;
/** @var string Address first line */
public $address1;
/** @var string Address second line (optional) */
public $address2;
/** @var string Postal code */
public $postcode;
I thought it was simple enough (or maybe it is), but I am not able to find the correct method to extract these public variables from Address class using member access operators.
Also, I need to fetch these values from the module's main php file (mymodulename.php for example), under the hookPayment function, and not through SMARTY tpl file. I guess that would've been simpler.
Update:: Found the solution. Had to debug through Address object. Following code works.
$user_address = new Address(intval($params['cart']->id_address_invoice));
and then
$udf3 = "udf3=".$user_address->phone;
Thank you.