Skip to content
This repository was archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Release 1.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
edgaraswallee committed Aug 23, 2022
1 parent abc5c73 commit ff19b13
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 60 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Please see the [license file](https://github.com/pfpayments/magento-1/blob/1.1.8/LICENSE) for more information.
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?php

use \PostFinanceCheckout\Sdk\Model\Gender;
use \PostFinanceCheckout\Sdk\Model\Transaction;
use \PostFinanceCheckout\Sdk\Model\TransactionState;
use \PostFinanceCheckout\Sdk\Service\TransactionService;

/**
* PostFinance Checkout Magento 1
*
Expand All @@ -19,68 +24,77 @@ class PostFinanceCheckout_Payment_Model_Webhook_Transaction extends PostFinanceC
/**
*
* @see PostFinanceCheckout_Payment_Model_Webhook_AbstractOrderRelated::loadEntity()
* @return \PostFinanceCheckout\Sdk\Model\Transaction
* @return Transaction
*/
protected function loadEntity(PostFinanceCheckout_Payment_Model_Webhook_Request $request)
{
$transactionService = new \PostFinanceCheckout\Sdk\Service\TransactionService(
$transactionService = new TransactionService(
Mage::helper('postfinancecheckout_payment')->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()
->setTransactionId($transaction->getLinkedSpaceId() . '_' . $transaction->getId())
->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.'));
Expand All @@ -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);
Expand All @@ -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()) {
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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()) {
Expand All @@ -211,17 +224,15 @@ 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()
->getDateOfBirth());
}
}

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) {
Expand All @@ -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) {
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions app/code/community/PostFinanceCheckout/Payment/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<config>
<modules>
<PostFinanceCheckout_Payment>
<version>1.1.7</version>
<version>1.1.8</version>
</PostFinanceCheckout_Payment>
</modules>
<global>
Expand Down Expand Up @@ -357,7 +357,7 @@
<default>
<postfinancecheckout_payment>
<information>
<version>1.1.7</version>
<version>1.1.8</version>
<sdk_version>2.1.5</sdk_version>
</information>
<general>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment><![CDATA[If you need help setting up the PostFinance Checkout extension, check out the <a href="https://plugin-documentation.postfinance-checkout.ch/pfpayments/magento-1/1.1.7/docs/en/documentation.html" target="_blank">documentation</a>.]]></comment>
<comment><![CDATA[If you need help setting up the PostFinance Checkout extension, check out the <a href="https://plugin-documentation.postfinance-checkout.ch/pfpayments/magento-1/1.1.8/docs/en/documentation.html" target="_blank">documentation</a>.]]></comment>
<fields>
<version translate="label">
<label>Module Version</label>
Expand Down
2 changes: 1 addition & 1 deletion app/locale/de_DE/PostFinanceCheckout_Payment.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href=""https://plugin-documentation.postfinance-checkout.ch/pfpayments/magento-1/1.1.7/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Falls Sie Hilfe benötigen beim Einrichten der PostFinance Checkout-Erweiterung, sehen Sie sich die <a href=""https://plugin-documentation.postfinance-checkout.ch/pfpayments/magento-1/1.1.7/docs/en/documentation.html"" target=""_blank"">Dokumentation</a> an."
"If you need help setting up the PostFinance Checkout extension, check out the <a href=""https://plugin-documentation.postfinance-checkout.ch/pfpayments/magento-1/1.1.8/docs/en/documentation.html"" target=""_blank"">documentation</a>.","Falls Sie Hilfe benötigen beim Einrichten der PostFinance Checkout-Erweiterung, sehen Sie sich die <a href=""https://plugin-documentation.postfinance-checkout.ch/pfpayments/magento-1/1.1.8/docs/en/documentation.html"" target=""_blank"">Dokumentation</a> an."
"Inactive","Inaktiv"
"Information","Informationen"
"Line Items","Positionen"
Expand Down
2 changes: 1 addition & 1 deletion app/locale/en_US/PostFinanceCheckout_Payment.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href=""https://plugin-documentation.postfinance-checkout.ch/pfpayments/magento-1/1.1.7/docs/en/documentation.html"" target=""_blank"">documentation</a>.","If you need help setting up the PostFinance Checkout extension, check out the <a href=""https://plugin-documentation.postfinance-checkout.ch/pfpayments/magento-1/1.1.7/docs/en/documentation.html"" target=""_blank"">documentation</a>."
"If you need help setting up the PostFinance Checkout extension, check out the <a href=""https://plugin-documentation.postfinance-checkout.ch/pfpayments/magento-1/1.1.8/docs/en/documentation.html"" target=""_blank"">documentation</a>.","If you need help setting up the PostFinance Checkout extension, check out the <a href=""https://plugin-documentation.postfinance-checkout.ch/pfpayments/magento-1/1.1.8/docs/en/documentation.html"" target=""_blank"">documentation</a>."
"Inactive","Inactive"
"Information","Information"
"Line Items","Line Items"
Expand Down
4 changes: 2 additions & 2 deletions docs/en/documentation.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Documentation</h2> </div>
</a>
</li>
<li>
<a href="https://github.com/pfpayments/magento-1/releases/tag/1.1.7/">
<a href="https://github.com/pfpayments/magento-1/releases/tag/1.1.8/">
Source
</a>
</li>
Expand Down Expand Up @@ -51,7 +51,7 @@ <h1>
<div class="olist arabic">
<ol class="arabic">
<li>
<p><a href="https://github.com/pfpayments/magento-1/releases/tag/1.1.7/">Download</a> the extension.</p>
<p><a href="https://github.com/pfpayments/magento-1/releases/tag/1.1.8/">Download</a> the extension.</p>
</li>
<li>
<p>Extract the files and upload them to the root directory of your store using FTP/SSH.</p>
Expand Down
Binary file modified docs/en/resource/application-user-configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en/resource/space-configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ff19b13

Please sign in to comment.