Skip to content

Commit

Permalink
Merge pull request #977 from mollie/PIPRES-473/alma-order-api
Browse files Browse the repository at this point in the history
PIPRES-473/alma order api
GytisZum authored Oct 2, 2024
2 parents 0b35b93 + d6f8efa commit 1cd57dc
Showing 3 changed files with 28 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/Config/Config.php
Original file line number Diff line number Diff line change
@@ -282,7 +282,6 @@ class Config
];

const PAYMENT_API_ONLY_METHODS = [
PaymentMethod::ALMA,
];

const ROUTE_RESEND_SECOND_CHANCE_PAYMENT_MESSAGE = 'mollie_module_admin_resend_payment_message';
27 changes: 27 additions & 0 deletions src/DTO/PaymentData.php
Original file line number Diff line number Diff line change
@@ -101,6 +101,11 @@ class PaymentData implements JsonSerializable
*/
private $subscriptionOrder = false;

/**
* @var string
*/
private $email;

public function __construct(
Amount $amount,
$description,
@@ -339,6 +344,22 @@ public function setSubscriptionOrder(bool $subscriptionOrder): void
$this->subscriptionOrder = $subscriptionOrder;
}

/**
* @return string
*/
public function getEmail()
{
return $this->email;
}

/**
* @param string $email
*/
public function setEmail($email)
{
$this->email = $email;
}

public function jsonSerialize()
{
$result = [
@@ -347,13 +368,19 @@ public function jsonSerialize()
'value' => (string) $this->getAmount()->getValue(),
],
'billingAddress' => [
'givenName' => $this->cleanUpInput($this->getBillingAddress()->firstname),
'familyName' => $this->cleanUpInput($this->getBillingAddress()->lastname),
'email' => $this->cleanUpInput($this->getEmail()),
'streetAndNumber' => $this->cleanUpInput($this->getBillingAddress()->address1),
'streetAdditional' => $this->cleanUpInput($this->getBillingAddress()->address2, null),
'city' => $this->cleanUpInput($this->getBillingAddress()->city),
'postalCode' => $this->cleanUpInput($this->getBillingAddress()->postcode),
'country' => $this->cleanUpInput(Country::getIsoById($this->getBillingAddress()->id_country)),
],
'shippingAddress' => [
'givenName' => $this->cleanUpInput($this->getBillingAddress()->firstname),
'familyName' => $this->cleanUpInput($this->getBillingAddress()->lastname),
'email' => $this->cleanUpInput($this->getEmail()),
'streetAndNumber' => $this->cleanUpInput($this->getShippingAddress()->address1),
'streetAdditional' => $this->cleanUpInput($this->getShippingAddress()->address2, null),
'city' => $this->cleanUpInput($this->getShippingAddress()->city),
1 change: 1 addition & 0 deletions src/Service/PaymentMethodService.php
Original file line number Diff line number Diff line change
@@ -335,6 +335,7 @@ public function getPaymentData(
$paymentData->setMethod($molPaymentMethod->id_method);

$paymentData->setDescription($orderReference);
$paymentData->setEmail($customer->email);

if (isset($cart->id_address_invoice)) {
$billingAddress = new Address((int) $cart->id_address_invoice);

0 comments on commit 1cd57dc

Please sign in to comment.