Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Adyen Magento2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shared Libs
Adyen Magento2
Commits
b22eb220
Commit
b22eb220
authored
Jul 13, 2020
by
rikt
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into feature/generic-component
parents
89763840
0f77b4b4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
81 additions
and
39 deletions
+81
-39
Gateway/Request/CaptureDataBuilder.php
Gateway/Request/CaptureDataBuilder.php
+4
-1
Observer/Adminhtml/BeforeShipmentObserver.php
Observer/Adminhtml/BeforeShipmentObserver.php
+75
-23
composer.json
composer.json
+1
-1
etc/di.xml
etc/di.xml
+0
-7
view/adminhtml/templates/form/cc.phtml
view/adminhtml/templates/form/cc.phtml
+1
-1
view/base/web/images/logos/mobilepay.png
view/base/web/images/logos/mobilepay.png
+0
-0
view/frontend/web/js/view/payment/method-renderer/adyen-google-pay-method.js
...s/view/payment/method-renderer/adyen-google-pay-method.js
+0
-6
No files found.
Gateway/Request/CaptureDataBuilder.php
View file @
b22eb220
...
@@ -100,7 +100,10 @@ class CaptureDataBuilder implements BuilderInterface
...
@@ -100,7 +100,10 @@ class CaptureDataBuilder implements BuilderInterface
// The latest invoice will contain only the selected items(and quantities) for the (partial) capture
// The latest invoice will contain only the selected items(and quantities) for the (partial) capture
$latestInvoice
=
$invoices
->
getLastItem
();
$latestInvoice
=
$invoices
->
getLastItem
();
foreach
(
$latestInvoice
->
getItems
()
as
$invoiceItem
)
{
foreach
(
$latestInvoice
->
getItems
()
as
$invoiceItem
)
{
if
(
$invoiceItem
->
getOrderItem
()
->
getParentItem
())
{
continue
;
}
++
$count
;
++
$count
;
$numberOfItems
=
(
int
)
$invoiceItem
->
getQty
();
$numberOfItems
=
(
int
)
$invoiceItem
->
getQty
();
$formFields
=
$this
->
adyenHelper
->
createOpenInvoiceLineItem
(
$formFields
=
$this
->
adyenHelper
->
createOpenInvoiceLineItem
(
...
...
Observer/Adminhtml/BeforeShipmentObserver.php
View file @
b22eb220
...
@@ -24,60 +24,112 @@
...
@@ -24,60 +24,112 @@
namespace
Adyen\Payment\Observer\Adminhtml
;
namespace
Adyen\Payment\Observer\Adminhtml
;
use
Adyen\Payment\Helper\Data
as
AdyenHelper
;
use
Adyen\Payment\Logger\AdyenLogger
;
use
Adyen\Payment\Observer\AdyenHppDataAssignObserver
;
use
Exception
;
use
Magento\Framework\Event\Observer
;
use
Magento\Framework\Event\Observer
;
use
Magento\Payment\Observer\AbstractDataAssignObserver
;
use
Magento\Payment\Observer\AbstractDataAssignObserver
;
use
Magento\Sales\Model\Order\Invoice
;
use
Magento\Sales\Model\Order\InvoiceRepository
;
use
Magento\Sales\Model\Order\Shipment
;
use
Psr\Log\LoggerInterface
;
use
Throwable
;
class
BeforeShipmentObserver
extends
AbstractDataAssignObserver
class
BeforeShipmentObserver
extends
AbstractDataAssignObserver
{
{
private
$adyenHelper
;
private
$adyenHelper
;
/**
* @var LoggerInterface
*/
private
$logger
;
/**
* @var InvoiceRepository
*/
private
$invoiceRepository
;
/**
/**
* BeforeShipmentObserver constructor.
* BeforeShipmentObserver constructor.
*
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param AdyenHelper $adyenHelper
* @param AdyenLogger $logger
* @param InvoiceRepository $invoiceRepository
*/
*/
public
function
__construct
(
public
function
__construct
(
\Adyen\Payment\Helper\Data
$adyenHelper
AdyenHelper
$adyenHelper
,
AdyenLogger
$logger
,
InvoiceRepository
$invoiceRepository
)
{
)
{
$this
->
adyenHelper
=
$adyenHelper
;
$this
->
adyenHelper
=
$adyenHelper
;
$this
->
logger
=
$logger
;
$this
->
invoiceRepository
=
$invoiceRepository
;
}
}
/**
/**
* @param Observer $observer
* @param Observer $observer
* @throws
\Magento\Framework\Exception\Localized
Exception
* @throws Exception
*/
*/
public
function
execute
(
Observer
$observer
)
public
function
execute
(
Observer
$observer
)
{
{
$shipment
=
$observer
->
getEvent
()
->
getShipment
();
/** @var Shipment $shipment */
$shipment
=
$observer
->
getEvent
()
->
getData
(
'shipment'
);
$order
=
$shipment
->
getOrder
();
$order
=
$shipment
->
getOrder
();
if
(
!
$this
->
isPaymentMethodAdyen
(
$order
))
{
$this
->
logger
->
info
(
"Payment method is not from Adyen for order id
{
$order
->
getId
()
}
"
,
[
'observer'
=>
'BeforeShipmentObserver'
]
);
return
;
}
$captureOnShipment
=
$this
->
adyenHelper
->
getConfigData
(
$captureOnShipment
=
$this
->
adyenHelper
->
getConfigData
(
'capture_on_shipment'
,
'capture_on_shipment'
,
'adyen_abstract'
,
'adyen_abstract'
,
$order
->
getStoreId
()
$order
->
getStoreId
()
);
);
if
(
$this
->
isPaymentMethodAdyen
(
$order
)
&&
$captureOnShipment
)
{
if
(
!
$captureOnShipment
)
{
$
payment
=
$order
->
getPayment
();
$
this
->
logger
->
info
(
$brandCode
=
$payment
->
getAdditionalInformation
(
"Capture on shipment not configured for order id
{
$order
->
getId
()
}
"
,
\Adyen\Payment\Observer\AdyenHppDataAssignObserver
::
BRAND_CODE
[
'observer'
=>
'BeforeShipmentObserver'
]
);
);
return
;
}
$payment
=
$order
->
getPayment
();
$brandCode
=
$payment
->
getAdditionalInformation
(
AdyenHppDataAssignObserver
::
BRAND_CODE
);
if
(
!
$this
->
adyenHelper
->
isPaymentMethodOpenInvoiceMethod
(
$brandCode
))
{
$this
->
logger
->
info
(
"Payment method is from Adyen but isn't OpenInvoice for order id
{
$order
->
getId
()
}
"
,
[
'observer'
=>
'BeforeShipmentObserver'
]
);
return
;
}
if
(
!
$order
->
canInvoice
())
{
$this
->
logger
->
info
(
"Cannot invoice order with id
{
$order
->
getId
()
}
"
,
[
'observer'
=>
'BeforeShipmentObserver'
]
);
return
;
}
if
(
$this
->
adyenHelper
->
isPaymentMethodOpenInvoiceMethod
(
$brandCode
))
{
try
{
if
(
$order
->
canInvoice
())
{
$invoice
=
$order
->
prepareInvoice
();
try
{
$invoice
->
getOrder
()
->
setIsInProcess
(
true
);
$invoice
=
$order
->
prepareInvoice
();
$invoice
->
getOrder
()
->
setIsInProcess
(
true
);
// set transaction id so you can do a online refund from credit memo
// set transaction id so you can do a online refund from credit memo
$pspReference
=
$order
->
getPayment
()
->
getAdyenPspReference
();
$pspReference
=
$order
->
getPayment
()
->
getAdyenPspReference
();
$invoice
->
setTransactionId
(
$pspReference
);
$invoice
->
setTransactionId
(
$pspReference
);
$invoice
->
register
()
->
pay
();
$invoice
->
setRequestedCaptureCase
(
Invoice
::
CAPTURE_ONLINE
);
$invoice
->
save
();
$invoice
->
register
()
->
pay
();
}
catch
(
\Exception
$e
)
{
$this
->
invoiceRepository
->
save
(
$invoice
);
throw
new
\Exception
(
sprintf
(
'Error saving invoice. The error message is:'
,
$e
->
getMessage
()));
}
catch
(
Throwable
$e
)
{
}
$this
->
logger
->
error
(
$e
);
}
throw
new
Exception
(
'Error saving invoice. The error message is: '
.
$e
->
getMessage
());
}
}
}
}
}
...
...
composer.json
View file @
b22eb220
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"name"
:
"adyen/module-payment"
,
"name"
:
"adyen/module-payment"
,
"description"
:
"Official Magento2 Plugin to connect to Payment Service Provider Adyen."
,
"description"
:
"Official Magento2 Plugin to connect to Payment Service Provider Adyen."
,
"type"
:
"magento2-module"
,
"type"
:
"magento2-module"
,
"version"
:
"6.2.
0
"
,
"version"
:
"6.2.
1
"
,
"license"
:
[
"license"
:
[
"OSL-3.0"
,
"OSL-3.0"
,
"AFL-3.0"
"AFL-3.0"
...
...
etc/di.xml
View file @
b22eb220
...
@@ -900,13 +900,6 @@
...
@@ -900,13 +900,6 @@
</arguments>
</arguments>
</virtualType>
</virtualType>
<!--Checkout Response validator-->
<virtualType
name=
"CheckoutResponseValidator"
type=
"Adyen\Payment\Gateway\Validator\CheckoutResponseValidator"
>
<arguments>
<argument
name=
"loggerInterface"
xsi:type=
"object"
>
Adyen\Payment\Logger\AdyenLogger
</argument>
</arguments>
</virtualType>
<virtualType
name=
"PosCloudResponseValidator"
type=
"Adyen\Payment\Gateway\Validator\PosCloudResponseValidator"
>
<virtualType
name=
"PosCloudResponseValidator"
type=
"Adyen\Payment\Gateway\Validator\PosCloudResponseValidator"
>
<arguments>
<arguments>
<argument
name=
"loggerInterface"
xsi:type=
"object"
>
Adyen\Payment\Logger\AdyenLogger
</argument>
<argument
name=
"loggerInterface"
xsi:type=
"object"
>
Adyen\Payment\Logger\AdyenLogger
</argument>
...
...
view/adminhtml/templates/form/cc.phtml
View file @
b22eb220
...
@@ -111,7 +111,7 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
...
@@ -111,7 +111,7 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
*/
*/
var
secureFieldsInitialize
=
function
()
{
var
secureFieldsInitialize
=
function
()
{
if
(
!
"
<?
php
$block
->
getCheckoutOriginKeys
();
?>
"
)
{
if
(
!
"
<?
=
$block
->
getCheckoutOriginKeys
();
?>
"
)
{
document
.
getElementById
(
'
noApiKey
'
).
style
=
"
visibility: visible; display:inline-block
"
;
document
.
getElementById
(
'
noApiKey
'
).
style
=
"
visibility: visible; display:inline-block
"
;
return
;
return
;
}
}
...
...
view/base/web/images/logos/mobilepay.png
0 → 100644
View file @
b22eb220
1.14 KB
view/frontend/web/js/view/payment/method-renderer/adyen-google-pay-method.js
View file @
b22eb220
...
@@ -65,12 +65,6 @@ define(
...
@@ -65,12 +65,6 @@ define(
getCode
:
function
()
{
getCode
:
function
()
{
return
'
adyen_google_pay
'
;
return
'
adyen_google_pay
'
;
},
},
getData
:
function
()
{
return
{
'
method
'
:
this
.
item
.
method
,
'
additional_data
'
:
{}
};
},
isActive
:
function
()
{
isActive
:
function
()
{
return
true
;
return
true
;
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment