Skip to content

Commit

Permalink
Fix issue with virtual orders
Browse files Browse the repository at this point in the history
  • Loading branch information
RBech committed Nov 24, 2017
1 parent 4a11a41 commit 99ee186
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion Gateway/Request/AuthorizationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Magento\Payment\Gateway\Data\PaymentDataObjectInterface;
use Magento\Payment\Gateway\Helper\SubjectReader;
use Magento\Payment\Gateway\Request\BuilderInterface;
use Magento\Sales\Model\Order;

class AuthorizationRequest implements BuilderInterface
{
Expand Down Expand Up @@ -31,8 +32,13 @@ public function build(array $buildSubject)
/** @var PaymentDataObjectInterface $paymentDO */
$paymentDO = $this->subjectReader->readPayment($buildSubject);
$amount = $this->subjectReader->readAmount($buildSubject) * 100;
/** @var Order $order */
$order = $paymentDO->getOrder();
$address = $order->getShippingAddress();
if ($order->getIsVirtual()) {
$address = $order->getBillingAddress();
} else {
$address = $order->getShippingAddress();
}

return [
'INCREMENT_ID' => $order->getOrderIncrementId(),
Expand Down
2 changes: 1 addition & 1 deletion Model/Adapter/QuickPayAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct(
* Authorize payment and create payment link
*
* @param array $attributes
* @return boolean
* @return array|bool
*/
public function authorizeAndCreatePaymentLink(array $attributes)
{
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="QuickPay_Payment" setup_version="1.0.0">
<module name="QuickPay_Payment" setup_version="1.0.1">
<sequence>
<module name="Magento_Payment"/>
<module name="Magento_Checkout"/>
Expand Down

0 comments on commit 99ee186

Please sign in to comment.