diff --git a/README.md b/README.md index 3d1f2c1..1527f0d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This repository contains the Magento 1 extension that enables to process payment ## Documentation -* [Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/magento-1/1.1.7/docs/en/documentation.html) +* [Documentation](https://plugin-documentation.postfinance-checkout.ch/pfpayments/magento-1/1.1.8/docs/en/documentation.html) ## Support @@ -34,4 +34,4 @@ For Magento 1.6.x you need to install the [Magento compatibility module](https:/ ## License -Please see the [license file](https://github.com/pfpayments/magento-1/blob/1.1.7/LICENSE) for more information. \ No newline at end of file +Please see the [license file](https://github.com/pfpayments/magento-1/blob/1.1.8/LICENSE) for more information. \ No newline at end of file diff --git a/app/code/community/PostFinanceCheckout/Payment/Model/Webhook/Transaction.php b/app/code/community/PostFinanceCheckout/Payment/Model/Webhook/Transaction.php index 6aa842c..d0a8225 100644 --- a/app/code/community/PostFinanceCheckout/Payment/Model/Webhook/Transaction.php +++ b/app/code/community/PostFinanceCheckout/Payment/Model/Webhook/Transaction.php @@ -1,5 +1,10 @@ getApiClient()); return $transactionService->read($request->getSpaceId(), $request->getEntityId()); } protected function getTransactionId($transaction) { - /* @var \PostFinanceCheckout\Sdk\Model\Transaction $transaction */ + /* @var Transaction $transaction */ return $transaction->getId(); } protected function processOrderRelatedInner(Mage_Sales_Model_Order $order, $transaction) { - /* @var \PostFinanceCheckout\Sdk\Model\Transaction $transaction */ + /* @var Transaction $transaction */ /* @var PostFinanceCheckout_Payment_Model_Entity_TransactionInfo $transactionInfo */ $transactionInfo = Mage::getModel('postfinancecheckout_payment/entity_transactionInfo')->loadByOrder($order); - if ($transaction->getState() != $transactionInfo->getState()) { - switch ($transaction->getState()) { - case \PostFinanceCheckout\Sdk\Model\TransactionState::AUTHORIZED: - case \PostFinanceCheckout\Sdk\Model\TransactionState::COMPLETED: - $this->authorize($transaction, $order); - break; - case \PostFinanceCheckout\Sdk\Model\TransactionState::DECLINE: - $this->authorize($transaction, $order); - $this->decline($transaction, $order); - break; - case \PostFinanceCheckout\Sdk\Model\TransactionState::FAILED: - $this->failed($transaction, $order); - break; - case \PostFinanceCheckout\Sdk\Model\TransactionState::FULFILL: - $this->authorize($transaction, $order); - $this->fulfill($transaction, $order); - break; - case \PostFinanceCheckout\Sdk\Model\TransactionState::VOIDED: - $this->authorize($transaction, $order); - $this->voided($transaction, $order); - break; - default: - // Nothing to do. - break; + + $finalStates = [ + TransactionState::FAILED, + TransactionState::VOIDED, + TransactionState::DECLINE, + TransactionState::FULFILL + ]; + + if (!in_array($transactionInfo->getState(), $finalStates)) { + /* @var PostFinanceCheckout_Payment_Model_Service_Transaction $transactionStoreService */ + $transactionStoreService = Mage::getSingleton('postfinancecheckout_payment/service_transaction'); + $transactionStoreService->updateTransactionInfo($transaction, $order); + + if ($transaction->getState() != $transactionInfo->getState()) { + switch ($transaction->getState()) { + case TransactionState::AUTHORIZED: + case TransactionState::COMPLETED: + $this->authorize($transaction, $order); + break; + case TransactionState::DECLINE: + $this->authorize($transaction, $order); + $this->decline($transaction, $order); + break; + case TransactionState::FAILED: + $this->failed($transaction, $order); + break; + case TransactionState::FULFILL: + $this->authorize($transaction, $order); + $this->fulfill($transaction, $order); + break; + case TransactionState::VOIDED: + $this->authorize($transaction, $order); + $this->voided($transaction, $order); + break; + default: + // Nothing to do. + break; + } } } - - /* @var PostFinanceCheckout_Payment_Model_Service_Transaction $transactionStoreService */ - $transactionStoreService = Mage::getSingleton('postfinancecheckout_payment/service_transaction'); - $transactionStoreService->updateTransactionInfo($transaction, $order); } - protected function authorize(\PostFinanceCheckout\Sdk\Model\Transaction $transaction, - Mage_Sales_Model_Order $order) + protected function authorize(Transaction $transaction, Mage_Sales_Model_Order $order) { if (! $order->getPostfinancecheckoutAuthorized()) { $order->getPayment() @@ -80,7 +94,7 @@ protected function authorize(\PostFinanceCheckout\Sdk\Model\Transaction $transac ->setIsTransactionClosed(false); $order->getPayment()->registerAuthorizationNotification($transaction->getAuthorizationAmount()); $this->sendOrderEmail($order); - if ($transaction->getState() != \PostFinanceCheckout\Sdk\Model\TransactionState::FULFILL) { + if ($transaction->getState() != TransactionState::FULFILL) { $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, 'processing_postfinancecheckout', Mage::helper('postfinancecheckout_payment')->__( 'The order should not be fulfilled yet, as the payment is not guaranteed.')); @@ -96,7 +110,7 @@ protected function authorize(\PostFinanceCheckout\Sdk\Model\Transaction $transac } } - protected function decline(\PostFinanceCheckout\Sdk\Model\Transaction $transaction, Mage_Sales_Model_Order $order) + protected function decline(Transaction $transaction, Mage_Sales_Model_Order $order) { if ($order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) { $order->setPostfinancecheckoutPaymentInvoiceAllowManipulation(true); @@ -107,7 +121,7 @@ protected function decline(\PostFinanceCheckout\Sdk\Model\Transaction $transacti $order->save(); } - protected function failed(\PostFinanceCheckout\Sdk\Model\Transaction $transaction, Mage_Sales_Model_Order $order) + protected function failed(Transaction $transaction, Mage_Sales_Model_Order $order) { $invoice = $this->getInvoiceForTransaction($transaction->getLinkedSpaceId(), $transaction->getId(), $order); if ($invoice != null && $invoice->canCancel()) { @@ -124,7 +138,7 @@ protected function failed(\PostFinanceCheckout\Sdk\Model\Transaction $transactio } } - protected function fulfill(\PostFinanceCheckout\Sdk\Model\Transaction $transaction, Mage_Sales_Model_Order $order) + protected function fulfill(Transaction $transaction, Mage_Sales_Model_Order $order) { if ($order->getState() == Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW) { $order->getPayment()->setNotificationResult(true); @@ -138,7 +152,7 @@ protected function fulfill(\PostFinanceCheckout\Sdk\Model\Transaction $transacti $order->save(); } - protected function voided(\PostFinanceCheckout\Sdk\Model\Transaction $transaction, Mage_Sales_Model_Order $order) + protected function voided(Transaction $transaction, Mage_Sales_Model_Order $order) { $order->getPayment()->registerVoidNotification(); $invoice = $this->getInvoiceForTransaction($transaction->getLinkedSpaceId(), $transaction->getId(), $order); @@ -187,8 +201,7 @@ protected function getInvoiceForTransaction($spaceId, $transactionId, Mage_Sales return null; } - protected function updateShopCustomer(\PostFinanceCheckout\Sdk\Model\Transaction $transaction, - Mage_Sales_Model_Order $order) + protected function updateShopCustomer(Transaction $transaction, Mage_Sales_Model_Order $order) { if ($order->getCustomerIsGuest() || $order->getBillingAddress() == null || ! $order->getBillingAddress()->getCustomerAddressId()) { @@ -211,8 +224,7 @@ protected function updateShopCustomer(\PostFinanceCheckout\Sdk\Model\Transaction $customer->save(); } - protected function updateDateOfBirth(Mage_Customer_Model_Customer $customer, - \PostFinanceCheckout\Sdk\Model\Transaction $transaction) + protected function updateDateOfBirth(Mage_Customer_Model_Customer $customer, Transaction $transaction) { if ($customer->getDob() == null && $transaction->getBillingAddress()->getDateOfBirth() != null) { $customer->setDob($transaction->getBillingAddress() @@ -220,8 +232,7 @@ protected function updateDateOfBirth(Mage_Customer_Model_Customer $customer, } } - protected function updateSalutation(Mage_Customer_Model_Customer $customer, - Mage_Customer_Model_Address $billingAddress, \PostFinanceCheckout\Sdk\Model\Transaction $transaction) + protected function updateSalutation(Mage_Customer_Model_Customer $customer, Mage_Customer_Model_Address $billingAddress, Transaction $transaction) { if ($transaction->getBillingAddress()->getSalutation() != null) { if ($customer->getPrefix() == null) { @@ -236,20 +247,19 @@ protected function updateSalutation(Mage_Customer_Model_Customer $customer, } } - protected function updateGender(Mage_Customer_Model_Customer $customer, - \PostFinanceCheckout\Sdk\Model\Transaction $transaction) + protected function updateGender(Mage_Customer_Model_Customer $customer, Transaction $transaction) { if ($customer->getGender() == null && $transaction->getBillingAddress()->getGender() != null) { - if ($transaction->getBillingAddress()->getGender() == \PostFinanceCheckout\Sdk\Model\Gender::MALE) { + if ($transaction->getBillingAddress()->getGender() == Gender::MALE) { $customer->setGender(1); - } elseif ($transaction->getBillingAddress()->getGender() == \PostFinanceCheckout\Sdk\Model\Gender::FEMALE) { + } elseif ($transaction->getBillingAddress()->getGender() == Gender::FEMALE) { $customer->setGender(2); } } } protected function updateSalesTaxNumber(Mage_Customer_Model_Customer $customer, - Mage_Customer_Model_Address $billingAddress, \PostFinanceCheckout\Sdk\Model\Transaction $transaction) + Mage_Customer_Model_Address $billingAddress, Transaction $transaction) { if ($transaction->getBillingAddress()->getSalesTaxNumber() != null) { if ($customer->getTaxvat() == null) { @@ -265,7 +275,7 @@ protected function updateSalesTaxNumber(Mage_Customer_Model_Customer $customer, } protected function updateCompany(Mage_Customer_Model_Customer $customer, Mage_Customer_Model_Address $billingAddress, - \PostFinanceCheckout\Sdk\Model\Transaction $transaction) + Transaction $transaction) { if ($billingAddress->getCompany() == null && $transaction->getBillingAddress()->getOrganizationName() != null) { $billingAddress->setCompany($transaction->getBillingAddress() diff --git a/app/code/community/PostFinanceCheckout/Payment/etc/config.xml b/app/code/community/PostFinanceCheckout/Payment/etc/config.xml index 34916e5..c52cdd6 100644 --- a/app/code/community/PostFinanceCheckout/Payment/etc/config.xml +++ b/app/code/community/PostFinanceCheckout/Payment/etc/config.xml @@ -13,7 +13,7 @@ - 1.1.7 + 1.1.8 @@ -357,7 +357,7 @@ - 1.1.7 + 1.1.8 2.1.5 diff --git a/app/code/community/PostFinanceCheckout/Payment/etc/system.xml b/app/code/community/PostFinanceCheckout/Payment/etc/system.xml index e77d5ea..181ec01 100644 --- a/app/code/community/PostFinanceCheckout/Payment/etc/system.xml +++ b/app/code/community/PostFinanceCheckout/Payment/etc/system.xml @@ -30,7 +30,7 @@ 1 1 1 - documentation.]]> + documentation.]]> diff --git a/app/locale/de_DE/PostFinanceCheckout_Payment.csv b/app/locale/de_DE/PostFinanceCheckout_Payment.csv index 2276552..2508578 100644 --- a/app/locale/de_DE/PostFinanceCheckout_Payment.csv +++ b/app/locale/de_DE/PostFinanceCheckout_Payment.csv @@ -36,7 +36,7 @@ "Giftcard (%s)","Geschenkkarte (%s)" "Giftcard","Geschenkkarte" "Hold Delivery","Lieferung halten" -"If you need help setting up the PostFinance Checkout extension, check out the documentation.","Falls Sie Hilfe benötigen beim Einrichten der PostFinance Checkout-Erweiterung, sehen Sie sich die Dokumentation an." +"If you need help setting up the PostFinance Checkout extension, check out the documentation.","Falls Sie Hilfe benötigen beim Einrichten der PostFinance Checkout-Erweiterung, sehen Sie sich die Dokumentation an." "Inactive","Inaktiv" "Information","Informationen" "Line Items","Positionen" diff --git a/app/locale/en_US/PostFinanceCheckout_Payment.csv b/app/locale/en_US/PostFinanceCheckout_Payment.csv index 8ade690..ad34dbb 100644 --- a/app/locale/en_US/PostFinanceCheckout_Payment.csv +++ b/app/locale/en_US/PostFinanceCheckout_Payment.csv @@ -36,7 +36,7 @@ "Giftcard (%s)","Giftcard (%s)" "Giftcard","Giftcard" "Hold Delivery","Hold Delivery" -"If you need help setting up the PostFinance Checkout extension, check out the documentation.","If you need help setting up the PostFinance Checkout extension, check out the documentation." +"If you need help setting up the PostFinance Checkout extension, check out the documentation.","If you need help setting up the PostFinance Checkout extension, check out the documentation." "Inactive","Inactive" "Information","Information" "Line Items","Line Items" diff --git a/docs/en/documentation.html b/docs/en/documentation.html index ab753d2..1cfe333 100644 --- a/docs/en/documentation.html +++ b/docs/en/documentation.html @@ -22,7 +22,7 @@

Documentation

  • - + Source
  • @@ -51,7 +51,7 @@

    1. -

      Download the extension.

      +

      Download the extension.

    2. Extract the files and upload them to the root directory of your store using FTP/SSH.

      diff --git a/docs/en/resource/application-user-configuration.png b/docs/en/resource/application-user-configuration.png index 2fcccd3..1f90a9d 100644 Binary files a/docs/en/resource/application-user-configuration.png and b/docs/en/resource/application-user-configuration.png differ diff --git a/docs/en/resource/space-configuration.png b/docs/en/resource/space-configuration.png index dab4c74..4cee08f 100644 Binary files a/docs/en/resource/space-configuration.png and b/docs/en/resource/space-configuration.png differ