Skip to content

Commit 27a952e

Browse files
authored
Add order ref and id in API call metadata (#8)
* Add order ref and id in API call metadata * Change version * Change customerId and orderId type from string to integer Co-authored-by: jcournut <jcournut@openstudio.fr>
1 parent 034df14 commit 27a952e

2 files changed

Lines changed: 64 additions & 6 deletions

File tree

Config/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<language>en_US</language>
1818
<language>fr_FR</language>
1919
</languages>
20-
<version>1.0.6</version>
20+
<version>1.0.7</version>
2121
<authors>
2222
<author>
2323
<name>Vincent Lopes-Vicente</name>

Event/PayPlugPaymentEvent.php

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,19 @@ class PayPlugPaymentEvent extends ActionEvent
312312
'type' => 'nested',
313313
'parameters' => [
314314
'customer_id' => [
315-
'type' => 'string',
315+
'type' => 'integer',
316316
'required' => false,
317317
'access' => 'customerId'
318+
],
319+
'transaction_id' => [
320+
'type' => 'integer',
321+
'required' => false,
322+
'access' => 'orderId'
323+
],
324+
'transaction_ref' => [
325+
'type' => 'string',
326+
'required' => false,
327+
'access' => 'orderRef'
318328
]
319329
]
320330
],
@@ -381,10 +391,20 @@ class PayPlugPaymentEvent extends ActionEvent
381391
protected $currency;
382392

383393
/**
384-
* @var string
394+
* @var integer
385395
*/
386396
protected $customerId;
387397

398+
/**
399+
* @var integer
400+
*/
401+
protected $orderId;
402+
403+
/**
404+
* @var string
405+
*/
406+
protected $orderRef;
407+
388408
/**
389409
* @var string
390410
*/
@@ -561,6 +581,8 @@ public function buildFromOrder(Order $order)
561581

562582
if (null !== $customer = $order->getCustomer()) {
563583
$this->setCustomerId($customer->getId())
584+
->setOrderId($order->getId())
585+
->setOrderRef($order->getRef())
564586
->setBillingEmail($customer->getEmail())
565587
->setShippingEmail($customer->getEmail());
566588
}
@@ -968,23 +990,59 @@ public function setCurrency(string $currency): PayPlugPaymentEvent
968990
}
969991

970992
/**
971-
* @return string
993+
* @return int
972994
*/
973995
public function getCustomerId()
974996
{
975997
return $this->customerId;
976998
}
977999

9781000
/**
979-
* @param string $customerId
1001+
* @param int $customerId
9801002
* @return PayPlugPaymentEvent
9811003
*/
982-
public function setCustomerId(string $customerId): PayPlugPaymentEvent
1004+
public function setCustomerId(int $customerId): PayPlugPaymentEvent
9831005
{
9841006
$this->customerId = $customerId;
9851007
return $this;
9861008
}
9871009

1010+
/**
1011+
* @return int
1012+
*/
1013+
public function getOrderId()
1014+
{
1015+
return $this->orderId;
1016+
}
1017+
1018+
/**
1019+
* @param int $orderId
1020+
* @return PayPlugPaymentEvent
1021+
*/
1022+
public function setOrderId(int $orderId): PayPlugPaymentEvent
1023+
{
1024+
$this->orderId = $orderId;
1025+
return $this;
1026+
}
1027+
1028+
/**
1029+
* @return string
1030+
*/
1031+
public function getOrderRef()
1032+
{
1033+
return $this->orderRef;
1034+
}
1035+
1036+
/**
1037+
* @param string $orderRef
1038+
* @return PayPlugPaymentEvent
1039+
*/
1040+
public function setOrderRef(string $orderRef): PayPlugPaymentEvent
1041+
{
1042+
$this->orderRef = $orderRef;
1043+
return $this;
1044+
}
1045+
9881046
/**
9891047
* @return string
9901048
*/

0 commit comments

Comments
 (0)