Paymill_Paymill - Version 3.5.3

Version Notes

* fix broken image in pdf invoice

Download this release

Release Info

Developer PayIntelligent
Extension Paymill_Paymill
Version 3.5.3
Comparing to
See all releases


Code changes from version 3.5.0 to 3.5.3

Files changed (50) hide show
  1. app/code/community/Paymill/Paymill/Block/Payment/Form/PaymentFormAbstract.php +1 -1
  2. app/code/community/Paymill/Paymill/Block/Payment/Info/PaymentFormCreditcard.php +12 -1
  3. app/code/community/Paymill/Paymill/Block/Payment/Info/PaymentFormDirectdebit.php +12 -1
  4. app/code/community/Paymill/Paymill/Helper/CustomerHelper.php +20 -0
  5. app/code/community/Paymill/Paymill/Helper/FastCheckoutHelper.php +9 -3
  6. app/code/community/Paymill/Paymill/Helper/PaymentHelper.php +0 -1
  7. app/code/community/Paymill/Paymill/Model/Fastcheckout.php +2 -0
  8. app/code/community/Paymill/Paymill/Model/Method/MethodModelAbstract.php +32 -13
  9. app/code/community/Paymill/Paymill/Model/Method/MethodModelCreditcard.php +0 -55
  10. app/code/community/Paymill/Paymill/Model/Observer.php +4 -3
  11. app/code/community/Paymill/Paymill/etc/config.xml +1 -1
  12. app/code/community/Paymill/Paymill/etc/system.xml +15 -12
  13. app/code/community/Paymill/Paymill/sql/paymill_setup/mysql4-install-3.0.0.php +8 -1
  14. app/code/community/Paymill/Paymillcc/Block/Form/Paymill.php +57 -0
  15. app/code/community/Paymill/Paymillcc/Block/Info/Paymill.php +34 -0
  16. app/code/community/Paymill/Paymillcc/Helper/Data.php +6 -0
  17. app/code/community/Paymill/Paymillcc/LibraryVersion.php +13 -0
  18. app/code/community/Paymill/Paymillcc/Model/Customerdata.php +60 -0
  19. app/code/community/Paymill/Paymillcc/Model/Mysql4/Customerdata.php +31 -0
  20. app/code/community/Paymill/Paymillcc/Model/Mysql4/Customerdata/Collection.php +31 -0
  21. app/code/community/Paymill/Paymillcc/Model/PaymentAbstract.php +131 -0
  22. app/code/community/Paymill/Paymillcc/Model/PaymentMethod.php +300 -0
  23. app/code/community/Paymill/Paymillcc/etc/config.xml +95 -0
  24. app/code/community/Paymill/Paymillcc/etc/system.xml +150 -0
  25. app/code/community/Paymill/Paymillcc/sql/paymillcc_setup/mysql4-install-2.1.2.php +15 -0
  26. app/code/community/Paymill/Paymillcc/sql/paymillcc_setup/mysql4-upgrade-2.1.1-2.1.2.php +15 -0
  27. app/code/community/Paymill/Paymillelv/Block/Form/Paymill.php +49 -0
  28. app/code/community/Paymill/Paymillelv/Block/Info/Paymill.php +34 -0
  29. app/code/community/Paymill/Paymillelv/Helper/Data.php +6 -0
  30. app/code/community/Paymill/Paymillelv/Model/Customerdata.php +60 -0
  31. app/code/community/Paymill/Paymillelv/Model/Mysql4/Customerdata.php +31 -0
  32. app/code/community/Paymill/Paymillelv/Model/Mysql4/Customerdata/Collection.php +31 -0
  33. app/code/community/Paymill/Paymillelv/Model/PaymentAbstract.php +131 -0
  34. app/code/community/Paymill/Paymillelv/Model/PaymentMethod.php +278 -0
  35. app/code/community/Paymill/Paymillelv/etc/config.xml +93 -0
  36. app/code/community/Paymill/Paymillelv/etc/system.xml +141 -0
  37. app/code/community/Paymill/Paymillelv/sql/paymillelv_setup/mysql4-install-2.1.2.php +15 -0
  38. app/code/community/Paymill/Paymillelv/sql/paymillelv_setup/mysql4-upgrade-2.1.1-2.1.2.php +15 -0
  39. app/design/adminhtml/base/default/template/paymill/payment/info/creditcard_pdf.phtml +3 -0
  40. app/design/adminhtml/base/default/template/paymill/payment/info/directdebit_pdf.phtml +3 -0
  41. app/design/frontend/base/default/template/paymill/form/paymill.phtml +299 -0
  42. app/design/frontend/base/default/template/paymill/form/paymill_elv.phtml +184 -0
  43. app/design/frontend/base/default/template/paymill/payment/form/creditcard.phtml +2 -13
  44. app/design/frontend/base/default/template/paymill/payment/form/directdebit.phtml +1 -12
  45. app/locale/de_DE/Paymill_Paymill.csv +1 -0
  46. app/locale/en_GB/Paymill_Paymill.csv +2 -1
  47. js/paymill/paymentForm.js +269 -188
  48. package.xml +6 -6
  49. skin/frontend/base/default/css/paymill/logo.css +33 -16
  50. skin/frontend/base/default/images/paymill/icon_32x20_unionpay.png +0 -0
app/code/community/Paymill/Paymill/Block/Payment/Form/PaymentFormAbstract.php CHANGED
@@ -43,6 +43,6 @@ class Paymill_Paymill_Block_Payment_Form_PaymentFormAbstract extends Mage_Paymen
43
  */
44
  public function isNormalCheckout($code)
45
  {
46
- return !Mage::helper('paymill/fastCheckoutHelper')->hasData($code) ? 'false' : 'true';
47
  }
48
  }
43
  */
44
  public function isNormalCheckout($code)
45
  {
46
+ return is_null(Mage::helper('paymill/fastCheckoutHelper')->getPaymentData($code)) ? 'false' : 'true';
47
  }
48
  }
app/code/community/Paymill/Paymill/Block/Payment/Info/PaymentFormCreditcard.php CHANGED
@@ -29,7 +29,18 @@ class Paymill_Paymill_Block_Payment_Info_PaymentFormCreditcard extends Mage_Paym
29
  parent::_construct();
30
  $this->setTemplate('paymill/payment/info/creditcard.phtml');
31
  }
32
-
 
 
 
 
 
 
 
 
 
 
 
33
  /**
34
  * Add custom information to payment method information
35
  *
29
  parent::_construct();
30
  $this->setTemplate('paymill/payment/info/creditcard.phtml');
31
  }
32
+
33
+ /**
34
+ * Render as PDF
35
+ *
36
+ * @return string
37
+ */
38
+ public function toPdf()
39
+ {
40
+ $this->setTemplate('paymill/payment/info/creditcard_pdf.phtml');
41
+ return $this->toHtml();
42
+ }
43
+
44
  /**
45
  * Add custom information to payment method information
46
  *
app/code/community/Paymill/Paymill/Block/Payment/Info/PaymentFormDirectdebit.php CHANGED
@@ -29,7 +29,18 @@ class Paymill_Paymill_Block_Payment_Info_PaymentFormDirectdebit extends Mage_Pay
29
  parent::_construct();
30
  $this->setTemplate('paymill/payment/info/directdebit.phtml');
31
  }
32
-
 
 
 
 
 
 
 
 
 
 
 
33
  /**
34
  * Add custom information to payment method information
35
  *
29
  parent::_construct();
30
  $this->setTemplate('paymill/payment/info/directdebit.phtml');
31
  }
32
+
33
+ /**
34
+ * Render as PDF
35
+ *
36
+ * @return string
37
+ */
38
+ public function toPdf()
39
+ {
40
+ $this->setTemplate('paymill/payment/info/directdebit_pdf.phtml');
41
+ return $this->toHtml();
42
+ }
43
+
44
  /**
45
  * Add custom information to payment method information
46
  *
app/code/community/Paymill/Paymill/Helper/CustomerHelper.php CHANGED
@@ -53,6 +53,26 @@ class Paymill_Paymill_Helper_CustomerHelper extends Mage_Core_Helper_Abstract
53
 
54
  return $email;
55
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
  /**
58
  * Returns the Id of the user currently logged in.
53
 
54
  return $email;
55
  }
56
+
57
+ public function getClientData()
58
+ {
59
+ $clients = new Services_Paymill_Clients(
60
+ Mage::helper('paymill/optionHelper')->getPrivateKey(),
61
+ Mage::helper('paymill')->getApiUrl()
62
+ );
63
+
64
+ $clientId = Mage::helper("paymill/fastCheckoutHelper")->getClientId();
65
+
66
+ $client = null;
67
+ if (!empty($clientId)) {
68
+ $client = $clients->getOne($clientId);
69
+ if (!array_key_exists('email', $client)) {
70
+ $client = null;
71
+ }
72
+ }
73
+
74
+ return $client;
75
+ }
76
 
77
  /**
78
  * Returns the Id of the user currently logged in.
app/code/community/Paymill/Paymill/Helper/FastCheckoutHelper.php CHANGED
@@ -77,12 +77,18 @@ class Paymill_Paymill_Helper_FastCheckoutHelper extends Mage_Core_Helper_Abstrac
77
 
78
  public function getPaymentData($code)
79
  {
80
- $privateKey = Mage::helper('paymill/optionHelper')->getPrivateKey();
81
- $apiUrl = Mage::helper('paymill')->getApiUrl();
82
  $payment = null;
83
  if ($this->hasData($code)) {
84
- $payments = new Services_Paymill_Payments($privateKey, $apiUrl);
 
 
 
 
85
  $payment = $payments->getOne($this->getPaymentId($code));
 
 
 
 
86
  }
87
 
88
  return $payment;
77
 
78
  public function getPaymentData($code)
79
  {
 
 
80
  $payment = null;
81
  if ($this->hasData($code)) {
82
+ $payments = new Services_Paymill_Payments(
83
+ Mage::helper('paymill/optionHelper')->getPrivateKey(),
84
+ Mage::helper('paymill')->getApiUrl()
85
+ );
86
+
87
  $payment = $payments->getOne($this->getPaymentId($code));
88
+
89
+ if (!array_key_exists('last4', $payment) && !array_key_exists('code', $payment)) {
90
+ $payment = null;
91
+ }
92
  }
93
 
94
  return $payment;
app/code/community/Paymill/Paymill/Helper/PaymentHelper.php CHANGED
@@ -74,7 +74,6 @@ class Paymill_Paymill_Helper_PaymentHelper extends Mage_Core_Helper_Abstract
74
  */
75
  public function getErrorMessage($code)
76
  {
77
- Mage::log($code, null, 'paymill.log');
78
  $message = 'General undefined response.';
79
  if (array_key_exists($code, $this->_responseCodes)) {
80
  $message = $this->_responseCodes[$code];
74
  */
75
  public function getErrorMessage($code)
76
  {
 
77
  $message = 'General undefined response.';
78
  if (array_key_exists($code, $this->_responseCodes)) {
79
  $message = $this->_responseCodes[$code];
app/code/community/Paymill/Paymill/Model/Fastcheckout.php CHANGED
@@ -69,6 +69,8 @@ class Paymill_Paymill_Model_Fastcheckout extends Mage_Core_Model_Abstract
69
  if ($customerExists == 1) {
70
  $obj = $collection->getFirstItem();
71
 
 
 
72
  if ($paymentMethodCode === 'paymill_creditcard') {
73
  $logger->log("Saving Fast Checkout Data", "Customer data already exists. Saving CC only Data.");
74
  $obj->setCcPaymentId($paymentId)
69
  if ($customerExists == 1) {
70
  $obj = $collection->getFirstItem();
71
 
72
+ $obj->setClientId($clientId)->save();
73
+
74
  if ($paymentMethodCode === 'paymill_creditcard') {
75
  $logger->log("Saving Fast Checkout Data", "Customer data already exists. Saving CC only Data.");
76
  $obj->setCcPaymentId($paymentId)
app/code/community/Paymill/Paymill/Model/Method/MethodModelAbstract.php CHANGED
@@ -92,6 +92,8 @@ abstract class Paymill_Paymill_Model_Method_MethodModelAbstract extends Mage_Pay
92
  protected $_code = 'paymill_abstract';
93
 
94
  protected $_errorCode;
 
 
95
 
96
  /**
97
  * Check if currency is avaible for this payment
@@ -155,7 +157,13 @@ abstract class Paymill_Paymill_Model_Method_MethodModelAbstract extends Mage_Pay
155
  */
156
  public function assignData($data)
157
  {
158
- $post = $data->getData();
 
 
 
 
 
 
159
  if (array_key_exists('paymill-payment-token-' . $this->_getShortCode(), $post)
160
  && !empty($post['paymill-payment-token-' . $this->_getShortCode()])) {
161
  //Save Data into session
@@ -164,14 +172,11 @@ abstract class Paymill_Paymill_Model_Method_MethodModelAbstract extends Mage_Pay
164
  } else {
165
  if (Mage::helper('paymill/fastCheckoutHelper')->hasData($this->_code)) {
166
  Mage::getSingleton('core/session')->setToken('dummyToken');
167
- } else {
168
- Mage::helper('paymill/loggingHelper')->log("No token found.");
169
- Mage::throwException("There was an error processing your payment.");
170
  }
171
  }
172
 
173
  //Finish as usual
174
- return parent::assignData($data);
175
  }
176
 
177
  /**
@@ -182,14 +187,22 @@ abstract class Paymill_Paymill_Model_Method_MethodModelAbstract extends Mage_Pay
182
  */
183
  public function authorize(Varien_Object $payment, $amount)
184
  {
185
- $success = false;
 
 
 
 
 
186
  if (Mage::helper('paymill/optionHelper')->isPreAuthorizing() && $this->_code === "paymill_creditcard") {
187
  Mage::helper('paymill/loggingHelper')->log("Starting payment process as preAuth");
188
- $success = $this->preAuth($payment, $amount);
189
  } else {
190
  Mage::helper('paymill/loggingHelper')->log("Starting payment process as debit");
191
- $success = $this->debit($payment, $amount);
 
192
  }
 
 
193
 
194
  if (!$success) {
195
  Mage::helper('paymill/loggingHelper')->log(Mage::helper("paymill/paymentHelper")->getErrorMessage($this->_errorCode));
@@ -205,7 +218,7 @@ abstract class Paymill_Paymill_Model_Method_MethodModelAbstract extends Mage_Pay
205
  * Deals with payment processing when debit mode is active
206
  * @return booelan Indicator of success
207
  */
208
- public function debit(Varien_Object $payment, $amount)
209
  {
210
  //Gathering data from session
211
  $token = Mage::getSingleton('core/session')->getToken();
@@ -216,24 +229,30 @@ abstract class Paymill_Paymill_Model_Method_MethodModelAbstract extends Mage_Pay
216
 
217
  //Always load client if email doesn't change
218
  $clientId = $fcHelper->getClientId();
219
- if (isset($clientId)) {
220
  $paymentProcessor->setClientId($clientId);
221
  }
222
 
223
  //Loading Fast Checkout Data (if enabled and given)
224
  if ($fcHelper->hasData($this->_code) && $token === 'dummyToken') {
225
  $paymentId = $fcHelper->getPaymentId($this->_code);
226
- if (isset($paymentId)) {
227
  $paymentProcessor->setPaymentId($paymentId);
228
  }
229
  }
230
 
231
- $success = $paymentProcessor->processPayment();
232
 
233
  If ($success) {
234
  //Save Transaction Data
235
  $transactionHelper = Mage::helper("paymill/transactionHelper");
236
- $transactionModel = $transactionHelper->createTransactionModel($paymentProcessor->getTransactionId(), false);
 
 
 
 
 
 
237
  $transactionHelper->setAdditionalInformation($payment, $transactionModel);
238
 
239
  //Allways update the client
92
  protected $_code = 'paymill_abstract';
93
 
94
  protected $_errorCode;
95
+
96
+ protected $_preAuthFlag;
97
 
98
  /**
99
  * Check if currency is avaible for this payment
157
  */
158
  public function assignData($data)
159
  {
160
+ parent::assignData($data);
161
+ if (is_array($data)) {
162
+ $post = $data;
163
+ } else {
164
+ $post = $data->getData();
165
+ }
166
+
167
  if (array_key_exists('paymill-payment-token-' . $this->_getShortCode(), $post)
168
  && !empty($post['paymill-payment-token-' . $this->_getShortCode()])) {
169
  //Save Data into session
172
  } else {
173
  if (Mage::helper('paymill/fastCheckoutHelper')->hasData($this->_code)) {
174
  Mage::getSingleton('core/session')->setToken('dummyToken');
 
 
 
175
  }
176
  }
177
 
178
  //Finish as usual
179
+ return $this;
180
  }
181
 
182
  /**
187
  */
188
  public function authorize(Varien_Object $payment, $amount)
189
  {
190
+ $token = Mage::getSingleton('core/session')->getToken();
191
+ if (empty($token)) {
192
+ Mage::helper('paymill/loggingHelper')->log("No token found.");
193
+ Mage::throwException("There was an error processing your payment.");
194
+ }
195
+
196
  if (Mage::helper('paymill/optionHelper')->isPreAuthorizing() && $this->_code === "paymill_creditcard") {
197
  Mage::helper('paymill/loggingHelper')->log("Starting payment process as preAuth");
198
+ $this->_preAuthFlag = true;
199
  } else {
200
  Mage::helper('paymill/loggingHelper')->log("Starting payment process as debit");
201
+ $this->_preAuthFlag = false;
202
+
203
  }
204
+
205
+ $success = $this->payment($payment, $amount);
206
 
207
  if (!$success) {
208
  Mage::helper('paymill/loggingHelper')->log(Mage::helper("paymill/paymentHelper")->getErrorMessage($this->_errorCode));
218
  * Deals with payment processing when debit mode is active
219
  * @return booelan Indicator of success
220
  */
221
+ public function payment(Varien_Object $payment, $amount)
222
  {
223
  //Gathering data from session
224
  $token = Mage::getSingleton('core/session')->getToken();
229
 
230
  //Always load client if email doesn't change
231
  $clientId = $fcHelper->getClientId();
232
+ if (isset($clientId) && !is_null(Mage::helper("paymill/customerHelper")->getClientData())) {
233
  $paymentProcessor->setClientId($clientId);
234
  }
235
 
236
  //Loading Fast Checkout Data (if enabled and given)
237
  if ($fcHelper->hasData($this->_code) && $token === 'dummyToken') {
238
  $paymentId = $fcHelper->getPaymentId($this->_code);
239
+ if (isset($paymentId) && !is_null($fcHelper->getPaymentData($this->_code))) {
240
  $paymentProcessor->setPaymentId($paymentId);
241
  }
242
  }
243
 
244
+ $success = $paymentProcessor->processPayment(!$this->_preAuthFlag);
245
 
246
  If ($success) {
247
  //Save Transaction Data
248
  $transactionHelper = Mage::helper("paymill/transactionHelper");
249
+
250
+ $id = $paymentProcessor->getTransactionId();
251
+ if ($this->_preAuthFlag) {
252
+ $id = $paymentProcessor->getPreauthId();
253
+ }
254
+
255
+ $transactionModel = $transactionHelper->createTransactionModel($id, $this->_preAuthFlag);
256
  $transactionHelper->setAdditionalInformation($payment, $transactionModel);
257
 
258
  //Allways update the client
app/code/community/Paymill/Paymill/Model/Method/MethodModelCreditcard.php CHANGED
@@ -42,61 +42,6 @@ class Paymill_Paymill_Model_Method_MethodModelCreditcard extends Paymill_Paymill
42
  */
43
  protected $_infoBlockType = 'paymill/payment_info_paymentFormCreditcard';
44
 
45
- /**
46
- * Deals with payment processing when preAuth mode is active
47
- */
48
- public function preAuth(Varien_Object $payment, $amount)
49
- {
50
- //Gathering data from session
51
- $token = Mage::getSingleton('core/session')->getToken();
52
-
53
- //Create Payment Processor
54
- $paymentHelper = Mage::helper("paymill/paymentHelper");
55
- $fcHelper = Mage::helper("paymill/fastCheckoutHelper");
56
- $paymentProcessor = $paymentHelper->createPaymentProcessor($this->getCode(), $token);
57
-
58
- //Always load client if email doesn't change
59
- $clientId = $fcHelper->getClientId();
60
- if (isset($clientId)) {
61
- $paymentProcessor->setClientId($clientId);
62
- }
63
-
64
- //Loading Fast Checkout Data (if enabled and given)
65
- if ($fcHelper->hasData($this->_code) && $token === 'dummyToken') {
66
- $paymentId = $fcHelper->getPaymentId($this->_code);
67
- if (isset($paymentId)) {
68
- $paymentProcessor->setPaymentId($paymentId);
69
- }
70
- }
71
-
72
- //Process Payment
73
- $success = $paymentProcessor->processPayment(false);
74
-
75
- If ($success) {
76
- //Save Transaction Data
77
- $transactionHelper = Mage::helper("paymill/transactionHelper");
78
- $transactionModel = $transactionHelper->createTransactionModel($paymentProcessor->getPreauthId(), true);
79
- $transactionHelper->setAdditionalInformation($payment, $transactionModel);
80
-
81
-
82
- //Allways update the client
83
- $clientId = $paymentProcessor->getClientId();
84
- $fcHelper->saveData($this->_code, $clientId);
85
-
86
- //Save payment data for FastCheckout (if enabled)
87
- if ($fcHelper->isFastCheckoutEnabled()) { //Fast checkout enabled
88
- $paymentId = $paymentProcessor->getPaymentId();
89
- $fcHelper->saveData($this->_code, $clientId, $paymentId);
90
- }
91
-
92
- return true;
93
- }
94
-
95
- $this->_errorCode = $paymentProcessor->getErrorCode();
96
-
97
- return false;
98
- }
99
-
100
  /**
101
  * Gets called when a capture gets triggered (default on invoice generation)
102
  *
42
  */
43
  protected $_infoBlockType = 'paymill/payment_info_paymentFormCreditcard';
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  /**
46
  * Gets called when a capture gets triggered (default on invoice generation)
47
  *
app/code/community/Paymill/Paymill/Model/Observer.php CHANGED
@@ -30,7 +30,7 @@ class Paymill_Paymill_Model_Observer
30
  public function generateInvoice(Varien_Event_Observer $observer)
31
  {
32
  $order = $observer->getEvent()->getOrder();
33
- if ($order->getPayment()->getMethod() === 'paymill_creditcard' || $order->getPayment()->getMethod() === 'paymill_directdebit') {
34
  if (Mage::helper('paymill/transactionHelper')->getPreAuthenticatedFlagState($order)) { // If the transaction is not flagged as a debit (not a preAuth) transaction
35
  Mage::helper('paymill/loggingHelper')->log("Debug", "No Invoice generated, since the transaction is flagged as preauth");
36
  } else {
@@ -42,8 +42,9 @@ class Paymill_Paymill_Model_Observer
42
  ->addObject($invoice)
43
  ->addObject($invoice->getOrder())
44
  ->save();
 
 
45
 
46
- $invoice->sendEmail(true, '');
47
  $this->_changeOrderStatus($order);
48
  }
49
  }
@@ -52,7 +53,7 @@ class Paymill_Paymill_Model_Observer
52
 
53
  private function _changeOrderStatus($order)
54
  {
55
- $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true);
56
  $order->save();
57
  }
58
 
30
  public function generateInvoice(Varien_Event_Observer $observer)
31
  {
32
  $order = $observer->getEvent()->getOrder();
33
+ if ($order->getPayment()->getMethod() === 'paymill_creditcard') {
34
  if (Mage::helper('paymill/transactionHelper')->getPreAuthenticatedFlagState($order)) { // If the transaction is not flagged as a debit (not a preAuth) transaction
35
  Mage::helper('paymill/loggingHelper')->log("Debug", "No Invoice generated, since the transaction is flagged as preauth");
36
  } else {
42
  ->addObject($invoice)
43
  ->addObject($invoice->getOrder())
44
  ->save();
45
+
46
+ $invoice->sendEmail(Mage::getStoreConfig('payment/paymill_creditcard/send_invoice_mail', Mage::app()->getStore()->getStoreId()), '');
47
 
 
48
  $this->_changeOrderStatus($order);
49
  }
50
  }
53
 
54
  private function _changeOrderStatus($order)
55
  {
56
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
57
  $order->save();
58
  }
59
 
app/code/community/Paymill/Paymill/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Paymill_Paymill>
5
- <version>3.5.0</version>
6
  </Paymill_Paymill>
7
  </modules>
8
 
2
  <config>
3
  <modules>
4
  <Paymill_Paymill>
5
+ <version>3.5.3</version>
6
  </Paymill_Paymill>
7
  </modules>
8
 
app/code/community/Paymill/Paymill/etc/system.xml CHANGED
@@ -11,7 +11,7 @@
11
  <sort_order>700</sort_order>
12
  <fields>
13
  <version>
14
- <label>v3.5.0</label>
15
  <sort_order>1</sort_order>
16
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
17
  <frontend_type>label</frontend_type>
@@ -66,15 +66,6 @@
66
  <show_in_website>1</show_in_website>
67
  <show_in_store>1</show_in_store>
68
  </logging_active>
69
- <show_label translate="label">
70
- <label>paymill_Show_Label</label>
71
- <sort_order>9</sort_order>
72
- <frontend_type>select</frontend_type>
73
- <source_model>adminhtml/system_config_source_yesno</source_model>
74
- <show_in_default>1</show_in_default>
75
- <show_in_website>1</show_in_website>
76
- <show_in_store>1</show_in_store>
77
- </show_label>
78
  </fields>
79
  </paymill>
80
 
@@ -86,7 +77,7 @@
86
  <sort_order>800</sort_order>
87
  <fields>
88
  <version>
89
- <label>v3.5.0</label>
90
  <sort_order>100</sort_order>
91
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
92
  <frontend_type>label</frontend_type>
@@ -140,6 +131,18 @@
140
  <show_in_website>1</show_in_website>
141
  <show_in_store>1</show_in_store>
142
  </preAuth_active>
 
 
 
 
 
 
 
 
 
 
 
 
143
  <sort_order translate="label">
144
  <label>paymill_opt_Sort</label>
145
  <frontend_type>text</frontend_type>
@@ -159,7 +162,7 @@
159
  <sort_order>800</sort_order>
160
  <fields>
161
  <version>
162
- <label>v3.5.0</label>
163
  <sort_order>100</sort_order>
164
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
165
  <frontend_type>label</frontend_type>
11
  <sort_order>700</sort_order>
12
  <fields>
13
  <version>
14
+ <label>v3.5.3</label>
15
  <sort_order>1</sort_order>
16
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
17
  <frontend_type>label</frontend_type>
66
  <show_in_website>1</show_in_website>
67
  <show_in_store>1</show_in_store>
68
  </logging_active>
 
 
 
 
 
 
 
 
 
69
  </fields>
70
  </paymill>
71
 
77
  <sort_order>800</sort_order>
78
  <fields>
79
  <version>
80
+ <label>v3.5.3</label>
81
  <sort_order>100</sort_order>
82
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
83
  <frontend_type>label</frontend_type>
131
  <show_in_website>1</show_in_website>
132
  <show_in_store>1</show_in_store>
133
  </preAuth_active>
134
+ <send_invoice_mail translate="label">
135
+ <label>paymill_send_invoice_mail</label>
136
+ <sort_order>370</sort_order>
137
+ <frontend_type>select</frontend_type>
138
+ <source_model>adminhtml/system_config_source_yesno</source_model>
139
+ <show_in_default>1</show_in_default>
140
+ <show_in_website>1</show_in_website>
141
+ <show_in_store>1</show_in_store>
142
+ <depends>
143
+ <preAuth_active>0</preAuth_active>
144
+ </depends>
145
+ </send_invoice_mail>
146
  <sort_order translate="label">
147
  <label>paymill_opt_Sort</label>
148
  <frontend_type>text</frontend_type>
162
  <sort_order>800</sort_order>
163
  <fields>
164
  <version>
165
+ <label>v3.5.3</label>
166
  <sort_order>100</sort_order>
167
  <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
168
  <frontend_type>label</frontend_type>
app/code/community/Paymill/Paymill/sql/paymill_setup/mysql4-install-3.0.0.php CHANGED
@@ -42,6 +42,13 @@ $installer->run("
42
  UNIQUE KEY `userId` (`user_id`)
43
  ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
44
  ");
45
-
 
 
 
 
 
 
 
46
 
47
  $installer->endSetup();
42
  UNIQUE KEY `userId` (`user_id`)
43
  ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;
44
  ");
45
+
46
+ $installer->run("UPDATE sales_flat_quote_payment SET method = 'paymill_creditcard' WHERE method = 'paymillcc';");
47
+
48
+ $installer->run("UPDATE sales_flat_order_payment SET method = 'paymill_creditcard' WHERE method = 'paymillcc';");
49
+
50
+ $installer->run("UPDATE sales_flat_quote_payment SET method = 'paymill_directdebit' WHERE method = 'paymillelv';");
51
+
52
+ $installer->run("UPDATE sales_flat_order_payment SET method = 'paymill_directdebit' WHERE method = 'paymillelv';");
53
 
54
  $installer->endSetup();
app/code/community/Paymill/Paymillcc/Block/Form/Paymill.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Paymill_Paymillcc_Block_Form_Paymill extends Mage_Payment_Block_Form
4
+ {
5
+ public $paymillBridgeEndpoint;
6
+ public $paymillPublicApiKey;
7
+ public $paymillDebugMode = "false";
8
+
9
+ protected function _construct()
10
+ {
11
+
12
+ // read some configuration data
13
+ $this->paymillPublicApiKey = Mage::getStoreConfig(
14
+ 'payment/paymillcc/paymill_public_api_key',
15
+ Mage::app()->getStore()
16
+ );
17
+
18
+ $this->paymillBridgeEndpoint = Mage::getStoreConfig(
19
+ 'payment/paymillcc/paymill_bridge_endpoint',
20
+ Mage::app()->getStore()
21
+ );
22
+
23
+ $this->paymillDebugMode = Mage::getStoreConfig(
24
+ 'payment/paymillcc/paymill_debug_mode',
25
+ Mage::app()->getStore()
26
+ );
27
+
28
+ $this->showPaymillLabel = Mage::getStoreConfig(
29
+ 'payment/paymillcc/paymill_show_credits',
30
+ Mage::app()->getStore()
31
+ );
32
+
33
+ $this->paymillLibVersion = Mage::getStoreConfig(
34
+ 'payment/paymillcc/paymill_lib_version',
35
+ Mage::app()->getStore()
36
+ );
37
+
38
+ $this->paymillApiEndpoint = Mage::getStoreConfig(
39
+ 'payment/paymillcc/paymill_api_endpoint',
40
+ Mage::app()->getStore()
41
+ );
42
+
43
+ $this->paymillPaymentAmount = Mage::getSingleton('core/session')->getPaymillPaymentAmount();
44
+ $this->paymillPaymentCurrency = Mage::getSingleton('core/session')->getPaymillPaymentCurrency();
45
+
46
+ if ($this->paymillDebugMode == "") {
47
+ $this->paymillDebugMode = "false";
48
+ }
49
+
50
+ parent::_construct();
51
+
52
+ // load paymill form
53
+ $this->setTemplate('paymill/form/paymill.phtml');
54
+ }
55
+ }
56
+
57
+ ?>
app/code/community/Paymill/Paymillcc/Block/Info/Paymill.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Paymill_Paymillcc_Block_Info_Paymill extends Mage_Payment_Block_Info_Cc
4
+ {
5
+ /**
6
+ * Prepare credit card related payment info
7
+ *
8
+ * @param Varien_Object|array $transport
9
+ * @return Varien_Object
10
+ */
11
+ protected function _prepareSpecificInformation($transport = null)
12
+ {
13
+ $transport = parent::_prepareSpecificInformation($transport);
14
+ $additionalInformation = array();
15
+ if(Mage::app()->getStore()->isAdmin()) {
16
+ $order = Mage::registry('current_order');
17
+ if(!$order && Mage::registry('current_shipment')) {
18
+ $order = Mage::registry('current_shipment')->getOrder();
19
+ }
20
+ elseif (!$order && Mage::registry('current_invoice')) {
21
+ $order = Mage::registry('current_invoice')->getOrder();
22
+ } elseif (!$order && Mage::registry('current_creditmemo')) {
23
+ $order = Mage::registry('current_creditmemo')->getOrder();
24
+ }
25
+ if($order) {
26
+ $additionalInformation = array(
27
+ 'Transaction ID' => ' ' . $order->getPayment()->getAdditionalInformation('paymill_transaction_id')
28
+ );
29
+ }
30
+ }
31
+
32
+ return $transport->setData($additionalInformation);
33
+ }
34
+ }
app/code/community/Paymill/Paymillcc/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class Paymill_Paymillcc_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+ }
6
+ ?>
app/code/community/Paymill/Paymillcc/LibraryVersion.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Paymill_Paymillcc_LibraryVersion
4
+ {
5
+
6
+ public function toOptionArray()
7
+ {
8
+ return array(
9
+ array('value' => 'v2', 'label' => 'V2')
10
+ );
11
+ }
12
+
13
+ }
app/code/community/Paymill/Paymillcc/Model/Customerdata.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category PayIntelligent
16
+ * @package PayIntelligent_RatePAY
17
+ * @copyright Copyright (c) 2011 PayIntelligent GmbH (http://www.payintelligent.de)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Paymill_Paymillcc_Model_Customerdata extends Mage_Core_Model_Abstract
22
+ {
23
+
24
+ /**
25
+ * Construct
26
+ */
27
+ function _construct()
28
+ {
29
+ parent::_construct();
30
+ $this->_init('paymillcc/customerdata');
31
+ }
32
+
33
+ public function setEntry($customerId, $data)
34
+ {
35
+ //$this->setId(null);
36
+ $this->setUserId($customerId);
37
+ $this->setUserData($data);
38
+ $this->save();
39
+
40
+ }
41
+
42
+ public function loadByUserId($customerId)
43
+ {
44
+ return $this->loadByAttribute('user_id', $customerId);
45
+ }
46
+
47
+ public function loadByAttribute($attribute, $value, $additionalAttributes = '*')
48
+ {
49
+ $collection = $this->getResourceCollection()
50
+ ->addFieldToSelect($additionalAttributes)
51
+ ->addFieldToFilter($attribute, $value);
52
+
53
+ foreach ($collection as $object) {
54
+ return $object;
55
+ }
56
+
57
+ return null;
58
+ }
59
+
60
+ }
app/code/community/Paymill/Paymillcc/Model/Mysql4/Customerdata.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category PayIntelligent
16
+ * @package PayIntelligent_RatePAY
17
+ * @copyright Copyright (c) 2011 PayIntelligent GmbH (http://www.payintelligent.de)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Paymill_Paymillcc_Model_Mysql4_Customerdata extends Mage_Core_Model_Mysql4_Abstract
22
+ {
23
+
24
+ /**
25
+ * Construct
26
+ */
27
+ function _construct()
28
+ {
29
+ $this->_init('paymillcc/customerdata', 'id');
30
+ }
31
+ }
app/code/community/Paymill/Paymillcc/Model/Mysql4/Customerdata/Collection.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category PayIntelligent
16
+ * @package PayIntelligent_RatePAY
17
+ * @copyright Copyright (c) 2011 PayIntelligent GmbH (http://www.payintelligent.de)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Paymill_Paymillcc_Model_Mysql4_Customerdata_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
22
+ {
23
+ /**
24
+ * Construct
25
+ */
26
+ public function _construct()
27
+ {
28
+ parent::_construct();
29
+ $this->_init('paymillcc/customerdata');
30
+ }
31
+ }
app/code/community/Paymill/Paymillcc/Model/PaymentAbstract.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Paymill_Paymillcc_Model_PaymentAbstract extends Mage_Payment_Model_Method_Cc
4
+ {
5
+ /**
6
+ * Processes the payment against the paymill API
7
+ * @param $params array The settings array
8
+ * @return boolean
9
+ */
10
+ protected function _processPayment($params)
11
+ {
12
+
13
+ // setup the logger
14
+ $logger = $params['loggerCallback'];
15
+
16
+ // setup client params
17
+ $clientParams = array(
18
+ 'email' => $params['email'],
19
+ 'description' => $params['name']
20
+ );
21
+
22
+ // setup credit card params
23
+ $paymentParams = array(
24
+ 'token' => $params['token']
25
+ );
26
+
27
+ // setup transaction params
28
+ $transactionParams = array(
29
+ 'amount' => $params['amount'],
30
+ 'currency' => $params['currency'],
31
+ 'description' => $params['description']
32
+ );
33
+
34
+ require_once $params['libBase'] . 'Services/Paymill/Transactions.php';
35
+ require_once $params['libBase'] . 'Services/Paymill/Clients.php';
36
+ require_once $params['libBase'] . 'Services/Paymill/Payments.php';
37
+
38
+ $clientsObject = new Services_Paymill_Clients(
39
+ $params['privateKey'], $params['apiUrl']
40
+ );
41
+ $transactionsObject = new Services_Paymill_Transactions(
42
+ $params['privateKey'], $params['apiUrl']
43
+ );
44
+ $paymentsObject = new Services_Paymill_Payments(
45
+ $params['privateKey'], $params['apiUrl']
46
+ );
47
+
48
+ // perform conection to the Paymill API and trigger the payment
49
+ try {
50
+ if (!array_key_exists('client_id', $params)) {
51
+ $client = $clientsObject->create($clientParams);
52
+ if (!isset($client['id'])) {
53
+ call_user_func_array($logger, array("No client created" . var_export($client, true)));
54
+ return false;
55
+ } else {
56
+ call_user_func_array($logger, array("Client created: " . $client['id']));
57
+ }
58
+
59
+ // create card
60
+ $paymentParams['client'] = $client['id'];
61
+ } else {
62
+ $paymentParams['client'] = $params['client_id'];
63
+ }
64
+
65
+ $payment = $paymentsObject->create($paymentParams);
66
+ if (!array_key_exists('client_id', $params)) {
67
+ if (!isset($payment['id'])) {
68
+ call_user_func_array($logger, array("No payment (credit card) created: " . var_export($payment, true) . " with params " . var_export($paymentParams, true)));
69
+ return false;
70
+ } else {
71
+ call_user_func_array($logger, array("Payment (credit card) created: " . $payment['id']));
72
+ }
73
+
74
+ // create transaction
75
+ //$transactionParams['client'] = $client['id'];
76
+ $transactionParams['payment'] = $payment['id'];
77
+ } else {
78
+ $transactionParams['payment'] = $params['payment_id'];
79
+ }
80
+
81
+ $transaction = $transactionsObject->create($transactionParams);
82
+
83
+ if(isset($transaction['data']['response_code'])){
84
+ call_user_func_array($logger, array("An Error occured: " . var_export($transaction, true)));
85
+ return false;
86
+ }
87
+
88
+ if (!isset($transaction['id'])) {
89
+ call_user_func_array($logger, array("No transaction created" . var_export($transaction, true)));
90
+ return false;
91
+ } else {
92
+ $this->_setPaymillClientToken($client['id']);
93
+ $this->_setPaymillPaymentToken($payment['id']);
94
+ $this->_setPaymillTransactionId($transaction['id']);
95
+ call_user_func_array($logger, array("Transaction created: " . $transaction['id']));
96
+ }
97
+
98
+ // check result
99
+ if (is_array($transaction) && array_key_exists('status', $transaction)) {
100
+ if ($transaction['status'] == "closed") {
101
+ // transaction was successfully issued
102
+ return true;
103
+ } elseif ($transaction['status'] == "open") {
104
+ // transaction was issued but status is open for any reason
105
+ call_user_func_array($logger, array("Status is open."));
106
+ return false;
107
+ } else {
108
+ // another error occured
109
+ call_user_func_array($logger, array("Unknown error." . var_export($transaction, true)));
110
+ return false;
111
+ }
112
+ } else {
113
+ // another error occured
114
+ call_user_func_array($logger, array("Transaction could not be issued."));
115
+ return false;
116
+ }
117
+ } catch (Services_Paymill_Exception $ex) {
118
+ // paymill wrapper threw an exception
119
+ call_user_func_array($logger, array("Exception thrown from paymill wrapper: " . $ex->getMessage()));
120
+ return false;
121
+ }
122
+
123
+ return true;
124
+ }
125
+
126
+ protected abstract function _setPaymillClientToken($id);
127
+
128
+ protected abstract function _setPaymillPaymentToken($id);
129
+
130
+ protected abstract function _setPaymillTransactionId($id);
131
+ }
app/code/community/Paymill/Paymillcc/Model/PaymentMethod.php ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // require this here due to a Magento bug
4
+ require_once 'lib/Zend/Log.php';
5
+ require_once 'lib/Zend/Log/Formatter/Simple.php';
6
+ require_once 'lib/Zend/Log/Writer/Stream.php';
7
+
8
+ class Paymill_Paymillcc_Model_PaymentMethod extends Paymill_Paymillcc_Model_PaymentAbstract
9
+ {
10
+
11
+ /**
12
+ * unique internal payment method identifier
13
+ *
14
+ * @var string [a-z0-9_]
15
+ */
16
+ protected $_code = 'paymillcc';
17
+ protected $_formBlockType = 'paymillcc/form_paymill';
18
+ protected $_infoBlockType = 'paymillcc/info_paymill';
19
+
20
+ /**
21
+ * Is this payment method a gateway (online auth/charge) ?
22
+ */
23
+ protected $_isGateway = false;
24
+
25
+ /**
26
+ * Can authorize online?
27
+ */
28
+ protected $_canAuthorize = true;
29
+
30
+ /**
31
+ * Can capture funds online?
32
+ */
33
+ protected $_canCapture = false;
34
+
35
+ /**
36
+ * Can capture partial amounts online?
37
+ */
38
+ protected $_canCapturePartial = false;
39
+
40
+ /**
41
+ * Can refund online?
42
+ */
43
+ protected $_canRefund = false;
44
+
45
+ /**
46
+ * Can void transactions online?
47
+ */
48
+ protected $_canVoid = true;
49
+
50
+ /**
51
+ * Can use this payment method in administration panel?
52
+ */
53
+ protected $_canUseInternal = false;
54
+
55
+ /**
56
+ * Can show this payment method as an option on checkout payment page?
57
+ */
58
+ protected $_canUseCheckout = true;
59
+
60
+ /**
61
+ * Is this payment method suitable for multi-shipping checkout?
62
+ */
63
+ protected $_canUseForMultishipping = true;
64
+
65
+ /**
66
+ * Can save credit card information for future processing?
67
+ */
68
+ protected $_canSaveCc = false;
69
+
70
+ /**
71
+ */
72
+ public function assignData($data)
73
+ {
74
+
75
+ if (!($data instanceof Varien_Object)) {
76
+ $data = new Varien_Object($data);
77
+ }
78
+
79
+ $info = $this->getInfoInstance();
80
+
81
+ // read the paymill_transaction_token from the credit
82
+ // card form and store it for later use
83
+ $info->setAdditionalInformation(
84
+ "paymill_transaction_token", $data->paymill_transaction_token
85
+ );
86
+
87
+ return $this;
88
+ }
89
+
90
+ /**
91
+ * Serverside validations.
92
+ */
93
+ public function validate()
94
+ {
95
+ $info = $this->getInfoInstance();
96
+ $token = $info->getAdditionalInformation("paymill_transaction_token");
97
+ if (!$token && is_null(Mage::getSingleton("paymillcc/customerdata")->loadByUserId(Mage::getSingleton('customer/session')->getCustomer()->getId()))) {
98
+ self::logAction("No transaction code was received in PaymentMethod (Paymill_Paymillcc_Model_PaymentMethod::validate)");
99
+ Mage::throwException(
100
+ Mage::helper('paymillelv')->__("Error while performing your payment. The payment was not processed.")
101
+ );
102
+ }
103
+ return $this;
104
+ }
105
+
106
+ /**
107
+ * This method is triggered after order is placed.
108
+ *
109
+ * @return boolean Returns true if the payment was successfully processed
110
+ */
111
+ public function authorize(Varien_Object $payment, $amount)
112
+ {
113
+ $info = $this->getInfoInstance();
114
+ // retrieve the transaction_token and save it for later processing
115
+ $token = $info->getAdditionalInformation("paymill_transaction_token");
116
+
117
+ // process the payment
118
+ $result = $this->processPayment($payment, $amount, $token);
119
+ if ($result == false) {
120
+ $payment->setStatus('ERROR')->setIsTransactionClosed(1)->save();
121
+ throw new Exception(
122
+ Mage::helper('paymillcc')->__("Payment was not successfully processed. See log.")
123
+ );
124
+ }
125
+
126
+ if (Mage::getSingleton('customer/session')->isLoggedIn() && Mage::getStoreConfig('payment/paymillcc/recurring', Mage::app()->getStore())) {
127
+ if (is_null(Mage::getSingleton("paymillcc/customerdata")->loadByUserId(Mage::getSingleton('customer/session')->getCustomer()->getId()))) {
128
+ Mage::getSingleton("paymillcc/customerdata")->setEntry(
129
+ Mage::getSingleton('customer/session')->getCustomer()->getId(),
130
+ Mage::getSingleton('core/session')->getPaymillCcClientToken() . '|' . Mage::getSingleton('core/session')->getPaymillCcPaymentToken()
131
+ );
132
+ }
133
+ }
134
+
135
+ $transactionId = Mage::getSingleton('core/session')->getPaymillTransactionId();
136
+ $info->setAdditionalInformation('paymill_transaction_id', $transactionId);
137
+ $payment->setStatus('APPROVED')
138
+ ->setTransactionId($transactionId)
139
+ ->setIsTransactionClosed(1)
140
+ ->save();
141
+
142
+
143
+ return $this;
144
+ }
145
+
146
+ /**
147
+ * This method triggers the payment.
148
+ * It is triggered when the invoice is created.
149
+ * @return void
150
+ */
151
+ public function capture(Varien_Object $payment, $amount)
152
+ {
153
+ return $this;
154
+ }
155
+
156
+ /**
157
+ * Specify currency support
158
+ */
159
+ public function canUseForCurrency($currency)
160
+ {
161
+ $currency = Mage::getSingleton('checkout/session')->getQuote()->getQuoteCurrencyCode();
162
+ Mage::getSingleton('core/session')->setPaymillPaymentCurrency($currency);
163
+ $acceptedCurrencies = Mage::getStoreConfig(
164
+ 'payment/paymillcc/paymill_accepted_currencies', Mage::app()->getStore()
165
+ );
166
+
167
+ $acceptedCurrenciesExploded = explode(',', trim(strtolower($acceptedCurrencies)));
168
+
169
+ if (!in_array(strtolower($currency), $acceptedCurrenciesExploded)) {
170
+ return false;
171
+ }
172
+
173
+ return true;
174
+ }
175
+
176
+ /**
177
+ * Specify minimum order amount from config
178
+ * @return boolean Returns true if the payment method is available for the current context
179
+ */
180
+ public function isAvailable($quote = null)
181
+ {
182
+ if (is_object($quote)) {
183
+ $amount = number_format($quote->getBaseGrandTotal(), 2, '.', '');
184
+
185
+ Mage::getSingleton('core/session')->setPaymillPaymentAmount($amount);
186
+
187
+ // is active
188
+ $paymillActive = Mage::getStoreConfig(
189
+ 'payment/paymillcc/active', Mage::app()->getStore()
190
+ );
191
+
192
+ if (!$paymillActive) {
193
+ return false;
194
+ }
195
+
196
+ // get minimum order amount
197
+ $paymillMinimumOrderAmount = Mage::getStoreConfig(
198
+ 'payment/paymillcc/paymill_minimum_order_amount', Mage::app()->getStore()
199
+ );
200
+
201
+ if ($quote && $quote->getBaseGrandTotal() <= 0.5) {
202
+ return false;
203
+ }
204
+
205
+ if ($quote && $quote->getBaseGrandTotal() <= $paymillMinimumOrderAmount) {
206
+ return false;
207
+ }
208
+
209
+ return true;
210
+ }
211
+
212
+ return false;
213
+ }
214
+
215
+ /**
216
+ * The payment capturing method
217
+ * @param Varien_Object $payment The payment object
218
+ * @param $amount The amount to be captures
219
+ * @return boolean $result Returns true if the payment was successfully processed
220
+ */
221
+ public function processPayment(Varien_Object $payment, $amount, $token)
222
+ {
223
+ // get some relevant objects
224
+ $order = $payment->getOrder();
225
+ $billing = $order->getBillingAddress();
226
+
227
+ // check the library version
228
+ $paymillLibraryVersion = Mage::getStoreConfig(
229
+ 'payment/paymillcc/paymill_lib_version', Mage::app()->getStore()
230
+ );
231
+
232
+ // keep this for further versions
233
+ if ($paymillLibraryVersion == "v2") {
234
+ $libBase = 'lib/paymill/v2/lib/';
235
+ $libVersion = 'v2';
236
+ } else {
237
+ $libBase = 'lib/paymill/v2/lib/';
238
+ $libVersion = 'v2';
239
+ }
240
+
241
+ $data = array(
242
+ 'libVersion' => $libVersion,
243
+ 'token' => $token,
244
+ 'amount' => round($amount * 100),
245
+ 'currency' => strtoupper($payment->getOrder()->getOrderCurrency()->getCode()),
246
+ 'name' => $billing->getName(),
247
+ 'email' => $order->getCustomerEmail(),
248
+ 'description' => 'Order from: '
249
+ . Mage::getStoreConfig('general/store_information/name', Mage::app()->getStore())
250
+ . ' ' . sprintf('#%s, %s', $order->getIncrementId(), $order->getCustomerEmail()),
251
+ 'libBase' => $libBase,
252
+ 'privateKey' => Mage::getStoreConfig(
253
+ 'payment/paymillcc/paymill_private_api_key', Mage::app()->getStore()
254
+ ),
255
+ 'apiUrl' => Mage::getStoreConfig(
256
+ 'payment/paymillcc/paymill_api_endpoint', Mage::app()->getStore()
257
+ ),
258
+ 'loggerCallback' => array('Paymill_Paymillcc_Model_PaymentMethod', 'logAction')
259
+ );
260
+
261
+ $paymillUser = Mage::getSingleton("paymillcc/customerdata")->loadByUserId(Mage::getSingleton('customer/session')->getCustomer()->getId());
262
+ if (!is_null($paymillUser)){
263
+ $token = explode('|', $paymillUser->getUserData());
264
+ $data['client_id'] = $token[0];
265
+ $data['payment_id'] = $token[1];
266
+ }
267
+
268
+ // process the payment
269
+ $result = $this->_processPayment($data);
270
+
271
+
272
+
273
+ return $result;
274
+ }
275
+
276
+ protected function _setPaymillClientToken($id)
277
+ {
278
+ Mage::getSingleton('core/session')->setPaymillCcClientToken($id);
279
+ }
280
+
281
+ protected function _setPaymillPaymentToken($id)
282
+ {
283
+ Mage::getSingleton('core/session')->setPaymillCcPaymentToken($id);
284
+ }
285
+
286
+ protected function _setPaymillTransactionId($id)
287
+ {
288
+ Mage::getSingleton('core/session')->setPaymillTransactionId($id);
289
+ }
290
+
291
+ /**
292
+ * Logs an event
293
+ * @param $message The message to be logged
294
+ */
295
+ public static function logAction($message)
296
+ {
297
+ Mage::log($message);
298
+ }
299
+
300
+ }
app/code/community/Paymill/Paymillcc/etc/config.xml ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Paymill_Paymillcc>
5
+ <version>2.1.4</version>
6
+ </Paymill_Paymillcc>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <paymillcc>
11
+ <class>Paymill_Paymillcc_Block</class>
12
+ </paymillcc>
13
+ </blocks>
14
+ <models>
15
+ <paymillcc>
16
+ <class>Paymill_Paymillcc_Model</class>
17
+ <resourceModel>paymillcc_mysql4</resourceModel>
18
+ </paymillcc>
19
+
20
+ <paymillcc_mysql4>
21
+ <class>Paymill_Paymillcc_Model_Mysql4</class>
22
+ <entities>
23
+ <customerdata>
24
+ <table>paymill_cc_additional_customer_data</table>
25
+ </customerdata>
26
+ </entities>
27
+ </paymillcc_mysql4>
28
+ </models>
29
+ <resources>
30
+ <paymillcc_setup>
31
+ <setup>
32
+ <module>Paymill_Paymillcc</module>
33
+ </setup>
34
+ <connection>
35
+ <use>core_setup</use>
36
+ </connection>
37
+ </paymillcc_setup>
38
+ <paymillcc_write>
39
+ <connection>
40
+ <use>core_write</use>
41
+ </connection>
42
+ </paymillcc_write>
43
+ <paymillcc_read>
44
+ <connection>
45
+ <use>core_read</use>
46
+ </connection>
47
+ </paymillcc_read>
48
+ </resources>
49
+ <helpers>
50
+ <paymillcc>
51
+ <class>Paymill_Paymillcc_Helper</class>
52
+ </paymillcc>
53
+ </helpers>
54
+ </global>
55
+ <frontend>
56
+ <translate>
57
+ <modules>
58
+ <Paymill_Paymillcc>
59
+ <files>
60
+ <default>Paymill_Paymillcc.csv</default>
61
+ </files>
62
+ </Paymill_Paymillcc>
63
+ </modules>
64
+ </translate>
65
+ </frontend>
66
+ <adminhtml>
67
+ <translate>
68
+ <modules>
69
+ <Paymill_Paymillcc>
70
+ <files>
71
+ <default>Paymill_Paymillcc.csv</default>
72
+ </files>
73
+ </Paymill_Paymillcc>
74
+ </modules>
75
+ </translate>
76
+ </adminhtml>
77
+ <default>
78
+ <payment>
79
+ <paymillcc>
80
+ <active>0</active>
81
+ <model>paymillcc/paymentMethod</model>
82
+ <order_status>pending</order_status>
83
+ <title>Kreditkartenzahlung</title>
84
+ <cctypes>VI,MC</cctypes>
85
+ <payment_action>authorize</payment_action>
86
+ <allowspecific>0</allowspecific>
87
+ <paymill_bridge_endpoint>https://bridge.paymill.com/</paymill_bridge_endpoint>
88
+ <paymill_api_endpoint>https://api.paymill.com/v2/</paymill_api_endpoint>
89
+ <paymill_show_credits>1</paymill_show_credits>
90
+ <paymill_accepted_currencies>EUR</paymill_accepted_currencies>
91
+ <paymill_lib_version>v2</paymill_lib_version>
92
+ </paymillcc>
93
+ </payment>
94
+ </default>
95
+ </config>
app/code/community/Paymill/Paymillcc/etc/system.xml ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <!-- payment tab -->
5
+ <payment>
6
+ <groups>
7
+ <!-- newmodule fieldset -->
8
+ <paymillcc translate="label" module="paymillcc">
9
+ <!-- will have title 'New Module' -->
10
+ <label>Paymill Kreditkartenzahlung</label>
11
+ <!-- position between other payment methods -->
12
+ <sort_order>1</sort_order>
13
+ <!-- do not show this configuration options in store scope -->
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <comment><![CDATA[<a href="https://www.paymill.de/" target="_blank">Click here to get a Paymill account</a>]]></comment>
18
+ <fields>
19
+ <!-- is this payment method active for the website? -->
20
+ <active translate="label">
21
+ <!-- label for the field -->
22
+ <label>Enabled</label>
23
+ <!-- input type for configuration value -->
24
+ <frontend_type>select</frontend_type>
25
+ <!-- model to take the option values from -->
26
+ <source_model>adminhtml/system_config_source_yesno</source_model>
27
+ <!-- field position -->
28
+ <sort_order>1</sort_order>
29
+ <!-- do not show this field in store scope -->
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ </active>
34
+ <recurring translate="label">
35
+ <label>Recurring Payment</label>
36
+ <frontend_type>select</frontend_type>
37
+ <source_model>adminhtml/system_config_source_yesno</source_model>
38
+ <sort_order>2</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ </recurring>
43
+ <sort_order translate="label">
44
+ <label>Sort Order</label>
45
+ <frontend_type>text</frontend_type>
46
+ <sort_order>100</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ <frontend_class>validate-number</frontend_class>
51
+ </sort_order>
52
+ <paymill_minimum_order_amount translate="label">
53
+ <label>Minimum order amount</label>
54
+ <frontend_type>text</frontend_type>
55
+ <sort_order>100</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>1</show_in_store>
59
+ <frontend_class>validate-number</frontend_class>
60
+ </paymill_minimum_order_amount>
61
+ <paymill_debug_mode translate="label">
62
+ <label>Paymill debug mode</label>
63
+ <frontend_type>select</frontend_type>
64
+ <source_model>adminhtml/system_config_source_yesno</source_model>
65
+ <sort_order>4</sort_order>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ <show_in_store>1</show_in_store>
69
+ </paymill_debug_mode>
70
+ <paymill_private_api_key translate="label">
71
+ <label>Private Paymill API Key</label>
72
+ <frontend_type>text</frontend_type>
73
+ <sort_order>2</sort_order>
74
+ <show_in_default>1</show_in_default>
75
+ <show_in_website>1</show_in_website>
76
+ <show_in_store>1</show_in_store>
77
+ </paymill_private_api_key>
78
+ <paymill_public_api_key translate="label">
79
+ <label>Public Paymill API Key</label>
80
+ <frontend_type>text</frontend_type>
81
+ <sort_order>3</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </paymill_public_api_key>
86
+ <paymill_bridge_endpoint translate="label">
87
+ <label>Paymill bridge URL</label>
88
+ <frontend_type>text</frontend_type>
89
+ <sort_order>5</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>1</show_in_store>
93
+ </paymill_bridge_endpoint>
94
+ <paymill_api_endpoint translate="label">
95
+ <label>Paymill API Endpoint</label>
96
+ <frontend_type>text</frontend_type>
97
+ <sort_order>6</sort_order>
98
+ <show_in_default>1</show_in_default>
99
+ <show_in_website>1</show_in_website>
100
+ <show_in_store>1</show_in_store>
101
+ </paymill_api_endpoint>
102
+ <title>
103
+ <label>Title</label>
104
+ <frontend_type>text</frontend_type>
105
+ <sort_order>8</sort_order>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>1</show_in_website>
108
+ <show_in_store>1</show_in_store>
109
+ </title>
110
+ <order_status translate="label">
111
+ <label>New order status</label>
112
+ <frontend_type>select</frontend_type>
113
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
114
+ <sort_order>9</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ </order_status>
119
+ <paymill_accepted_currencies translate="label">
120
+ <label>Accepted Currencies</label>
121
+ <frontend_type>text</frontend_type>
122
+ <sort_order>10</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
+ </paymill_accepted_currencies>
127
+ <paymill_lib_version translate="label">
128
+ <label>Paymill library version</label>
129
+ <frontend_type>select</frontend_type>
130
+ <source_model>Paymill_Paymillcc_LibraryVersion</source_model>
131
+ <sort_order>11</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>1</show_in_store>
135
+ </paymill_lib_version>
136
+ <paymill_show_credits translate="label">
137
+ <label>Show Paymill label</label>
138
+ <frontend_type>select</frontend_type>
139
+ <source_model>adminhtml/system_config_source_yesno</source_model>
140
+ <sort_order>12</sort_order>
141
+ <show_in_default>1</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <show_in_store>1</show_in_store>
144
+ </paymill_show_credits>
145
+ </fields>
146
+ </paymillcc>
147
+ </groups>
148
+ </payment>
149
+ </sections>
150
+ </config>
app/code/community/Paymill/Paymillcc/sql/paymillcc_setup/mysql4-install-2.1.2.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $installer->run("
7
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('paymill_cc_additional_customer_data')}` (
8
+ `id` int(11) NOT NULL AUTO_INCREMENT,
9
+ `user_id` varchar(255) NOT NULL,
10
+ `user_data` varchar(256) NOT NULL,
11
+ PRIMARY KEY (`id`)
12
+ ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;"
13
+ );
14
+
15
+ $installer->endSetup();
app/code/community/Paymill/Paymillcc/sql/paymillcc_setup/mysql4-upgrade-2.1.1-2.1.2.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $installer->run("
7
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('paymill_cc_additional_customer_data')}` (
8
+ `id` int(11) NOT NULL AUTO_INCREMENT,
9
+ `user_id` varchar(255) NOT NULL,
10
+ `user_data` varchar(256) NOT NULL,
11
+ PRIMARY KEY (`id`)
12
+ ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;"
13
+ );
14
+
15
+ $installer->endSetup();
app/code/community/Paymill/Paymillelv/Block/Form/Paymill.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Paymill_Paymillelv_Block_Form_Paymill extends Mage_Payment_Block_Form
4
+ {
5
+ public $paymillBridgeEndpoint;
6
+ public $paymillPublicApiKey;
7
+ public $paymillDebugMode = "false";
8
+
9
+ protected function _construct()
10
+ {
11
+ // read some configuration data
12
+
13
+ $this->paymillPublicApiKey = Mage::getStoreConfig(
14
+ 'payment/paymillelv/paymill_public_api_key',
15
+ Mage::app()->getStore()
16
+ );
17
+
18
+ $this->paymillBridgeEndpoint = Mage::getStoreConfig(
19
+ 'payment/paymillelv/paymill_bridge_endpoint',
20
+ Mage::app()->getStore()
21
+ );
22
+
23
+ $this->paymillDebugMode = Mage::getStoreConfig(
24
+ 'payment/paymillelv/paymill_debug_mode',
25
+ Mage::app()->getStore()
26
+ );
27
+
28
+ $this->showPaymillLabel = Mage::getStoreConfig(
29
+ 'payment/paymillelv/paymill_show_credits',
30
+ Mage::app()->getStore()
31
+ );
32
+
33
+ $this->paymillApiEndpoint = Mage::getStoreConfig(
34
+ 'payment/paymillelv/paymill_api_endpoint',
35
+ Mage::app()->getStore()
36
+ );
37
+
38
+ if ($this->paymillDebugMode == "") {
39
+ $this->paymillDebugMode = "false";
40
+ }
41
+
42
+ parent::_construct();
43
+
44
+ // load paymill form
45
+ $this->setTemplate('paymill/form/paymill_elv.phtml');
46
+ }
47
+ }
48
+
49
+ ?>
app/code/community/Paymill/Paymillelv/Block/Info/Paymill.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Paymill_Paymillelv_Block_Info_Paymill extends Mage_Payment_Block_Info_Cc
4
+ {
5
+ /**
6
+ * Prepare credit card related payment info
7
+ *
8
+ * @param Varien_Object|array $transport
9
+ * @return Varien_Object
10
+ */
11
+ protected function _prepareSpecificInformation($transport = null)
12
+ {
13
+ $transport = parent::_prepareSpecificInformation($transport);
14
+ $additionalInformation = array();
15
+ if(Mage::app()->getStore()->isAdmin()) {
16
+ $order = Mage::registry('current_order');
17
+ if(!$order && Mage::registry('current_shipment')) {
18
+ $order = Mage::registry('current_shipment')->getOrder();
19
+ }
20
+ elseif (!$order && Mage::registry('current_invoice')) {
21
+ $order = Mage::registry('current_invoice')->getOrder();
22
+ } elseif (!$order && Mage::registry('current_creditmemo')) {
23
+ $order = Mage::registry('current_creditmemo')->getOrder();
24
+ }
25
+ if($order) {
26
+ $additionalInformation = array(
27
+ 'Transaction ID' => ' ' . $order->getPayment()->getAdditionalInformation('paymill_transaction_id')
28
+ );
29
+ }
30
+ }
31
+
32
+ return $transport->setData($additionalInformation);
33
+ }
34
+ }
app/code/community/Paymill/Paymillelv/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class Paymill_Paymillelv_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+ }
6
+ ?>
app/code/community/Paymill/Paymillelv/Model/Customerdata.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category PayIntelligent
16
+ * @package PayIntelligent_RatePAY
17
+ * @copyright Copyright (c) 2011 PayIntelligent GmbH (http://www.payintelligent.de)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Paymill_Paymillelv_Model_Customerdata extends Mage_Core_Model_Abstract
22
+ {
23
+
24
+ /**
25
+ * Construct
26
+ */
27
+ function _construct()
28
+ {
29
+ parent::_construct();
30
+ $this->_init('paymillelv/customerdata');
31
+ }
32
+
33
+ public function setEntry($customerId, $data)
34
+ {
35
+ //$this->setId(null);
36
+ $this->setUserId($customerId);
37
+ $this->setUserData($data);
38
+ $this->save();
39
+
40
+ }
41
+
42
+ public function loadByUserId($customerId)
43
+ {
44
+ return $this->loadByAttribute('user_id', $customerId);
45
+ }
46
+
47
+ public function loadByAttribute($attribute, $value, $additionalAttributes = '*')
48
+ {
49
+ $collection = $this->getResourceCollection()
50
+ ->addFieldToSelect($additionalAttributes)
51
+ ->addFieldToFilter($attribute, $value);
52
+
53
+ foreach ($collection as $object) {
54
+ return $object;
55
+ }
56
+
57
+ return null;
58
+ }
59
+
60
+ }
app/code/community/Paymill/Paymillelv/Model/Mysql4/Customerdata.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category PayIntelligent
16
+ * @package PayIntelligent_RatePAY
17
+ * @copyright Copyright (c) 2011 PayIntelligent GmbH (http://www.payintelligent.de)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Paymill_Paymillelv_Model_Mysql4_Customerdata extends Mage_Core_Model_Mysql4_Abstract
22
+ {
23
+
24
+ /**
25
+ * Construct
26
+ */
27
+ function _construct()
28
+ {
29
+ $this->_init('paymillelv/customerdata', 'id');
30
+ }
31
+ }
app/code/community/Paymill/Paymillelv/Model/Mysql4/Customerdata/Collection.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * @category PayIntelligent
16
+ * @package PayIntelligent_RatePAY
17
+ * @copyright Copyright (c) 2011 PayIntelligent GmbH (http://www.payintelligent.de)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ */
20
+
21
+ class Paymill_Paymillelv_Model_Mysql4_Customerdata_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
22
+ {
23
+ /**
24
+ * Construct
25
+ */
26
+ public function _construct()
27
+ {
28
+ parent::_construct();
29
+ $this->_init('paymillelv/customerdata');
30
+ }
31
+ }
app/code/community/Paymill/Paymillelv/Model/PaymentAbstract.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Paymill_Paymillcc_Model_PaymentAbstract extends Mage_Payment_Model_Method_Cc
4
+ {
5
+ /**
6
+ * Processes the payment against the paymill API
7
+ * @param $params array The settings array
8
+ * @return boolean
9
+ */
10
+ protected function _processPayment($params)
11
+ {
12
+
13
+ // setup the logger
14
+ $logger = $params['loggerCallback'];
15
+
16
+ // setup client params
17
+ $clientParams = array(
18
+ 'email' => $params['email'],
19
+ 'description' => $params['name']
20
+ );
21
+
22
+ // setup credit card params
23
+ $paymentParams = array(
24
+ 'token' => $params['token']
25
+ );
26
+
27
+ // setup transaction params
28
+ $transactionParams = array(
29
+ 'amount' => $params['amount'],
30
+ 'currency' => $params['currency'],
31
+ 'description' => $params['description']
32
+ );
33
+
34
+ require_once $params['libBase'] . 'Services/Paymill/Transactions.php';
35
+ require_once $params['libBase'] . 'Services/Paymill/Clients.php';
36
+ require_once $params['libBase'] . 'Services/Paymill/Payments.php';
37
+
38
+ $clientsObject = new Services_Paymill_Clients(
39
+ $params['privateKey'], $params['apiUrl']
40
+ );
41
+ $transactionsObject = new Services_Paymill_Transactions(
42
+ $params['privateKey'], $params['apiUrl']
43
+ );
44
+ $paymentsObject = new Services_Paymill_Payments(
45
+ $params['privateKey'], $params['apiUrl']
46
+ );
47
+
48
+ // perform conection to the Paymill API and trigger the payment
49
+ try {
50
+ if (!array_key_exists('client_id', $params)) {
51
+ $client = $clientsObject->create($clientParams);
52
+ if (!isset($client['id'])) {
53
+ call_user_func_array($logger, array("No client created" . var_export($client, true)));
54
+ return false;
55
+ } else {
56
+ call_user_func_array($logger, array("Client created: " . $client['id']));
57
+ }
58
+
59
+ // create card
60
+ $paymentParams['client'] = $client['id'];
61
+ } else {
62
+ $paymentParams['client'] = $params['client_id'];
63
+ }
64
+
65
+ $payment = $paymentsObject->create($paymentParams);
66
+ if (!array_key_exists('client_id', $params)) {
67
+ if (!isset($payment['id'])) {
68
+ call_user_func_array($logger, array("No payment (credit card) created: " . var_export($payment, true) . " with params " . var_export($paymentParams, true)));
69
+ return false;
70
+ } else {
71
+ call_user_func_array($logger, array("Payment (credit card) created: " . $payment['id']));
72
+ }
73
+
74
+ // create transaction
75
+ //$transactionParams['client'] = $client['id'];
76
+ $transactionParams['payment'] = $payment['id'];
77
+ } else {
78
+ $transactionParams['payment'] = $params['payment_id'];
79
+ }
80
+
81
+ $transaction = $transactionsObject->create($transactionParams);
82
+
83
+ if(isset($transaction['data']['response_code'])){
84
+ call_user_func_array($logger, array("An Error occured: " . var_export($transaction, true)));
85
+ return false;
86
+ }
87
+
88
+ if (!isset($transaction['id'])) {
89
+ call_user_func_array($logger, array("No transaction created" . var_export($transaction, true)));
90
+ return false;
91
+ } else {
92
+ $this->_setPaymillClientToken($client['id']);
93
+ $this->_setPaymillPaymentToken($payment['id']);
94
+ $this->_setPaymillTransactionId($transaction['id']);
95
+ call_user_func_array($logger, array("Transaction created: " . $transaction['id']));
96
+ }
97
+
98
+ // check result
99
+ if (is_array($transaction) && array_key_exists('status', $transaction)) {
100
+ if ($transaction['status'] == "closed") {
101
+ // transaction was successfully issued
102
+ return true;
103
+ } elseif ($transaction['status'] == "open") {
104
+ // transaction was issued but status is open for any reason
105
+ call_user_func_array($logger, array("Status is open."));
106
+ return false;
107
+ } else {
108
+ // another error occured
109
+ call_user_func_array($logger, array("Unknown error." . var_export($transaction, true)));
110
+ return false;
111
+ }
112
+ } else {
113
+ // another error occured
114
+ call_user_func_array($logger, array("Transaction could not be issued."));
115
+ return false;
116
+ }
117
+ } catch (Services_Paymill_Exception $ex) {
118
+ // paymill wrapper threw an exception
119
+ call_user_func_array($logger, array("Exception thrown from paymill wrapper: " . $ex->getMessage()));
120
+ return false;
121
+ }
122
+
123
+ return true;
124
+ }
125
+
126
+ protected abstract function _setPaymillClientToken($id);
127
+
128
+ protected abstract function _setPaymillPaymentToken($id);
129
+
130
+ protected abstract function _setPaymillTransactionId($id);
131
+ }
app/code/community/Paymill/Paymillelv/Model/PaymentMethod.php ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // require this here due to a Magento bug
4
+ require_once 'lib/Zend/Log.php';
5
+ require_once 'lib/Zend/Log/Formatter/Simple.php';
6
+ require_once 'lib/Zend/Log/Writer/Stream.php';
7
+
8
+ class Paymill_Paymillelv_Model_PaymentMethod extends Paymill_Paymillcc_Model_PaymentAbstract
9
+ {
10
+
11
+ /**
12
+ * unique internal payment method identifier
13
+ *
14
+ * @var string [a-z0-9_]
15
+ */
16
+ protected $_code = 'paymillelv';
17
+ protected $_formBlockType = 'paymillelv/form_paymill';
18
+ protected $_infoBlockType = 'paymillelv/info_paymill';
19
+
20
+ /**
21
+ * Is this payment method a gateway (online auth/charge) ?
22
+ */
23
+ protected $_isGateway = false;
24
+
25
+ /**
26
+ * Can authorize online?
27
+ */
28
+ protected $_canAuthorize = true;
29
+
30
+ /**
31
+ * Can capture funds online?
32
+ */
33
+ protected $_canCapture = false;
34
+
35
+ /**
36
+ * Can capture partial amounts online?
37
+ */
38
+ protected $_canCapturePartial = false;
39
+
40
+ /**
41
+ * Can refund online?
42
+ */
43
+ protected $_canRefund = false;
44
+
45
+ /**
46
+ * Can void transactions online?
47
+ */
48
+ protected $_canVoid = true;
49
+
50
+ /**
51
+ * Can use this payment method in administration panel?
52
+ */
53
+ protected $_canUseInternal = false;
54
+
55
+ /**
56
+ * Can show this payment method as an option on checkout payment page?
57
+ */
58
+ protected $_canUseCheckout = true;
59
+
60
+ /**
61
+ * Is this payment method suitable for multi-shipping checkout?
62
+ */
63
+ protected $_canUseForMultishipping = true;
64
+
65
+ /**
66
+ * Can save credit card information for future processing?
67
+ */
68
+ protected $_canSaveCc = false;
69
+
70
+ /**
71
+ */
72
+ public function assignData($data)
73
+ {
74
+
75
+ if (!($data instanceof Varien_Object)) {
76
+ $data = new Varien_Object($data);
77
+ }
78
+
79
+ $info = $this->getInfoInstance();
80
+
81
+ // read the paymill_transaction_token from the credit
82
+ // card form and store it for later use
83
+ $info->setAdditionalInformation(
84
+ "paymill_elv_transaction_token", $data->paymill_elv_transaction_token
85
+ );
86
+ return $this;
87
+ }
88
+
89
+ /**
90
+ * Serverside validations.
91
+ */
92
+ public function validate()
93
+ {
94
+ $info = $this->getInfoInstance();
95
+ $token = $info->getAdditionalInformation("paymill_elv_transaction_token");
96
+ if (!$token && is_null(Mage::getSingleton("paymillelv/customerdata")->loadByUserId(Mage::getSingleton('customer/session')->getCustomer()->getId()))) {
97
+ self::logAction("No transaction code was received in PaymentMethod (Paymill_Paymillelv_Model_PaymentMethod::validate)");
98
+ Mage::throwException(
99
+ Mage::helper('paymillelv')->__("Error while performing your payment. The payment was not processed.")
100
+ );
101
+ }
102
+
103
+ return $this;
104
+ }
105
+
106
+ /**
107
+ * This method is triggered after order is placed.
108
+ *
109
+ * @return boolean Returns true if the payment was successfully processed
110
+ */
111
+ public function authorize(Varien_Object $payment, $amount)
112
+ {
113
+ $info = $this->getInfoInstance();
114
+ // retrieve the transaction_token and save it for later processing
115
+ $token = $info->getAdditionalInformation("paymill_elv_transaction_token");
116
+
117
+ // process the payment
118
+ $result = $this->processPayment($payment, $amount, $token);
119
+ if ($result == false) {
120
+ $payment->setStatus('ERROR')->setIsTransactionClosed(1)->save();
121
+ throw new Exception(
122
+ Mage::helper('paymillelv')->__("Payment was not successfully processed. See log.")
123
+ );
124
+ }
125
+
126
+ if (Mage::getSingleton('customer/session')->isLoggedIn() && Mage::getStoreConfig('payment/paymillelv/recurring', Mage::app()->getStore())) {
127
+ if (is_null(Mage::getSingleton("paymillelv/customerdata")->loadByUserId(Mage::getSingleton('customer/session')->getCustomer()->getId()))) {
128
+ Mage::getSingleton("paymillelv/customerdata")->setEntry(
129
+ Mage::getSingleton('customer/session')->getCustomer()->getId(),
130
+ Mage::getSingleton('core/session')->getPaymillElvClientToken() . '|' . Mage::getSingleton('core/session')->getPaymillElvPaymentToken()
131
+ );
132
+ }
133
+ }
134
+
135
+ $transactionId = Mage::getSingleton('core/session')->getPaymillTransactionId();
136
+ $info->setAdditionalInformation('paymill_transaction_id', $transactionId);
137
+ $payment->setStatus('APPROVED')
138
+ ->setTransactionId($transactionId)
139
+ ->setIsTransactionClosed(1)
140
+ ->save();
141
+
142
+ return $this;
143
+ }
144
+
145
+ /**
146
+ * This method triggers the payment.
147
+ * It is triggered when the invoice is created.
148
+ * @return void
149
+ */
150
+ public function capture(Varien_Object $payment, $amount)
151
+ {
152
+ return $this;
153
+ }
154
+
155
+ /**
156
+ * Specify currency support
157
+ */
158
+ public function canUseForCurrency($currency)
159
+ {
160
+ $currency = Mage::getSingleton('checkout/session')->getQuote()->getQuoteCurrencyCode();
161
+
162
+ $acceptedCurrencies = Mage::getStoreConfig(
163
+ 'payment/paymillelv/paymill_accepted_currencies', Mage::app()->getStore()
164
+ );
165
+ $acceptedCurrenciesExploded = explode(',', trim(strtolower($acceptedCurrencies)));
166
+
167
+ if (!in_array(strtolower($currency), $acceptedCurrenciesExploded)) {
168
+ return false;
169
+ }
170
+
171
+ return true;
172
+ }
173
+
174
+ /**
175
+ * Specify minimum order amount from config
176
+ * @return boolean Returns true if the payment method is available for the current context
177
+ */
178
+ public function isAvailable($quote = null)
179
+ {
180
+ if (is_object($quote)) {
181
+ // is active
182
+ $paymillActive = Mage::getStoreConfig(
183
+ 'payment/paymillelv/active', Mage::app()->getStore()
184
+ );
185
+
186
+ if (!$paymillActive) {
187
+ return false;
188
+ }
189
+
190
+ // get minimum order amount
191
+ $paymillMinimumOrderAmount = Mage::getStoreConfig(
192
+ 'payment/paymillelv/paymill_minimum_order_amount', Mage::app()->getStore()
193
+ );
194
+
195
+ if ($quote && $quote->getBaseGrandTotal() <= 0.5) {
196
+ return false;
197
+ }
198
+
199
+ if ($quote && $quote->getBaseGrandTotal() <= $paymillMinimumOrderAmount) {
200
+ return false;
201
+ }
202
+
203
+ return true;
204
+ }
205
+ return false;
206
+ }
207
+
208
+ /**
209
+ * The payment capturing method
210
+ * @param Varien_Object $payment The payment object
211
+ * @param $amount The amount to be captures
212
+ * @return boolean $result Returns true if the payment was successfully processed
213
+ */
214
+ public function processPayment(Varien_Object $payment, $amount, $token)
215
+ {
216
+ // get some relevant objects
217
+ $order = $payment->getOrder();
218
+ $billing = $order->getBillingAddress();
219
+
220
+ $libBase = 'lib/paymill/v2/lib/';
221
+
222
+ $data = array(
223
+ 'token' => $token,
224
+ 'amount' => round($amount * 100),
225
+ 'currency' => strtolower($payment->getOrder()->getOrderCurrency()->getCode()),
226
+ 'name' => $billing->getName(),
227
+ 'email' => $order->getCustomerEmail(),
228
+ 'description' => 'Order from: '
229
+ . Mage::getStoreConfig('general/store_information/name', Mage::app()->getStore())
230
+ . ' ' . sprintf('#%s, %s', $order->getIncrementId(), $order->getCustomerEmail()),
231
+ 'libBase' => $libBase,
232
+ 'privateKey' => Mage::getStoreConfig(
233
+ 'payment/paymillelv/paymill_private_api_key', Mage::app()->getStore()
234
+ ),
235
+ 'apiUrl' => Mage::getStoreConfig(
236
+ 'payment/paymillelv/paymill_api_endpoint', Mage::app()->getStore()
237
+ ),
238
+ 'loggerCallback' => array('Paymill_Paymillelv_Model_PaymentMethod', 'logAction')
239
+ );
240
+
241
+ $paymillUser = Mage::getSingleton("paymillelv/customerdata")->loadByUserId(Mage::getSingleton('customer/session')->getCustomer()->getId());
242
+ if (!is_null($paymillUser)){
243
+ $token = explode('|', $paymillUser->getUserData());
244
+ $data['client_id'] = $token[0];
245
+ $data['payment_id'] = $token[1];
246
+ }
247
+
248
+ // process the payment
249
+ $result = $this->_processPayment($data);
250
+
251
+ return $result;
252
+ }
253
+
254
+ protected function _setPaymillClientToken($id)
255
+ {
256
+ Mage::getSingleton('core/session')->setPaymillElvClientToken($id);
257
+ }
258
+
259
+ protected function _setPaymillPaymentToken($id)
260
+ {
261
+ Mage::getSingleton('core/session')->setPaymillElvPaymentToken($id);
262
+ }
263
+
264
+ protected function _setPaymillTransactionId($id)
265
+ {
266
+ Mage::getSingleton('core/session')->setPaymillTransactionId($id);
267
+ }
268
+
269
+ /**
270
+ * Logs an event
271
+ * @param $message The message to be logged
272
+ */
273
+ public static function logAction($message)
274
+ {
275
+ Mage::log($message);
276
+ }
277
+
278
+ }
app/code/community/Paymill/Paymillelv/etc/config.xml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Paymill_Paymillelv>
5
+ <version>2.1.4</version>
6
+ </Paymill_Paymillelv>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <paymillelv>
11
+ <class>Paymill_Paymillelv_Block</class>
12
+ </paymillelv>
13
+ </blocks>
14
+ <models>
15
+ <paymillelv>
16
+ <class>Paymill_Paymillelv_Model</class>
17
+ <resourceModel>paymillelv_mysql4</resourceModel>
18
+ </paymillelv>
19
+ <paymillelv_mysql4>
20
+ <class>Paymill_Paymillelv_Model_Mysql4</class>
21
+ <entities>
22
+ <customerdata>
23
+ <table>paymill_elv_additional_customer_data</table>
24
+ </customerdata>
25
+ </entities>
26
+ </paymillelv_mysql4>
27
+ </models>
28
+ <resources>
29
+ <paymillelv_setup>
30
+ <setup>
31
+ <module>Paymill_Paymillelv</module>
32
+ <class>Mage_Customer_Model_Entity_Setup</class>
33
+ </setup>
34
+ <connection>
35
+ <use>core_setup</use>
36
+ </connection>
37
+ </paymillelv_setup>
38
+ <paymillelv_write>
39
+ <connection>
40
+ <use>core_write</use>
41
+ </connection>
42
+ </paymillelv_write>
43
+ <paymillelv_read>
44
+ <connection>
45
+ <use>core_read</use>
46
+ </connection>
47
+ </paymillelv_read>
48
+ </resources>
49
+ <helpers>
50
+ <paymillelv>
51
+ <class>Paymill_Paymillelv_Helper</class>
52
+ </paymillelv>
53
+ </helpers>
54
+ </global>
55
+ <frontend>
56
+ <translate>
57
+ <modules>
58
+ <Paymill_Paymillelv>
59
+ <files>
60
+ <default>Paymill_Paymillelv.csv</default>
61
+ </files>
62
+ </Paymill_Paymillelv>
63
+ </modules>
64
+ </translate>
65
+ </frontend>
66
+ <adminhtml>
67
+ <translate>
68
+ <modules>
69
+ <Paymill_Paymillelv>
70
+ <files>
71
+ <default>Paymill_Paymillelv.csv</default>
72
+ </files>
73
+ </Paymill_Paymillelv>
74
+ </modules>
75
+ </translate>
76
+ </adminhtml>
77
+ <default>
78
+ <payment>
79
+ <paymillelv>
80
+ <active>0</active>
81
+ <model>paymillelv/paymentMethod</model>
82
+ <order_status>pending</order_status>
83
+ <title>Elektronisches Lastschriftverfahren</title>
84
+ <payment_action>authorize</payment_action>
85
+ <allowspecific>0</allowspecific>
86
+ <paymill_bridge_endpoint>https://bridge.paymill.com/</paymill_bridge_endpoint>
87
+ <paymill_api_endpoint>https://api.paymill.com/v2/</paymill_api_endpoint>
88
+ <paymill_show_credits>1</paymill_show_credits>
89
+ <paymill_accepted_currencies>EUR</paymill_accepted_currencies>
90
+ </paymillelv>
91
+ </payment>
92
+ </default>
93
+ </config>
app/code/community/Paymill/Paymillelv/etc/system.xml ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <!-- payment tab -->
5
+ <payment>
6
+ <groups>
7
+ <!-- newmodule fieldset -->
8
+ <paymillelv translate="label" module="paymillelv">
9
+ <!-- will have title 'New Module' -->
10
+ <label>Paymill ELV</label>
11
+ <!-- position between other payment methods -->
12
+ <sort_order>1</sort_order>
13
+ <!-- do not show this configuration options in store scope -->
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <comment><![CDATA[<a href="https://www.paymill.de/" target="_blank">Click here to get a Paymill account</a>]]></comment>
18
+ <fields>
19
+ <!-- is this payment method active for the website? -->
20
+ <active translate="label">
21
+ <!-- label for the field -->
22
+ <label>Enabled</label>
23
+ <!-- input type for configuration value -->
24
+ <frontend_type>select</frontend_type>
25
+ <!-- model to take the option values from -->
26
+ <source_model>adminhtml/system_config_source_yesno</source_model>
27
+ <!-- field position -->
28
+ <sort_order>1</sort_order>
29
+ <!-- do not show this field in store scope -->
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ </active>
34
+ <recurring translate="label">
35
+ <label>Recurring Payment</label>
36
+ <frontend_type>select</frontend_type>
37
+ <source_model>adminhtml/system_config_source_yesno</source_model>
38
+ <sort_order>2</sort_order>
39
+ <show_in_default>1</show_in_default>
40
+ <show_in_website>1</show_in_website>
41
+ <show_in_store>1</show_in_store>
42
+ </recurring>
43
+ <sort_order translate="label">
44
+ <label>Sort Order</label>
45
+ <frontend_type>text</frontend_type>
46
+ <sort_order>100</sort_order>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ <frontend_class>validate-number</frontend_class>
51
+ </sort_order>
52
+ <paymill_minimum_order_amount translate="label">
53
+ <label>Minimum order amount</label>
54
+ <frontend_type>text</frontend_type>
55
+ <sort_order>100</sort_order>
56
+ <show_in_default>1</show_in_default>
57
+ <show_in_website>1</show_in_website>
58
+ <show_in_store>1</show_in_store>
59
+ <frontend_class>validate-number</frontend_class>
60
+ </paymill_minimum_order_amount>
61
+ <paymill_debug_mode translate="label">
62
+ <label>Paymill debug mode</label>
63
+ <frontend_type>select</frontend_type>
64
+ <source_model>adminhtml/system_config_source_yesno</source_model>
65
+ <sort_order>4</sort_order>
66
+ <show_in_default>1</show_in_default>
67
+ <show_in_website>1</show_in_website>
68
+ <show_in_store>1</show_in_store>
69
+ </paymill_debug_mode>
70
+ <paymill_private_api_key translate="label">
71
+ <label>Private Paymill API Key</label>
72
+ <frontend_type>text</frontend_type>
73
+ <sort_order>2</sort_order>
74
+ <show_in_default>1</show_in_default>
75
+ <show_in_website>1</show_in_website>
76
+ <show_in_store>1</show_in_store>
77
+ </paymill_private_api_key>
78
+ <paymill_public_api_key translate="label">
79
+ <label>Public Paymill API Key</label>
80
+ <frontend_type>text</frontend_type>
81
+ <sort_order>3</sort_order>
82
+ <show_in_default>1</show_in_default>
83
+ <show_in_website>1</show_in_website>
84
+ <show_in_store>1</show_in_store>
85
+ </paymill_public_api_key>
86
+ <paymill_bridge_endpoint translate="label">
87
+ <label>Paymill bridge URL</label>
88
+ <frontend_type>text</frontend_type>
89
+ <sort_order>5</sort_order>
90
+ <show_in_default>1</show_in_default>
91
+ <show_in_website>1</show_in_website>
92
+ <show_in_store>1</show_in_store>
93
+ </paymill_bridge_endpoint>
94
+ <paymill_api_endpoint translate="label">
95
+ <label>Paymill API Endpoint</label>
96
+ <frontend_type>text</frontend_type>
97
+ <sort_order>6</sort_order>
98
+ <show_in_default>1</show_in_default>
99
+ <show_in_website>1</show_in_website>
100
+ <show_in_store>1</show_in_store>
101
+ </paymill_api_endpoint>
102
+ <title>
103
+ <label>Title</label>
104
+ <frontend_type>text</frontend_type>
105
+ <sort_order>8</sort_order>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>1</show_in_website>
108
+ <show_in_store>1</show_in_store>
109
+ </title>
110
+ <order_status translate="label">
111
+ <label>New order status</label>
112
+ <frontend_type>select</frontend_type>
113
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
114
+ <sort_order>9</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ </order_status>
119
+ <paymill_accepted_currencies translate="label">
120
+ <label>Accepted Currencies</label>
121
+ <frontend_type>text</frontend_type>
122
+ <sort_order>10</sort_order>
123
+ <show_in_default>1</show_in_default>
124
+ <show_in_website>1</show_in_website>
125
+ <show_in_store>1</show_in_store>
126
+ </paymill_accepted_currencies>
127
+ <paymill_show_credits translate="label">
128
+ <label>Show Paymill label</label>
129
+ <frontend_type>select</frontend_type>
130
+ <source_model>adminhtml/system_config_source_yesno</source_model>
131
+ <sort_order>12</sort_order>
132
+ <show_in_default>1</show_in_default>
133
+ <show_in_website>1</show_in_website>
134
+ <show_in_store>1</show_in_store>
135
+ </paymill_show_credits>
136
+ </fields>
137
+ </paymillelv>
138
+ </groups>
139
+ </payment>
140
+ </sections>
141
+ </config>
app/code/community/Paymill/Paymillelv/sql/paymillelv_setup/mysql4-install-2.1.2.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $installer->run("
7
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('paymill_elv_additional_customer_data')}` (
8
+ `id` int(11) NOT NULL AUTO_INCREMENT,
9
+ `user_id` varchar(255) NOT NULL,
10
+ `user_data` varchar(256) NOT NULL,
11
+ PRIMARY KEY (`id`)
12
+ ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;"
13
+ );
14
+
15
+ $installer->endSetup();
app/code/community/Paymill/Paymillelv/sql/paymillelv_setup/mysql4-upgrade-2.1.1-2.1.2.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+ $installer->run("
7
+ CREATE TABLE IF NOT EXISTS `{$this->getTable('paymill_elv_additional_customer_data')}` (
8
+ `id` int(11) NOT NULL AUTO_INCREMENT,
9
+ `user_id` varchar(255) NOT NULL,
10
+ `user_data` varchar(256) NOT NULL,
11
+ PRIMARY KEY (`id`)
12
+ ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;"
13
+ );
14
+
15
+ $installer->endSetup();
app/design/adminhtml/base/default/template/paymill/payment/info/creditcard_pdf.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ echo $this->__(Mage::getStoreConfig('payment/paymill_creditcard/title'));
app/design/adminhtml/base/default/template/paymill/payment/info/directdebit_pdf.phtml ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ echo $this->__(Mage::getStoreConfig('payment/paymill_directdebit/title'));
app/design/frontend/base/default/template/paymill/form/paymill.phtml ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code = $this->getMethodCode() ?>
2
+ <script src="<?php echo Mage::getDesign()->getSkinUrl('paymill/jquery.min.js'); ?>"></script>
3
+ <link rel="stylesheet" type="text/css" href="<?php echo Mage::getDesign()->getSkinUrl('paymill/paymill_styles.css'); ?>" />
4
+ <!--
5
+ The payment form.
6
+ Important: do not process any card data to the server (leave name attribute away)
7
+ -->
8
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display: none">
9
+ <li>
10
+ <img src="<?php echo Mage::getDesign()->getSkinUrl('paymill/icon_visa.png'); ?>" />
11
+ <img src="<?php echo Mage::getDesign()->getSkinUrl('paymill/icon_mastercard.png'); ?>" />
12
+ </li>
13
+ <?php if (is_null(Mage::getSingleton("paymillcc/customerdata")->loadByUserId(Mage::getSingleton('customer/session')->getCustomer()->getId()))): ?>
14
+ <li>
15
+ <label for="paymillcc_cardholder" class="required"><em>*</em><?php echo Mage::helper('paymillcc')->__('Credit Card Holder') ?></label>
16
+ <div class="input-box">
17
+ <input type="text" class="input-text" id="paymillcc_cardholder" value="" autocomplete="off">
18
+ <div class="validation-advice" id="cardholder_error" style="display: none"></div>
19
+ </div>
20
+ </li>
21
+ <li>
22
+ <label for="paymillcc_number" class="required"><em>*</em><?php echo Mage::helper('paymillcc')->__('Credit Card Number') ?></label>
23
+ <div class="input-box">
24
+ <input type="text" id="paymillcc_number" class="input-text" value="" autocomplete="off">
25
+ <div class="validation-advice" id="number_error" style="display: none"></div>
26
+ <div id="paymill_card_type" style="display: none; color: #666; margin-top: 2px;"></div>
27
+ </div>
28
+ </li>
29
+ <li>
30
+ <label for="paymillcc_cvc" class="required"><em>*</em><?php echo Mage::helper('paymillcc')->__('Card Verification Number') ?></label>
31
+ <div class="input-box">
32
+ <input type="text" id="paymillcc_cvc" class="input-text" autocomplete="off" value="">
33
+ <div class="validation-advice" id="cvc_error" style="display: none"></div>
34
+ </div>
35
+ </li>
36
+ <li>
37
+ <label for="paymillcc_expiry" class="required"><em>*</em><?php echo Mage::helper('paymillcc')->__('Expiration Date') ?></label>
38
+ <div class="input-box">
39
+ <div class="v-fix">
40
+ <select id="paymillcc_expiry_month" class="month" autocomplete="off">
41
+ <option value="" selected="selected">--</option>
42
+ <option value="01">01 - <?php echo Mage::helper('paymillcc')->__('January'); ?></option>
43
+ <option value="02">02 - <?php echo Mage::helper('paymillcc')->__('February'); ?></option>
44
+ <option value="03">03 - <?php echo Mage::helper('paymillcc')->__('March'); ?></option>
45
+ <option value="04">04 - <?php echo Mage::helper('paymillcc')->__('April'); ?></option>
46
+ <option value="05">05 - <?php echo Mage::helper('paymillcc')->__('May'); ?></option>
47
+ <option value="06">06 - <?php echo Mage::helper('paymillcc')->__('June'); ?></option>
48
+ <option value="07">07 - <?php echo Mage::helper('paymillcc')->__('July'); ?></option>
49
+ <option value="08">08 - <?php echo Mage::helper('paymillcc')->__('August'); ?></option>
50
+ <option value="09">09 - <?php echo Mage::helper('paymillcc')->__('September'); ?></option>
51
+ <option value="10">10 - <?php echo Mage::helper('paymillcc')->__('October'); ?></option>
52
+ <option value="11">11 - <?php echo Mage::helper('paymillcc')->__('November'); ?></option>
53
+ <option value="12">12 - <?php echo Mage::helper('paymillcc')->__('December'); ?></option>
54
+ </select>
55
+ </div>
56
+ <div class="v-fix">
57
+ <select id="paymillcc_expiry_year" class="year" autocomplete="off">
58
+ <option value="" selected="selected">--</option>
59
+ <option value="2012">2012</option>
60
+ <option value="2013">2013</option>
61
+ <option value="2014">2014</option>
62
+ <option value="2015">2015</option>
63
+ <option value="2016">2016</option>
64
+ <option value="2017">2017</option>
65
+ <option value="2018">2018</option>
66
+ <option value="2019">2019</option>
67
+ <option value="2020">2020</option>
68
+ <option value="2021">2021</option>
69
+ <option value="2022">2022</option>
70
+ </select>
71
+ </div>
72
+ <div class="validation-advice" id="expiry_error" style="display: none"></div>
73
+ </div>
74
+ </li>
75
+ <?php endif; ?>
76
+ <?php if (!is_null(Mage::getSingleton("paymillcc/customerdata")->loadByUserId(Mage::getSingleton('customer/session')->getCustomer()->getId()))): ?>
77
+ <input type="hidden" id="paymill_existing_customer" value="true">
78
+ <?php elseif (is_null(Mage::getSingleton("paymillcc/customerdata")->loadByUserId(Mage::getSingleton('customer/session')->getCustomer()->getId()))): ?>
79
+ <input type="hidden" id="paymill_existing_customer" value="false">
80
+ <?php endif; ?>
81
+ <!-- this gets the transaction token -->
82
+ <input type="hidden" id="paymill_order_amount" value="<?php print round($this->paymillPaymentAmount * 100); ?>">
83
+ <input type="hidden" id="paymill_transaction_token" type="text" value="" name="payment[paymill_transaction_token]" />
84
+ <?php if ($this->showPaymillLabel) { ?>
85
+ <li>
86
+ <div class="paymill_powered"><div class="paymill_credits"><?php echo Mage::helper('paymillcc')->__('Secure credit card payment powered by') ?> <a href="http://www.paymill.de" target="_blank">Paymill</a></div></div>
87
+ </li>
88
+ <?php } ?>
89
+ </ul>
90
+ <!--
91
+ PaymillPayment
92
+ Wrapper version: <?php print $this->paymillLibVersion; ?>;
93
+ API enpoint: <?php print $this->paymillApiEndpoint; ?>
94
+ -->
95
+ <script type="text/javascript">
96
+ var PAYMILL_PUBLIC_KEY = '<?php print $this->paymillPublicApiKey; ?>';
97
+ </script>
98
+ <script type="text/javascript" src="<?php print $this->paymillBridgeEndpoint; ?>"></script>
99
+ <script type="text/javascript">
100
+ jQuery.noConflict();
101
+
102
+ jQuery(document).ready(function(){
103
+ jQuery('#payment-buttons-container button:first').prop("onclick", null);
104
+ jQuery('#payment-buttons-container button:first').unbind('click');
105
+ jQuery('#payment-buttons-container button:first').click(paymill_payment_save_override);
106
+ // bind change listener to show the cardtype
107
+ jQuery('#paymillcc_number').change(function() {
108
+ if (paymill.cardType(jQuery('#paymillcc_number').val()) == "Visa") {
109
+ jQuery('#paymill_card_type').html("Visa").show();
110
+ } else if (paymill.cardType(jQuery('#paymillcc_number').val()) == "MasterCard") {
111
+ jQuery('#paymill_card_type').html("MasterCard").show();
112
+ } else {
113
+ jQuery('#paymill_card_type').hide();
114
+ }
115
+ });
116
+
117
+ });
118
+
119
+ if (typeof paymill_payment_save_override != 'function') {
120
+ function paymill_payment_save_override() {
121
+ if (payment.currentMethod == "paymillcc") {
122
+ if (jQuery('#paymill_existing_customer').val() == 'false') {
123
+ paymill_cc_payment_save_override();
124
+ } else {
125
+ payment.save();
126
+ }
127
+ } else if (payment.currentMethod == "paymillelv") {
128
+ if (jQuery('#paymill_elv_existing_customer').val() == 'false') {
129
+ paymill_elv_payment_save_override();
130
+ } else {
131
+ payment.save();
132
+ }
133
+ } else {
134
+ payment.save();
135
+ }
136
+ }
137
+ }
138
+
139
+ // is paymillPayment?
140
+ function paymill_is_paymill_cc_payment() {
141
+ return payment.currentMethod == "<?php print $_code; ?>";
142
+ }
143
+
144
+ // handler that is called when click on next step button
145
+ function paymill_cc_payment_save_override() {
146
+ if (paymill_is_paymill_cc_payment()) {
147
+ paymill_cc_debug('Paymill payment method triggered');
148
+ if (paymill_cc_validate()) {
149
+ paymill_cc_debug('Validation successful');
150
+ var cardholder = jQuery('#paymillcc_cardholder');
151
+ var number = jQuery('#paymillcc_number');
152
+ var expiry_month = jQuery('#paymillcc_expiry_month');
153
+ var expiry_year = jQuery('#paymillcc_expiry_year');
154
+ var cvc = jQuery('#paymillcc_cvc');
155
+ paymill.createToken({
156
+ number: number.val(),
157
+ exp_month: expiry_month.val(),
158
+ exp_year: expiry_year.val(),
159
+ cvc: cvc.val(),
160
+ cardholder: cardholder.val(),
161
+ amount_int: jQuery('#paymill_order_amount').val(),
162
+ currency: '<?php print $this->paymillPaymentCurrency; ?>'
163
+ }, paymill_cc_response_handler
164
+ );
165
+ }
166
+ } else {
167
+ payment.save();
168
+ }
169
+ }
170
+
171
+ // paymill response handler
172
+ function paymill_cc_response_handler(error, result) {
173
+ paymill_cc_debug('Start Paymill response handler');
174
+ if (error) {
175
+ alert("API returned error" + error.apierror);
176
+ paymill_cc_debug('An API error occured ' + error.apierror);
177
+ } else {
178
+ paymill_cc_debug('Received a token: ' + result.token);
179
+ jQuery('#paymill_transaction_token').val(result.token);
180
+ payment.save();
181
+ }
182
+ }
183
+
184
+ // validation
185
+ function paymill_cc_validate() {
186
+
187
+ var cardholder = jQuery('#paymillcc_cardholder');
188
+ var number = jQuery('#paymillcc_number');
189
+ var expiry_month = jQuery('#paymillcc_expiry_month');
190
+ var expiry_year = jQuery('#paymillcc_expiry_year');
191
+ var cvc = jQuery('#paymillcc_cvc');
192
+ var cvc_error = jQuery('#cvc_error');
193
+ var expiry_error = jQuery('#expiry_error');
194
+ var number_error = jQuery('#number_error');
195
+ var cardholder_error = jQuery('#cardholder_error');
196
+
197
+ var result = true;
198
+
199
+ paymill_cc_debug('Start form validation');
200
+
201
+ // reset errors
202
+ cardholder_error.hide();
203
+ cvc_error.hide();
204
+ expiry_error.hide();
205
+ number_error.hide();
206
+
207
+ // error messages
208
+ error_msg_cardholder_missing = "<?php echo Mage::helper('paymillcc')->__('Credit Card Holder is missing') ?>";
209
+ error_msg_cardnumber_invalid = "<?php echo Mage::helper('paymillcc')->__('Your credit card number is invalid'); ?>";
210
+ error_msg_expiry_invalid = "<?php echo Mage::helper('paymillcc')->__('The expiration date is invalid'); ?>";
211
+ error_msg_cvc_invalid = "<?php echo Mage::helper('paymillcc')->__('The verification number is invalid'); ?>";
212
+
213
+ if (cardholder.val() == "") {
214
+ cardholder_error.html(error_msg_cardholder_missing).show();
215
+ cardholder.addClass('validation-failed');
216
+ result = false;
217
+ } else {
218
+ cardholder.removeClass('validation-failed');
219
+ }
220
+
221
+ if (!paymill.validateCardNumber(number.val())) {
222
+ number_error.html(error_msg_cardnumber_invalid).show();
223
+ number.addClass('validation-failed');
224
+ result = false;
225
+ } else {
226
+ number.removeClass('validation-failed');
227
+ }
228
+
229
+ if (!paymill.validateCvc(cvc.val())) {
230
+ cvc_error.html(error_msg_cvc_invalid).show();
231
+ cvc.addClass('validation-failed');
232
+ result = false;
233
+ } else {
234
+ cvc.removeClass('validation-failed');
235
+ }
236
+
237
+ if (!paymill.validateExpiry(expiry_month.val(), expiry_year.val())) {
238
+ expiry_error.html(error_msg_expiry_invalid).show();
239
+ expiry_month.addClass('validation-failed');
240
+ expiry_year.addClass('validation-failed');
241
+ result = false;
242
+ } else {
243
+ expiry_month.removeClass('validation-failed');
244
+ expiry_year.removeClass('validation-failed');
245
+ }
246
+
247
+ return result;
248
+ }
249
+
250
+ // debug mode
251
+ function paymill_cc_debug(message) {
252
+ if (<?php print $this->paymillDebugMode; ?>) {
253
+ console.log("[PaymillCC] " + message);
254
+ }
255
+ }
256
+
257
+ // handling for onestep extension
258
+ function paymill_onestep_cc(onestep_callback) {
259
+ if (paymill_is_paymill_cc_payment()) {
260
+ paymill_cc_debug('Paymill payment method triggered');
261
+ if (paymill_cc_validate()) {
262
+ paymill_cc_debug('Validation successful');
263
+ var cardholder = jQuery('#paymillcc_cardholder');
264
+ var number = jQuery('#paymillcc_number');
265
+ var expiry_month = jQuery('#paymillcc_expiry_month');
266
+ var expiry_year = jQuery('#paymillcc_expiry_year');
267
+ var cvc = jQuery('#paymillcc_cvc');
268
+ paymill.createToken({
269
+ number: number.val(),
270
+ exp_month: expiry_month.val(),
271
+ exp_year: expiry_year.val(),
272
+ cvc: cvc.val(),
273
+ cardholder: cardholder.val(),
274
+ amount: '<?php print $this->paymillPaymentAmount; ?>',
275
+ currency: '<?php print $this->paymillPaymentCurrency; ?>'
276
+ }, function(error, result) {
277
+ paymill_cc_debug('Start Paymill response handler');
278
+ if (error) {
279
+ paymill_cc_debug('An API error occured ' + error.apierror);
280
+ return false;
281
+ } else {
282
+ paymill_cc_debug('Received a token: ' + result.token);
283
+ jQuery('#paymill_transaction_token').val(result.token);
284
+ onestep_callback();
285
+ }
286
+ }
287
+ );
288
+ return false;
289
+ } else {
290
+ return false;
291
+ }
292
+ } else {
293
+ return false;
294
+ }
295
+ return false;
296
+ }
297
+
298
+ </script>
299
+
app/design/frontend/base/default/template/paymill/form/paymill_elv.phtml ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_code=$this->getMethodCode() ?>
2
+ <script src="<?php echo Mage::getDesign()->getSkinUrl('paymill/jquery.min.js'); ?>"></script>
3
+ <link rel="stylesheet" type="text/css" href="<?php echo Mage::getDesign()->getSkinUrl('paymill/paymill_styles.css'); ?>" />
4
+ <!--
5
+ The payment form.
6
+ Important: do not process any card data to the server (leave name attribute away)
7
+ -->
8
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display: none">
9
+ <li>
10
+ <img src="<?php echo Mage::getDesign()->getSkinUrl('paymill/icon_elv.png'); ?>" />
11
+ </li>
12
+ <?php if (is_null(Mage::getSingleton("paymillelv/customerdata")->loadByUserId(Mage::getSingleton('customer/session')->getCustomer()->getId()))): ?>
13
+ <li>
14
+ <label for="paymillelv_accountholder" class="required"><em>*</em>Kontoinhaber</label>
15
+ <div class="input-box">
16
+ <input type="text" class="input-text required-entry" id="paymillelv_accountholder" value="" autocomplete="off">
17
+ <div class="validation-advice" id="accountholder_error" style="display: none"></div>
18
+ </div>
19
+ </li>
20
+ <li>
21
+ <label for="paymillelv_accountnumber" class="required"><em>*</em>Kontonummer</label>
22
+ <div class="input-box">
23
+ <input type="text" id="paymillelv_accountnumber" class="input-text" value="" autocomplete="off">
24
+ <div class="validation-advice" id="accountnumber_error" style="display: none"></div>
25
+ </div>
26
+ </li>
27
+ <li>
28
+ <label for="paymillelv_banknumber" class="required"><em>*</em>Bankleitzahl</label>
29
+ <div class="input-box">
30
+ <input type="text" id="paymillelv_banknumber" class="input-text" autocomplete="off" value="">
31
+ <div class="validation-advice" id="banknumber_error" style="display: none"></div>
32
+ </div>
33
+ </li>
34
+ <?php endif; ?>
35
+ <?php if (!is_null(Mage::getSingleton("paymillelv/customerdata")->loadByUserId(Mage::getSingleton('customer/session')->getCustomer()->getId()))): ?>
36
+ <input type="hidden" id="paymill_elv_existing_customer" value="true">
37
+ <?php elseif (is_null(Mage::getSingleton("paymillelv/customerdata")->loadByUserId(Mage::getSingleton('customer/session')->getCustomer()->getId()))): ?>
38
+ <input type="hidden" id="paymill_elv_existing_customer" value="false">
39
+ <?php endif; ?>
40
+ <!-- this gets the transaction token -->
41
+ <input type="hidden" id="paymill_elv_transaction_token" type="text" value="" name="payment[paymill_elv_transaction_token]" />
42
+ <?php if ($this->showPaymillLabel) { ?>
43
+ <li>
44
+ <div class="paymill_powered"><div class="paymill_credits">Sicheres Lastschriftverfahren powered by <a href="http://www.paymill.de" target="_blank">Paymill</a></div></div>
45
+ </li>
46
+ <?php } ?>
47
+ </ul>
48
+ <!--
49
+ PaymillPaymentELV
50
+ API enpoint: <?php print $this->paymillApiEndpoint; ?>
51
+ -->
52
+ <script type="text/javascript">
53
+ var PAYMILL_PUBLIC_KEY = '<?php print $this->paymillPublicApiKey; ?>';
54
+ </script>
55
+ <script type="text/javascript" src="<?php print $this->paymillBridgeEndpoint; ?>"></script>
56
+ <script type="text/javascript">
57
+ jQuery.noConflict();
58
+
59
+ jQuery(document).ready(function(){
60
+ jQuery('#payment-buttons-container button:first').prop("onclick", null);
61
+ jQuery('#payment-buttons-container button:first').unbind('click');
62
+ jQuery('#payment-buttons-container button:first').click(paymill_payment_save_override);
63
+ });
64
+
65
+ if (typeof paymill_payment_save_override != 'function') {
66
+ function paymill_payment_save_override() {
67
+ if (payment.currentMethod == "paymillcc") {
68
+ if (jQuery('#paymill_existing_customer').val() == 'false') {
69
+ paymill_cc_payment_save_override();
70
+ } else {
71
+ payment.save();
72
+ }
73
+ } else if (payment.currentMethod == "paymillelv") {
74
+ if (jQuery('#paymill_elv_existing_customer').val() == 'false') {
75
+ paymill_elv_payment_save_override();
76
+ } else {
77
+ payment.save();
78
+ }
79
+ } else {
80
+ payment.save();
81
+ }
82
+ }
83
+ }
84
+
85
+ // is paymillPayment?
86
+ function paymill_is_paymill_elv_payment() {
87
+ return payment.currentMethod == "<?php print $_code; ?>";
88
+ }
89
+
90
+ // handler that is called when click on next step button
91
+ function paymill_elv_payment_save_override() {
92
+ if (paymill_is_paymill_elv_payment()) {
93
+ paymill_elv_debug('Paymill elv payment method triggered');
94
+ if (paymill_elv_validate()) {
95
+ paymill_elv_debug('Validation successful');
96
+ var accountholder = jQuery('#paymillelv_accountholder');
97
+ var accountnumber = jQuery('#paymillelv_accountnumber');
98
+ var banknumber = jQuery('#paymillelv_banknumber');
99
+ paymill.createToken({
100
+ number: accountnumber.val(),
101
+ bank: banknumber.val(),
102
+ accountholder: accountholder.val(),
103
+ }, paymill_elv_response_handler
104
+ );
105
+ }
106
+ } else {
107
+ payment.save();
108
+ }
109
+ }
110
+
111
+ // paymill response handler
112
+ function paymill_elv_response_handler(error, result) {
113
+ paymill_elv_debug('Start Paymill response handler');
114
+ if (error) {
115
+ alert("API returned error" + error.apierror);
116
+ paymill_elv_debug('An API error occured ' + error.apierror);
117
+ } else {
118
+ paymill_elv_debug('Received a token: ' + result.token);
119
+ jQuery('#paymill_elv_transaction_token').val(result.token);
120
+ payment.save();
121
+ }
122
+ }
123
+
124
+ // validation
125
+ function paymill_elv_validate() {
126
+
127
+ var accountholder = jQuery('#paymillelv_accountholder');
128
+ var accountnumber = jQuery('#paymillelv_accountnumber');
129
+ var banknumber = jQuery('#paymillelv_banknumber');
130
+ var banknumber_error = jQuery('#banknumber_error');
131
+ var accountnumber_error = jQuery('#accountnumber_error');
132
+ var accountholder_error = jQuery('#accountholder_error');
133
+
134
+ var result = true;
135
+
136
+ paymill_elv_debug('Start form validation');
137
+
138
+ // reset errors
139
+ banknumber_error.hide();
140
+ accountnumber_error.hide();
141
+ accountholder_error.hide();
142
+
143
+ // error messages
144
+ error_msg_accountholder_missing = "<?php echo Mage::helper('paymillelv')->__("The account holder is missing"); ?>";
145
+ error_msg_accountnumber_invalid = "<?php echo Mage::helper('paymillelv')->__("The account number is invalid"); ?>"
146
+ error_msg_banknumber_invalid = "<?php echo Mage::helper('paymillelv')->__("The bank code is invalid"); ?>"
147
+
148
+ if (accountholder.val() == "") {
149
+ accountholder_error.html(error_msg_accountholder_missing).show();
150
+ accountholder.addClass('validation-failed');
151
+ result = false;
152
+ } else {
153
+ accountholder.removeClass('validation-failed');
154
+ }
155
+
156
+ if (!paymill.validateAccountNumber(accountnumber.val())) {
157
+ accountnumber_error.html(error_msg_accountnumber_invalid).show();
158
+ accountnumber.addClass('validation-failed');
159
+ result = false;
160
+ } else {
161
+ accountnumber.removeClass('validation-failed');
162
+ }
163
+
164
+ if (!paymill.validateBankCode(banknumber.val())) {
165
+ banknumber_error.html(error_msg_banknumber_invalid).show();
166
+ banknumber.addClass('validation-failed');
167
+ result = false;
168
+ } else {
169
+ banknumber.removeClass('validation-failed');
170
+ }
171
+
172
+ return result;
173
+ }
174
+
175
+ // debug mode
176
+ function paymill_elv_debug(message) {
177
+ if (<?php print $this->paymillDebugMode; ?>) {
178
+ console.log("[PaymillELV] " + message);
179
+ }
180
+ }
181
+
182
+ </script>
183
+
184
+
app/design/frontend/base/default/template/paymill/payment/form/creditcard.phtml CHANGED
@@ -37,15 +37,6 @@
37
  <input value="<?php echo $this->getPaymentEntry($_code, 'cvc'); ?>" type="text" id="<?php echo $_code ?>_cvc" class="input-text paymill-validate-cc-cvc"/>
38
  </div>
39
  </li>
40
- <?php if (Mage::helper('paymill/optionHelper')->isShowingLabels()) : ?>
41
- <li>
42
- <div class='paymill_powered'>
43
- <div class='paymill_credits'>
44
- <?php echo $this->__("paymill_slogan"); ?><a href='http://www.paymill.de' target='_blank'>PAYMILL</a>
45
- </div>
46
- </div>
47
- </li>
48
- <?php endif; ?>
49
  <li>
50
  <input class="paymill-payment-token-cc" name="payment[paymill-payment-token-cc]" id="payment[paymill-payment-token-cc]" type="hidden" />
51
  <input class="paymill_3ds_cancel" name="payment[paymill_3ds_cancel]" id="payment[paymill_3ds_cancel]" type="hidden" value="<?php echo $this->__("paymill_3ds_cancel") ?>"/>
@@ -62,8 +53,6 @@
62
  </ul>
63
  <script type="text/javascript">
64
  //<![CDATA[
65
- if (!eventsSetted) {
66
- addPaymillEvents();
67
- }
68
  //]]>
69
- </script>
37
  <input value="<?php echo $this->getPaymentEntry($_code, 'cvc'); ?>" type="text" id="<?php echo $_code ?>_cvc" class="input-text paymill-validate-cc-cvc"/>
38
  </div>
39
  </li>
 
 
 
 
 
 
 
 
 
40
  <li>
41
  <input class="paymill-payment-token-cc" name="payment[paymill-payment-token-cc]" id="payment[paymill-payment-token-cc]" type="hidden" />
42
  <input class="paymill_3ds_cancel" name="payment[paymill_3ds_cancel]" id="payment[paymill_3ds_cancel]" type="hidden" value="<?php echo $this->__("paymill_3ds_cancel") ?>"/>
53
  </ul>
54
  <script type="text/javascript">
55
  //<![CDATA[
56
+ addPaymillEvents();
 
 
57
  //]]>
58
+ </script>
app/design/frontend/base/default/template/paymill/payment/form/directdebit.phtml CHANGED
@@ -21,15 +21,6 @@
21
  <input value="<?php echo $this->getPaymentEntry($_code, 'code'); ?>" type="text" id="<?php echo $_code ?>_bankcode" class="input-text paymill-validate-dd-bankcode required-entry"/>
22
  </div>
23
  </li>
24
- <?php if (Mage::helper('paymill/optionHelper')->isShowingLabels()) : ?>
25
- <li>
26
- <div class='paymill_powered'><div class='paymill_credits'>
27
- <?php echo $this->__("paymill_slogan_elv"); ?>
28
- <a href='http://www.paymill.de' target='_blank'>PAYMILL</a>
29
- </div>
30
- </div>
31
- </li>
32
- <?php endif; ?>
33
  <li>
34
  <input class="paymill-payment-token-elv" name="payment[paymill-payment-token-elv]" id="payment[paymill-payment-token-elv]" type="hidden" />
35
  <input class="paymill-option-debug-elv" name="payment[paymill-option-debug-elv]" id="payment[paymill-option-debug-elv]" type="hidden" value="<?php echo Mage::helper('paymill/optionHelper')->isInDebugMode() ?>" />
@@ -42,8 +33,6 @@
42
  </ul>
43
  <script type="text/javascript">
44
  //<![CDATA[
45
- if (!eventsSetted) {
46
- addPaymillEvents();
47
- }
48
  //]]>
49
  </script>
21
  <input value="<?php echo $this->getPaymentEntry($_code, 'code'); ?>" type="text" id="<?php echo $_code ?>_bankcode" class="input-text paymill-validate-dd-bankcode required-entry"/>
22
  </div>
23
  </li>
 
 
 
 
 
 
 
 
 
24
  <li>
25
  <input class="paymill-payment-token-elv" name="payment[paymill-payment-token-elv]" id="payment[paymill-payment-token-elv]" type="hidden" />
26
  <input class="paymill-option-debug-elv" name="payment[paymill-option-debug-elv]" id="payment[paymill-option-debug-elv]" type="hidden" value="<?php echo Mage::helper('paymill/optionHelper')->isInDebugMode() ?>" />
33
  </ul>
34
  <script type="text/javascript">
35
  //<![CDATA[
36
+ addPaymillEvents();
 
 
37
  //]]>
38
  </script>
app/locale/de_DE/Paymill_Paymill.csv CHANGED
@@ -92,3 +92,4 @@
92
  "Timeout on side of the acquirer.", "Die Schnittstelle zum Acquirer reagiert nicht, daher bekommen wir keine Antwort ob die Transaktion erfolgreich durchgelaufen ist."
93
  "Risk management transaction timeout.", "Es gibt eine Zeitüberschreitung bei der Risiko-Management Transaktion."
94
  "Duplicate transaction.", "Doppelte Transaktion."
 
92
  "Timeout on side of the acquirer.", "Die Schnittstelle zum Acquirer reagiert nicht, daher bekommen wir keine Antwort ob die Transaktion erfolgreich durchgelaufen ist."
93
  "Risk management transaction timeout.", "Es gibt eine Zeitüberschreitung bei der Risiko-Management Transaktion."
94
  "Duplicate transaction.", "Doppelte Transaktion."
95
+ "paymill_send_invoice_mail", "Rechnungs Mail senden"
app/locale/en_GB/Paymill_Paymill.csv CHANGED
@@ -91,4 +91,5 @@
91
  "General timeout.", "General timeout."
92
  "Timeout on side of the acquirer.", "Timeout on side of the acquirer."
93
  "Risk management transaction timeout.", "Risk management transaction timeout."
94
- "Duplicate transaction.", "Duplicate transaction."
 
91
  "General timeout.", "General timeout."
92
  "Timeout on side of the acquirer.", "Timeout on side of the acquirer."
93
  "Risk management transaction timeout.", "Risk management transaction timeout."
94
+ "Duplicate transaction.", "Duplicate transaction."
95
+ "paymill_send_invoice_mail", "Send invoice mail"
js/paymill/paymentForm.js CHANGED
@@ -1,5 +1,3 @@
1
- var eventsSetted = false;
2
-
3
  //Backend Options
4
  var PAYMILL_PUBLIC_KEY = null;
5
 
@@ -9,12 +7,8 @@ var PAYMILL_IMAGE_PATH = null;
9
 
10
  //Errortexts
11
  var PAYMILL_ERROR_STRING = "";
12
- var PAYMILL_ERROR_TEXT_IVALID_NUMBER = null;
13
- var PAYMILL_ERROR_TEXT_IVALID_EXPDATE = null;
14
- var PAYMILL_ERROR_TEXT_IVALID_HOLDER = null;
15
- var PAYMILL_ERROR_TEXT_IVALID_BANKCODE = null;
16
- var PAYMILL_ERROR_TEXT_IVALID_PAYMENT = null;
17
 
 
18
 
19
  function getPaymillCode()
20
  {
@@ -58,40 +52,15 @@ function debug(message)
58
  */
59
  function paymillShowCardIcon()
60
  {
61
- var cssClass = "input-text paymill-validate-cc-number required-entry paymill_creditcard_number-";
62
- switch (paymill.cardType(pmQuery('#paymill_creditcard_number').val()).toLowerCase()) {
63
- case 'visa':
64
- pmQuery('#paymill_creditcard_number').removeClass();
65
- pmQuery('#paymill_creditcard_number').addClass(cssClass + 'visa');
66
- break;
67
- case 'mastercard':
68
- pmQuery('#paymill_creditcard_number').removeClass();
69
- pmQuery('#paymill_creditcard_number').addClass(cssClass + 'mastercard');
70
- break;
71
- case 'american express':
72
- pmQuery('#paymill_creditcard_number').removeClass();
73
- pmQuery('#paymill_creditcard_number').addClass(cssClass + 'american');
74
- break;
75
- case 'jcb':
76
- pmQuery('#paymill_creditcard_number').removeClass();
77
- pmQuery('#paymill_creditcard_number').addClass(cssClass + 'jcb');
78
- break;
79
- case 'maestro':
80
- pmQuery('#paymill_creditcard_number').removeClass();
81
- pmQuery('#paymill_creditcard_number').addClass(cssClass + 'maestro');
82
- break;
83
- case 'diners club':
84
- pmQuery('#paymill_creditcard_number').removeClass();
85
- pmQuery('#paymill_creditcard_number').addClass(cssClass + 'diners');
86
- break;
87
- case 'discover':
88
- pmQuery('#paymill_creditcard_number').removeClass();
89
- pmQuery('#paymill_creditcard_number').addClass(cssClass + 'discover');
90
- break;
91
- case 'unionpay':
92
- pmQuery('#paymill_creditcard_number').removeClass();
93
- pmQuery('#paymill_creditcard_number').addClass(cssClass + 'unionpay');
94
- break;
95
  }
96
  }
97
 
@@ -102,6 +71,8 @@ function paymillShowCardIcon()
102
  */
103
  function paymillResponseHandler(error, result)
104
  {
 
 
105
  if (error) {
106
  // Appending error
107
  PAYMILL_ERROR_STRING += error.apierror + "\n";
@@ -113,6 +84,16 @@ function paymillResponseHandler(error, result)
113
  pmQuery('.paymill-payment-token-' + getPaymillCode()).val(result.token);
114
  }
115
  }
 
 
 
 
 
 
 
 
 
 
116
  /**
117
  *
118
  * @returns {Boolean}
@@ -122,91 +103,19 @@ function paymillSubmitForm()
122
  PAYMILL_PUBLIC_KEY = pmQuery('.paymill-info-public_key-' + getPaymillCode()).val();
123
  PAYMILL_PAYMENT_NAME = pmQuery("input[name='payment[method]']:checked").val();
124
 
125
- if (PAYMILL_PAYMENT_NAME === "paymill_creditcard") {
126
- paymill.config('3ds_cancel_label', pmQuery('.paymill_3ds_cancel').val());
127
- PAYMILL_ERROR_TEXT_IVALID_NUMBER_CC = pmQuery('.paymill-payment-error-number').val();
128
- PAYMILL_ERROR_TEXT_IVALID_HOLDER_CC = pmQuery('.paymill-payment-error-holder').val();
129
- PAYMILL_ERROR_TEXT_IVALID_CVC = pmQuery('.paymill-payment-error-cvc').val();
130
- PAYMILL_ERROR_TEXT_IVALID_EXPDATE = pmQuery('.paymill-payment-error-expdate').val();
131
- }
132
-
133
- if (PAYMILL_PAYMENT_NAME === "paymill_directdebit") {
134
- PAYMILL_ERROR_TEXT_IVALID_NUMBER_ELV = pmQuery('.paymill-payment-error-number-elv').val();
135
- PAYMILL_ERROR_TEXT_IVALID_HOLDER_ELV = pmQuery('.paymill-payment-error-holder-elv').val();
136
- PAYMILL_ERROR_TEXT_IVALID_BANKCODE = pmQuery('.paymill-payment-error-bankcode').val();
137
- }
138
-
139
-
140
- if (pmQuery('#paymill_creditcard_number').closest("form").attr("id") === undefined) {
141
- pmQuery('#paymill_creditcard_number').closest("form").attr("id", 'paymill-checkout-form')
142
- }
143
-
144
- var form = pmQuery('#paymill_creditcard_number').closest("form").attr("id");
145
-
146
  switch (PAYMILL_PAYMENT_NAME) {
147
  case "paymill_creditcard":
 
148
  if (pmQuery('.paymill-info-fastCheckout-cc').val() === 'false') {
149
- var paymillValidator = new Validation(form);
150
- var nv = {
151
- 'paymill-validate-cc-number': new Validator(
152
- 'paymill-validate-cc-number',
153
- PAYMILL_ERROR_TEXT_IVALID_NUMBER_CC,
154
- function(v) {
155
- return paymill.validateCardNumber(v);
156
- },
157
- ''
158
- ),
159
- 'paymill-validate-cc-expdate-month': new Validator(
160
- 'paymill-validate-cc-expdate-month',
161
- PAYMILL_ERROR_TEXT_IVALID_EXPDATE,
162
- function(v) {
163
- return paymill.validateExpiry(pmQuery('#paymill_creditcard_expiry_month').val(), pmQuery('#paymill_creditcard_expiry_year').val());
164
- },
165
- ''
166
- ),
167
- 'paymill-validate-cc-expdate-year': new Validator(
168
- 'paymill-validate-cc-expdate-year',
169
- PAYMILL_ERROR_TEXT_IVALID_EXPDATE,
170
- function(v) {
171
- return paymill.validateExpiry(pmQuery('#paymill_creditcard_expiry_month').val(), pmQuery('#paymill_creditcard_expiry_year').val());
172
- },
173
- ''
174
- ),
175
- 'paymill-validate-cc-holder': new Validator(
176
- 'paymill-validate-cc-holder',
177
- PAYMILL_ERROR_TEXT_IVALID_HOLDER_CC,
178
- function(v) {
179
- return (paymill.validateHolder(v));
180
- },
181
- ''
182
- ),
183
- 'paymill-validate-cc-cvc': new Validator(
184
- 'paymill-validate-cc-cvc',
185
- PAYMILL_ERROR_TEXT_IVALID_CVC,
186
- function(v) {
187
- if (paymill.cardType(pmQuery('#paymill_creditcard_number').val()).toLowerCase() === 'maestro') {
188
- return true;
189
- }
190
-
191
- return paymill.validateCvc(v);
192
- },
193
- ''
194
- )
195
- };
196
-
197
-
198
- var valid = paymill.validateCvc(pmQuery('#paymill_creditcard_cvc').val())
199
  && paymill.validateHolder(pmQuery('#paymill_creditcard_holdername').val())
200
  && paymill.validateExpiry(pmQuery('#paymill_creditcard_expiry_month').val(), pmQuery('#paymill_creditcard_expiry_year').val())
201
  && paymill.validateCardNumber(pmQuery('#paymill_creditcard_number').val());
202
-
203
  if (!valid) {
204
  return false;
205
  }
206
-
207
- Object.extend(Validation.methods, nv);
208
- paymillValidator.validate();
209
-
210
  var cvc = '000';
211
 
212
  if (pmQuery('#paymill_creditcard_cvc').val() !== '') {
@@ -227,34 +136,6 @@ function paymillSubmitForm()
227
  break;
228
  case "paymill_directdebit":
229
  if (pmQuery('.paymill-info-fastCheckout-elv').val() === 'false') {
230
- var paymillValidator = new Validation(form);
231
- var nv = {
232
- 'paymill-validate-dd-holdername': new Validator(
233
- 'paymill-validate-dd-holdername',
234
- PAYMILL_ERROR_TEXT_IVALID_HOLDER_ELV,
235
- function(v) {
236
- return !(v === '');
237
- },
238
- ''
239
- ),
240
- 'paymill-validate-dd-account': new Validator(
241
- 'paymill-validate-dd-account',
242
- PAYMILL_ERROR_TEXT_IVALID_NUMBER_ELV,
243
- function(v) {
244
- return paymill.validateAccountNumber(v);
245
- },
246
- ''
247
- ),
248
- 'paymill-validate-dd-bankcode': new Validator(
249
- 'paymill-validate-dd-bankcode',
250
- PAYMILL_ERROR_TEXT_IVALID_BANKCODE,
251
- function(v) {
252
- return paymill.validateBankCode(v);
253
- },
254
- ''
255
- )
256
- };
257
-
258
  var valid = pmQuery('#paymill_directdebit_holdername').val() !== ''
259
  && paymill.validateAccountNumber(pmQuery('#paymill_directdebit_account').val())
260
  && paymill.validateBankCode(pmQuery('#paymill_directdebit_bankcode').val());
@@ -263,9 +144,6 @@ function paymillSubmitForm()
263
  return false;
264
  }
265
 
266
- Object.extend(Validation.methods, nv);
267
- paymillValidator.validate();
268
-
269
  debug("Generating Token");
270
  paymill.createToken({
271
  number: pmQuery('#paymill_directdebit_account').val(),
@@ -279,46 +157,249 @@ function paymillSubmitForm()
279
  return false;
280
  }
281
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  function addPaymillEvents()
283
  {
284
- pmQuery('#paymill_directdebit_holdername').live('focus', function() {
285
- pmQuery('.paymill-info-fastCheckout-elv').val('false');
286
- });
287
-
288
- pmQuery('#paymill_directdebit_account').live('focus', function() {
289
- pmQuery('.paymill-info-fastCheckout-elv').val('false');
290
- });
291
-
292
-
293
- pmQuery('#paymill_directdebit_bankcode').live('focus', function() {
294
- pmQuery('.paymill-info-fastCheckout-elv').val('false');
295
- });
296
-
297
- pmQuery('#paymill_creditcard_holdername').live('focus', function() {
298
- pmQuery('.paymill-info-fastCheckout-cc').val('false');
299
- });
300
-
301
- pmQuery('#paymill_creditcard_cvc').live('focus', function() {
302
- pmQuery('.paymill-info-fastCheckout-cc').val('false');
303
- });
304
-
305
- pmQuery('#paymill_creditcard_number').live('focus', function() {
306
- pmQuery('.paymill-info-fastCheckout-cc').val('false');
307
- });
308
-
309
- pmQuery('#paymill_creditcard_expiry_month').live('change', function() {
310
- pmQuery('.paymill-info-fastCheckout-cc').val('false');
311
- });
312
-
313
- pmQuery('#paymill_creditcard_expiry_year').live('change', function() {
314
- pmQuery('.paymill-info-fastCheckout-cc').val('false');
315
- });
316
-
317
- pmQuery('#paymill_creditcard_number').live('input', paymillSubmitForm);
318
- pmQuery('#paymill_creditcard_cvc').live('input', paymillSubmitForm);
319
- pmQuery('#paymill_creditcard_expiry_month').live('change', paymillSubmitForm);
320
- pmQuery('#paymill_creditcard_expiry_year').live('change', paymillSubmitForm);
321
- pmQuery('#paymill_directdebit_bankcode').live('input', paymillSubmitForm);
322
- pmQuery('#paymill_creditcard_number').live('input', paymillShowCardIcon);
323
- eventsSetted = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  }
 
 
1
  //Backend Options
2
  var PAYMILL_PUBLIC_KEY = null;
3
 
7
 
8
  //Errortexts
9
  var PAYMILL_ERROR_STRING = "";
 
 
 
 
 
10
 
11
+ var eventFlag = false;
12
 
13
  function getPaymillCode()
14
  {
52
  */
53
  function paymillShowCardIcon()
54
  {
55
+ var brand = paymill.cardType(pmQuery('#paymill_creditcard_number').val());
56
+ brand = brand.toLowerCase();
57
+ pmQuery("#paymill_creditcard_number")[0].className = pmQuery("#paymill_creditcard_number")[0].className.replace(/paymill-card-number-.*/g, '');
58
+ if (brand !== 'unknown') {
59
+ if (brand === 'american express') {
60
+ brand = 'amex';
61
+ }
62
+
63
+ pmQuery('#paymill_creditcard_number').addClass("paymill-card-number-" + brand);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  }
65
  }
66
 
71
  */
72
  function paymillResponseHandler(error, result)
73
  {
74
+ var paymillValidator = new Validation(pmQuery("input[name='payment[method]']:checked").closest("form").attr("id"));
75
+ paymillValidator.validate();
76
  if (error) {
77
  // Appending error
78
  PAYMILL_ERROR_STRING += error.apierror + "\n";
84
  pmQuery('.paymill-payment-token-' + getPaymillCode()).val(result.token);
85
  }
86
  }
87
+
88
+ function getValueIfExist(selector)
89
+ {
90
+ if ($$(selector)[0]) {
91
+ return $$(selector)[0].value;
92
+ }
93
+
94
+ return '';
95
+ }
96
+
97
  /**
98
  *
99
  * @returns {Boolean}
103
  PAYMILL_PUBLIC_KEY = pmQuery('.paymill-info-public_key-' + getPaymillCode()).val();
104
  PAYMILL_PAYMENT_NAME = pmQuery("input[name='payment[method]']:checked").val();
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  switch (PAYMILL_PAYMENT_NAME) {
107
  case "paymill_creditcard":
108
+ paymill.config('3ds_cancel_label', pmQuery('.paymill_3ds_cancel').val());
109
  if (pmQuery('.paymill-info-fastCheckout-cc').val() === 'false') {
110
+ var valid = (paymill.validateCvc(pmQuery('#paymill_creditcard_cvc').val()) || paymill.cardType(pmQuery('#paymill_creditcard_number').val()).toLowerCase() === 'maestro')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  && paymill.validateHolder(pmQuery('#paymill_creditcard_holdername').val())
112
  && paymill.validateExpiry(pmQuery('#paymill_creditcard_expiry_month').val(), pmQuery('#paymill_creditcard_expiry_year').val())
113
  && paymill.validateCardNumber(pmQuery('#paymill_creditcard_number').val());
114
+
115
  if (!valid) {
116
  return false;
117
  }
118
+
 
 
 
119
  var cvc = '000';
120
 
121
  if (pmQuery('#paymill_creditcard_cvc').val() !== '') {
136
  break;
137
  case "paymill_directdebit":
138
  if (pmQuery('.paymill-info-fastCheckout-elv').val() === 'false') {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  var valid = pmQuery('#paymill_directdebit_holdername').val() !== ''
140
  && paymill.validateAccountNumber(pmQuery('#paymill_directdebit_account').val())
141
  && paymill.validateBankCode(pmQuery('#paymill_directdebit_bankcode').val());
144
  return false;
145
  }
146
 
 
 
 
147
  debug("Generating Token");
148
  paymill.createToken({
149
  number: pmQuery('#paymill_directdebit_account').val(),
157
  return false;
158
  }
159
 
160
+ function unsetElvValidationRules()
161
+ {
162
+ var nvElv = {
163
+ 'paymill-validate-dd-holdername': new Validator(
164
+ 'paymill-validate-dd-holdername',
165
+ '',
166
+ function(v) {
167
+ return true;
168
+ },
169
+ ''
170
+ ),
171
+ 'paymill-validate-dd-account': new Validator(
172
+ 'paymill-validate-dd-account',
173
+ '',
174
+ function(v) {
175
+ return true;
176
+ },
177
+ ''
178
+ ),
179
+ 'paymill-validate-dd-bankcode': new Validator(
180
+ 'paymill-validate-dd-bankcode',
181
+ '',
182
+ function(v) {
183
+ return true;
184
+ },
185
+ ''
186
+ )
187
+ };
188
+
189
+ Object.extend(Validation.methods, nvElv);
190
+ }
191
+
192
+ function unsetCcValidationRules()
193
+ {
194
+ var nvCc = {
195
+ 'paymill-validate-cc-number': new Validator(
196
+ 'paymill-validate-cc-number',
197
+ '',
198
+ function(v) {
199
+ return true;
200
+ },
201
+ ''
202
+ ),
203
+ 'paymill-validate-cc-expdate-month': new Validator(
204
+ 'paymill-validate-cc-expdate-month',
205
+ '',
206
+ function(v) {
207
+ return true;
208
+ },
209
+ ''
210
+ ),
211
+ 'paymill-validate-cc-expdate-year': new Validator(
212
+ 'paymill-validate-cc-expdate-year',
213
+ '',
214
+ function(v) {
215
+ return true;
216
+ },
217
+ ''
218
+ ),
219
+ 'paymill-validate-cc-holder': new Validator(
220
+ 'paymill-validate-cc-holder',
221
+ '',
222
+ function(v) {
223
+ return true;
224
+ },
225
+ ''
226
+ ),
227
+ 'paymill-validate-cc-cvc': new Validator(
228
+ 'paymill-validate-cc-cvc',
229
+ '',
230
+ function(v) {
231
+ return true;
232
+ },
233
+ ''
234
+ )
235
+ };
236
+
237
+ Object.extend(Validation.methods, nvCc);
238
+ }
239
+
240
+ function setElvValidationRules()
241
+ {
242
+ var nvElv = {
243
+ 'paymill-validate-dd-holdername': new Validator(
244
+ 'paymill-validate-dd-holdername',
245
+ getValueIfExist('.paymill-payment-error-holder-elv'),
246
+ function(v) {
247
+ return !(v === '');
248
+ },
249
+ ''
250
+ ),
251
+ 'paymill-validate-dd-account': new Validator(
252
+ 'paymill-validate-dd-account',
253
+ getValueIfExist('.paymill-payment-error-number-elv'),
254
+ function(v) {
255
+ return paymill.validateAccountNumber(v);
256
+ },
257
+ ''
258
+ ),
259
+ 'paymill-validate-dd-bankcode': new Validator(
260
+ 'paymill-validate-dd-bankcode',
261
+ getValueIfExist('.paymill-payment-error-bankcode'),
262
+ function(v) {
263
+ return paymill.validateBankCode(v);
264
+ },
265
+ ''
266
+ )
267
+ };
268
+
269
+ Object.extend(Validation.methods, nvElv);
270
+ }
271
+
272
+ function setCcValidationRules()
273
+ {
274
+ var nvCc = {
275
+ 'paymill-validate-cc-number': new Validator(
276
+ 'paymill-validate-cc-number',
277
+ getValueIfExist('.paymill-payment-error-number'),
278
+ function(v) {
279
+ return paymill.validateCardNumber(v);
280
+ },
281
+ ''
282
+ ),
283
+ 'paymill-validate-cc-expdate-month': new Validator(
284
+ 'paymill-validate-cc-expdate-month',
285
+ getValueIfExist('.paymill-payment-error-expdate'),
286
+ function(v) {
287
+ return paymill.validateExpiry(pmQuery('#paymill_creditcard_expiry_month').val(), pmQuery('#paymill_creditcard_expiry_year').val());
288
+ },
289
+ ''
290
+ ),
291
+ 'paymill-validate-cc-expdate-year': new Validator(
292
+ 'paymill-validate-cc-expdate-year',
293
+ getValueIfExist('.paymill-payment-error-expdate'),
294
+ function(v) {
295
+ return paymill.validateExpiry(pmQuery('#paymill_creditcard_expiry_month').val(), pmQuery('#paymill_creditcard_expiry_year').val());
296
+ },
297
+ ''
298
+ ),
299
+ 'paymill-validate-cc-holder': new Validator(
300
+ 'paymill-validate-cc-holder',
301
+ getValueIfExist('.paymill-payment-error-holder'),
302
+ function(v) {
303
+ return (paymill.validateHolder(v));
304
+ },
305
+ ''
306
+ ),
307
+ 'paymill-validate-cc-cvc': new Validator(
308
+ 'paymill-validate-cc-cvc',
309
+ getValueIfExist('.paymill-payment-error-cvc'),
310
+ function(v) {
311
+ if (paymill.cardType(pmQuery('#paymill_creditcard_number').val()).toLowerCase() === 'maestro') {
312
+ return true;
313
+ }
314
+
315
+ return paymill.validateCvc(v);
316
+ },
317
+ ''
318
+ )
319
+ };
320
+
321
+ Object.extend(Validation.methods, nvCc);
322
+ }
323
+
324
  function addPaymillEvents()
325
  {
326
+ setElvValidationRules();
327
+
328
+ setCcValidationRules();
329
+
330
+ if (pmQuery('.paymill-info-fastCheckout-elv').val() === 'true') {
331
+ unsetElvValidationRules();
332
+ }
333
+
334
+ if (pmQuery('.paymill-info-fastCheckout-cc').val() === 'true') {
335
+ unsetCcValidationRules();
336
+ }
337
+
338
+ if (!eventFlag) {
339
+ pmQuery('#paymill_directdebit_holdername').live('focus', function() {
340
+ setElvValidationRules();
341
+ pmQuery('.paymill-info-fastCheckout-elv').val('false');
342
+ });
343
+
344
+ pmQuery('#paymill_directdebit_account').live('focus', function() {
345
+ setElvValidationRules();
346
+ pmQuery('.paymill-info-fastCheckout-elv').val('false');
347
+ });
348
+
349
+ pmQuery('#paymill_directdebit_bankcode').live('focus', function() {
350
+ setElvValidationRules();
351
+ pmQuery('.paymill-info-fastCheckout-elv').val('false');
352
+ });
353
+
354
+ pmQuery('#paymill_creditcard_holdername').live('focus', function() {
355
+ setCcValidationRules();
356
+ pmQuery('.paymill-info-fastCheckout-cc').val('false');
357
+ });
358
+
359
+ pmQuery('#paymill_creditcard_cvc').live('focus', function() {
360
+ setCcValidationRules();
361
+ pmQuery('.paymill-info-fastCheckout-cc').val('false');
362
+ });
363
+
364
+ pmQuery('#paymill_creditcard_number').live('focus', function() {
365
+ setCcValidationRules();
366
+ pmQuery('.paymill-info-fastCheckout-cc').val('false');
367
+ });
368
+
369
+ pmQuery('#paymill_creditcard_expiry_month').live('change', function() {
370
+ setCcValidationRules();
371
+ pmQuery('.paymill-info-fastCheckout-cc').val('false');
372
+ });
373
+
374
+ pmQuery('#paymill_creditcard_expiry_year').live('change', function() {
375
+ setCcValidationRules();
376
+ pmQuery('.paymill-info-fastCheckout-cc').val('false');
377
+ });
378
+
379
+ pmQuery('#paymill_creditcard_number').live('input', function() {
380
+ paymillShowCardIcon();
381
+ });
382
+
383
+ pmQuery('#paymill_creditcard_cvc').live('input', function() {
384
+ paymillSubmitForm();
385
+ });
386
+
387
+ pmQuery('#paymill_creditcard_expiry_month').live('change', function() {
388
+ paymillSubmitForm();
389
+ });
390
+
391
+ pmQuery('#paymill_creditcard_expiry_year').live('change', function() {
392
+ paymillSubmitForm();
393
+ });
394
+
395
+ pmQuery('#paymill_directdebit_bankcode').live('input', function() {
396
+ paymillSubmitForm();
397
+ });
398
+
399
+ pmQuery('#paymill_creditcard_number').live('input', function() {
400
+ paymillSubmitForm();
401
+ });
402
+
403
+ eventFlag = true;
404
+ }
405
  }
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Paymill_Paymill</name>
4
- <version>3.5.0</version>
5
  <stability>stable</stability>
6
  <license>Open Software License</license>
7
  <channel>community</channel>
@@ -13,12 +13,12 @@ The Paymill Magento extension provides a credit card form and a direct debit for
13
  &lt;br /&gt;&lt;br /&gt;&#xD;
14
  IMPORTANT: Only use the latest version.&#xD;
15
  </description>
16
- <notes> * remove empty input fields while focusing&#xD;
17
- * automatic email after successful invoice creation</notes>
18
  <authors><author><name>PayIntelligent</name><user>Paymill</user><email>community@paymill.de</email></author></authors>
19
- <date>2013-11-12</date>
20
- <time>15:41:07</time>
21
- <contents><target name="magecommunity"><dir name="Paymill"><dir><dir name="Paymill"><dir name="Block"><dir name="Adminhtml"><dir name="Log"><file name="Grid.php" hash="7d74f94403297eeb551272ad5c94513f"/><dir name="View"><file name="Plane.php" hash="179e10aea0213d2caed595ae9111b993"/><file name="Tabs.php" hash="d16d9748921a34067242eaf92d6f299e"/></dir><file name="View.php" hash="af850dd16c3e7505a69a6cb3ca3fbc27"/></dir><file name="Log.php" hash="02930fb46a2a4569176ceb29c45037e8"/></dir><dir name="Payment"><dir name="Form"><file name="PaymentFormAbstract.php" hash="3b7c3c02a50d24def79485a7d2d47dd5"/><file name="PaymentFormCreditcard.php" hash="5351fa41246fb107bd3e62fdd274f715"/><file name="PaymentFormDirectdebit.php" hash="526991e3ed3c25b6c242fdd21e7aba25"/></dir><dir name="Info"><file name="PaymentFormCreditcard.php" hash="3e7a3d2b84878bc22f6ac9e2a0ac5c76"/><file name="PaymentFormDirectdebit.php" hash="bbc8f0cae5dff57df9ec1975650fe5e0"/></dir></dir></dir><dir name="Helper"><file name="CustomerHelper.php" hash="f077f41331778bd63518644b0ca3fec3"/><file name="Data.php" hash="65371da937bd0aa1ba57aa4b9d27d989"/><file name="FastCheckoutHelper.php" hash="48058398d9af8d92f69e0a0566b0b040"/><file name="LoggingHelper.php" hash="53ea7f4d5c3af8de149a06dbe37ac061"/><file name="OptionHelper.php" hash="cbf3daa334bce07b7eb62a5a43dd18dc"/><file name="PaymentHelper.php" hash="1753eb12f7c7c0d30dbe181bb87655b0"/><file name="RefundHelper.php" hash="b936d48e6f9022acb0370ec755cf5850"/><file name="TransactionHelper.php" hash="7cce355230eee2f1c617df1bd18f8752"/></dir><dir name="Model"><file name="Fastcheckout.php" hash="94565a600a12f880edeabc941bd35ded"/><dir name="Log"><file name="Search.php" hash="4338b3876e745405bfcc5a32cfe42527"/></dir><file name="Log.php" hash="476c497495b92c3cf49e0c7b470854d4"/><dir name="Method"><file name="MethodModelAbstract.php" hash="7b7ebba9af21bc887e53e6b53685800f"/><file name="MethodModelCreditcard.php" hash="beba2b1d5de002322c16f5e772c5fe99"/><file name="MethodModelDirectdebit.php" hash="bc7bc9b40760ca488e48a257dccc768d"/></dir><dir name="Mysql4"><dir name="Fastcheckout"><file name="Collection.php" hash="14d4aa413ec952fd2452f08ab2a208f6"/></dir><file name="Fastcheckout.php" hash="56b09daa390ba1f4f5116f1d701833e4"/><dir name="Log"><file name="Collection.php" hash="cf4d8fec68a4cc44b2e47bf69e014cf3"/></dir><file name="Log.php" hash="9bd80dc9300cc189b6b3ebd921b4e3e6"/></dir><file name="Observer.php" hash="589a2f16715445f075110befde459312"/><file name="TransactionData.php" hash="6f2bfd7a7ecde8dc4f21e03d33fdd7e4"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="LogController.php" hash="fe634fc07d161f160ae060600561a0b1"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="402c36431d690ffa9b7eae074cadfb4e"/><file name="config.xml" hash="c6e21b172eb882a982f073762b4b57a5"/><file name="system.xml" hash="0371deb29511df404a695e38f7fb43b1"/></dir><dir name="sql"><dir name="paymill_setup"><file name="mysql4-install-3.0.0.php" hash="542728b094a88aa479de6d49017953ba"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="paymill"><dir><dir name="log"><file name="view.phtml" hash="2d4df28de6e1cb4701963db3d0c0545c"/></dir><dir name="payment"><dir name="info"><file name="creditcard.phtml" hash="1c604ec666d9a3028a04c0d9a4257e4a"/><file name="directdebit.phtml" hash="1c604ec666d9a3028a04c0d9a4257e4a"/></dir></dir></dir></dir></dir><dir name="layout"><file name="paymill.xml" hash="fcc95f6e7c375fee779178a0f9f1a1d8"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="paymill"><dir><dir name="payment"><dir name="form"><file name="creditcard.phtml" hash="9f21301c2ef209073b42cbc6561e20b8"/><file name="directdebit.phtml" hash="f658d4fee38d90dd1840c9bf59ef1126"/></dir><dir name="info"><file name="creditcard.phtml" hash="42f875eb1b6e3e6151ddf152ef0bf13a"/><file name="directdebit.phtml" hash="42f875eb1b6e3e6151ddf152ef0bf13a"/></dir></dir></dir></dir></dir><dir name="layout"><file name="paymill.xml" hash="da4ed04467f50a8a5bbe5766834b765e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Paymill_Paymill.xml" hash="d36d3af5f5752dcf87517272ddb9af53"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Paymill_Paymill.csv" hash="4380f0645f188df42968947f93ef98cd"/></dir><dir name="en_GB"><file name="Paymill_Paymill.csv" hash="8d17d41a96420fad84ca277cc1e08169"/></dir></target><target name="magelocal"><dir name="en_US"><file name="Paymill_Paymill.csv" hash=""/></dir><dir name="es_ES"><file name="Paymill_Paymill.csv" hash=""/></dir></target><target name="mage"><dir name="js"><dir name="paymill"><file name="paymentForm.js" hash="378b8f8e70c44afdffd800bbbbee1aab"/></dir></dir></target><target name="magelib"><dir name="Services"><dir><dir name="Paymill"><dir name="Apiclient"><file name="Curl.php" hash="b1e7fb6eacb5a5cb41dc91247774db45"/><file name="Interface.php" hash="349309458455e550c562fb17cf23f4a6"/><file name="paymill.crt" hash="51e14b4c734e450402ea2cf73f2aee0f"/></dir><file name="Base.php" hash="141fa330c6894ff15faf413be19bf209"/><file name="Clients.php" hash="c8eb5fe8780f2da7b5eb173a5be43c7f"/><file name="Exception.php" hash="9beffb75d92c0de3c1c7ea5b33930fff"/><file name="LoggingInterface.php" hash="46ebeede1da14b761c54a18aff6c3b79"/><file name="Offers.php" hash="e2dcf9c9a54d9aba16e1caf02b438098"/><file name="PaymentProcessor.php" hash="5532a7043b185cd64ced0167c42ea763"/><file name="Payments.php" hash="d2a6d0679701d100c9e876f88215455c"/><file name="Preauthorizations.php" hash="597f7228584f32ee42d8916ae098b454"/><file name="Refunds.php" hash="e909af53108426a9e178417db850675f"/><file name="Subscriptions.php" hash="b72a31c4041029e08df1d7e85aa7391b"/><file name="Transactions.php" hash="a4c9d4d2243af38f2109e89ee4943888"/><file name="Webhooks.php" hash="5fd2e6baf7bb0dc3ad8edb1eab41fb91"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="paymill"><file name="logo.css" hash="76d4266e1ee89042ee140c1b906803dd"/></dir></dir><dir name="images"><dir name="paymill"><file name="icon_32x20_amex.png" hash="42c5fb43b4b603804b50da9761927d40"/><file name="icon_32x20_dinersclub.png" hash="0a7a8fc8f679ccf05d91298c9968629c"/><file name="icon_32x20_discover.png" hash="4fe8ef419087bed97cddbdeb251b847c"/><file name="icon_32x20_jcb.png" hash="774a040f938c5566fa3fddfa840d4743"/><file name="icon_32x20_maestro.png" hash="a6ffd22c9bbedb603449e2aa6136dbd1"/><file name="icon_32x20_mastercard.png" hash="09aef6dcbc50038605b7c0e5a38eb76e"/><file name="icon_32x20_visa.png" hash="e6d54e5c0120202eb5757bcfe499d73b"/><file name="icon_paymill.png" hash="303983a288b45cc7ddc5b88ad2eedd51"/></dir></dir></dir></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
24
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Paymill_Paymill</name>
4
+ <version>3.5.3</version>
5
  <stability>stable</stability>
6
  <license>Open Software License</license>
7
  <channel>community</channel>
13
  &lt;br /&gt;&lt;br /&gt;&#xD;
14
  IMPORTANT: Only use the latest version.&#xD;
15
  </description>
16
+ <notes> * fix broken image in pdf invoice&#xD;
17
+ </notes>
18
  <authors><author><name>PayIntelligent</name><user>Paymill</user><email>community@paymill.de</email></author></authors>
19
+ <date>2013-11-26</date>
20
+ <time>17:07:27</time>
21
+ <contents><target name="magecommunity"><dir name="Paymill"><dir><dir name="Paymill"><dir name="Block"><dir name="Adminhtml"><dir name="Log"><file name="Grid.php" hash="7d74f94403297eeb551272ad5c94513f"/><dir name="View"><file name="Plane.php" hash="179e10aea0213d2caed595ae9111b993"/><file name="Tabs.php" hash="d16d9748921a34067242eaf92d6f299e"/></dir><file name="View.php" hash="af850dd16c3e7505a69a6cb3ca3fbc27"/></dir><file name="Log.php" hash="02930fb46a2a4569176ceb29c45037e8"/></dir><dir name="Payment"><dir name="Form"><file name="PaymentFormAbstract.php" hash="b42edc338110bd2f81fcf85169d3d82c"/><file name="PaymentFormCreditcard.php" hash="5351fa41246fb107bd3e62fdd274f715"/><file name="PaymentFormDirectdebit.php" hash="526991e3ed3c25b6c242fdd21e7aba25"/></dir><dir name="Info"><file name="PaymentFormCreditcard.php" hash="9d11216e743fa204bea678276f5a16b3"/><file name="PaymentFormDirectdebit.php" hash="2143f473d531511aa2f6ae1051b0e7f9"/></dir></dir></dir><dir name="Helper"><file name="CustomerHelper.php" hash="ff84eeb76190bebb7c6eeeb0a6aedadf"/><file name="Data.php" hash="65371da937bd0aa1ba57aa4b9d27d989"/><file name="FastCheckoutHelper.php" hash="57372d9ec58c027dbd15771ab703da30"/><file name="LoggingHelper.php" hash="53ea7f4d5c3af8de149a06dbe37ac061"/><file name="OptionHelper.php" hash="cbf3daa334bce07b7eb62a5a43dd18dc"/><file name="PaymentHelper.php" hash="9680fc6d2eb76ec3295bada2dd0ee5da"/><file name="RefundHelper.php" hash="b936d48e6f9022acb0370ec755cf5850"/><file name="TransactionHelper.php" hash="7cce355230eee2f1c617df1bd18f8752"/></dir><dir name="Model"><file name="Fastcheckout.php" hash="a0ac4318beb875fa24a09dcd1fab81e7"/><dir name="Log"><file name="Search.php" hash="4338b3876e745405bfcc5a32cfe42527"/></dir><file name="Log.php" hash="476c497495b92c3cf49e0c7b470854d4"/><dir name="Method"><file name="MethodModelAbstract.php" hash="49ef0fda51651524a9e11cfc9b38db8f"/><file name="MethodModelCreditcard.php" hash="404c8b23b02ae7001687e74c681b7592"/><file name="MethodModelDirectdebit.php" hash="bc7bc9b40760ca488e48a257dccc768d"/></dir><dir name="Mysql4"><dir name="Fastcheckout"><file name="Collection.php" hash="14d4aa413ec952fd2452f08ab2a208f6"/></dir><file name="Fastcheckout.php" hash="56b09daa390ba1f4f5116f1d701833e4"/><dir name="Log"><file name="Collection.php" hash="cf4d8fec68a4cc44b2e47bf69e014cf3"/></dir><file name="Log.php" hash="9bd80dc9300cc189b6b3ebd921b4e3e6"/></dir><file name="Observer.php" hash="9382d38aed9aff7c3c4bc3e356dac9bf"/><file name="TransactionData.php" hash="6f2bfd7a7ecde8dc4f21e03d33fdd7e4"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="LogController.php" hash="fe634fc07d161f160ae060600561a0b1"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="402c36431d690ffa9b7eae074cadfb4e"/><file name="config.xml" hash="e288e8207a3fcd33b341cf8145c2aa46"/><file name="system.xml" hash="b5cdd598f98a2aed06ebf6d638194206"/></dir><dir name="sql"><dir name="paymill_setup"><file name="mysql4-install-3.0.0.php" hash="f6c07215c8bad93c70f3db364c2b43c0"/></dir></dir></dir><dir name="Paymillcc"><dir name="Block"><dir name="Form"><file name="Paymill.php" hash="e0a8d4d996c4d967433d146c66066675"/></dir><dir name="Info"><file name="Paymill.php" hash="227a03895daff070b81db745832113b5"/></dir></dir><dir name="Helper"><file name="Data.php" hash="901beaefa74e1d111d535b6d7a039f8b"/></dir><file name="LibraryVersion.php" hash="5df580a71fe7d5ef555838427b00ffba"/><dir name="Model"><file name="Customerdata.php" hash="cb9acf05ad612c3012554b6e20c66a20"/><dir name="Mysql4"><dir name="Customerdata"><file name="Collection.php" hash="b89dd70704e7fdf0cd6cd955c8bec7e3"/></dir><file name="Customerdata.php" hash="fd65309ee965a98e6840127c70ca3fdd"/></dir><file name="PaymentAbstract.php" hash="bbf1ecb31bcf6bef5614bad8ac4a9cc8"/><file name="PaymentMethod.php" hash="92650ea95a9d1b5a0e28b1c637528a65"/></dir><dir name="etc"><file name="config.xml" hash="13911c0caf93dff2089d96f8bc859059"/><file name="system.xml" hash="049a03e9b93fe7c4d30bc171c93a956c"/></dir><dir name="sql"><dir name="paymillcc_setup"><file name="mysql4-install-2.1.2.php" hash="5a4fd9f053eebe81b1db9a62ab3e5c90"/><file name="mysql4-upgrade-2.1.1-2.1.2.php" hash="5a4fd9f053eebe81b1db9a62ab3e5c90"/></dir></dir></dir><dir name="Paymillelv"><dir name="Block"><dir name="Form"><file name="Paymill.php" hash="6dc2c36cbbbd9837c211cdfb2e266891"/></dir><dir name="Info"><file name="Paymill.php" hash="688faf632b0511f1f7551b85d6025ce8"/></dir></dir><dir name="Helper"><file name="Data.php" hash="f245b99eaf05d7a4d8870eea95a4f3a2"/></dir><dir name="Model"><file name="Customerdata.php" hash="4c8b2c12fb3855a7c527c72cb61ea563"/><dir name="Mysql4"><dir name="Customerdata"><file name="Collection.php" hash="b8ad389912dde4201bdcd77757cc8b3f"/></dir><file name="Customerdata.php" hash="d7adacd7f5fd8fff667226db0a849e71"/></dir><file name="PaymentAbstract.php" hash="bbf1ecb31bcf6bef5614bad8ac4a9cc8"/><file name="PaymentMethod.php" hash="a74bd8e73439d789d29e1b40cb150ebb"/></dir><dir name="etc"><file name="config.xml" hash="a4fa5e1f8217aff5dd70c4ebbfd3feed"/><file name="system.xml" hash="193a984065342a7ec2621f9b3e3aa6f5"/></dir><dir name="sql"><dir name="paymillelv_setup"><file name="mysql4-install-2.1.2.php" hash="114ff4ff631bdea4a965d58d563c44b7"/><file name="mysql4-upgrade-2.1.1-2.1.2.php" hash="114ff4ff631bdea4a965d58d563c44b7"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="paymill"><dir><dir name="log"><file name="view.phtml" hash="2d4df28de6e1cb4701963db3d0c0545c"/></dir><dir name="payment"><dir name="info"><file name="creditcard.phtml" hash="1c604ec666d9a3028a04c0d9a4257e4a"/><file name="creditcard_pdf.phtml" hash="68febe619bb9918b785dcbb0593c4ebe"/><file name="directdebit.phtml" hash="1c604ec666d9a3028a04c0d9a4257e4a"/><file name="directdebit_pdf.phtml" hash="5a2e5c36d4f4702e5f9be4b5affe3421"/></dir></dir></dir></dir></dir><dir name="layout"><file name="paymill.xml" hash="fcc95f6e7c375fee779178a0f9f1a1d8"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="paymill"><dir><dir name="form"><file name="paymill.phtml" hash="a51c471c33a281335ff87715b4656fed"/><file name="paymill_elv.phtml" hash="1cd97b98a789cdd47e8edbf82f28f276"/></dir><dir name="payment"><dir name="form"><file name="creditcard.phtml" hash="3d6e9fc0b4952c3d651973414ec8c812"/><file name="directdebit.phtml" hash="17f5f15153ca0f3ceea2fc66a2876acb"/></dir><dir name="info"><file name="creditcard.phtml" hash="42f875eb1b6e3e6151ddf152ef0bf13a"/><file name="directdebit.phtml" hash="42f875eb1b6e3e6151ddf152ef0bf13a"/></dir></dir></dir></dir></dir><dir name="layout"><file name="paymill.xml" hash="da4ed04467f50a8a5bbe5766834b765e"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Paymill_Paymill.xml" hash="d36d3af5f5752dcf87517272ddb9af53"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Paymill_Paymill.csv" hash="6041b143470bb035f6ba78d30714bbb6"/></dir><dir name="en_GB"><file name="Paymill_Paymill.csv" hash="81a19829117ebc2c486ae0935bcbcdb4"/></dir></target><target name="magelocal"><dir name="en_US"><file name="Paymill_Paymill.csv" hash=""/></dir><dir name="es_ES"><file name="Paymill_Paymill.csv" hash=""/></dir></target><target name="mage"><dir name="js"><dir name="paymill"><file name="paymentForm.js" hash="3d5066189641cc6924772b7cc6321b78"/></dir></dir></target><target name="magelib"><dir name="Services"><dir><dir name="Paymill"><dir name="Apiclient"><file name="Curl.php" hash="b1e7fb6eacb5a5cb41dc91247774db45"/><file name="Interface.php" hash="349309458455e550c562fb17cf23f4a6"/><file name="paymill.crt" hash="51e14b4c734e450402ea2cf73f2aee0f"/></dir><file name="Base.php" hash="141fa330c6894ff15faf413be19bf209"/><file name="Clients.php" hash="c8eb5fe8780f2da7b5eb173a5be43c7f"/><file name="Exception.php" hash="9beffb75d92c0de3c1c7ea5b33930fff"/><file name="LoggingInterface.php" hash="46ebeede1da14b761c54a18aff6c3b79"/><file name="Offers.php" hash="e2dcf9c9a54d9aba16e1caf02b438098"/><file name="PaymentProcessor.php" hash="5532a7043b185cd64ced0167c42ea763"/><file name="Payments.php" hash="d2a6d0679701d100c9e876f88215455c"/><file name="Preauthorizations.php" hash="597f7228584f32ee42d8916ae098b454"/><file name="Refunds.php" hash="e909af53108426a9e178417db850675f"/><file name="Subscriptions.php" hash="b72a31c4041029e08df1d7e85aa7391b"/><file name="Transactions.php" hash="a4c9d4d2243af38f2109e89ee4943888"/><file name="Webhooks.php" hash="5fd2e6baf7bb0dc3ad8edb1eab41fb91"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="paymill"><file name="logo.css" hash="5a5712da05d598fb11aad22e7854da4a"/></dir></dir><dir name="images"><dir name="paymill"><file name="icon_32x20_amex.png" hash="42c5fb43b4b603804b50da9761927d40"/><file name="icon_32x20_dinersclub.png" hash="0a7a8fc8f679ccf05d91298c9968629c"/><file name="icon_32x20_discover.png" hash="4fe8ef419087bed97cddbdeb251b847c"/><file name="icon_32x20_jcb.png" hash="774a040f938c5566fa3fddfa840d4743"/><file name="icon_32x20_maestro.png" hash="a6ffd22c9bbedb603449e2aa6136dbd1"/><file name="icon_32x20_mastercard.png" hash="09aef6dcbc50038605b7c0e5a38eb76e"/><file name="icon_32x20_unionpay.png" hash="6c9d16d6c65c0da5ff11e8ae13b01d15"/><file name="icon_32x20_visa.png" hash="e6d54e5c0120202eb5757bcfe499d73b"/><file name="icon_paymill.png" hash="303983a288b45cc7ddc5b88ad2eedd51"/></dir></dir></dir></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
24
  </package>
skin/frontend/base/default/css/paymill/logo.css CHANGED
@@ -18,44 +18,61 @@
18
  text-decoration: underline;
19
  }
20
 
21
- .paymill_creditcard_number-visa
22
  {
23
- background: url('../../images/paymill/icon_32x20_visa.png') no-repeat center right !important;
 
 
24
  }
25
 
26
- .paymill_creditcard_number-mastercard
27
  {
28
- background: url('../../images/paymill/icon_32x20_mastercard.png') no-repeat center right !important;
 
 
29
  }
30
 
31
- .paymill_creditcard_number-american
32
  {
33
- background: url('../../images/paymill/icon_32x20_amex.png') no-repeat center right !important;
 
 
34
  }
35
 
36
- .paymill_creditcard_number-jcb
37
  {
38
- background: url('../../images/paymill/icon_32x20_jcb.png') no-repeat center right !important;
 
 
 
39
  }
40
 
41
- .paymill_creditcard_number-maestro
42
  {
43
- background: url('../../images/paymill/icon_32x20_maestro.png') no-repeat center right !important;
 
 
44
  }
45
 
46
- .paymill_creditcard_number-unionpay
47
  {
48
- background: url('../../images/paymill/icon_32x20_unionpay.png') no-repeat center right !important;
 
 
49
  }
50
 
51
- .paymill_creditcard_number-diners
52
  {
53
- background: url('../../images/paymill/icon_32x20_dinersclub.png') no-repeat center right !important;
 
 
54
  }
55
 
56
- .paymill_creditcard_number-discover
57
  {
58
- background: url('../../images/paymill/icon_32x20_discover.png') no-repeat center right !important;
 
 
59
  }
60
 
61
  .tooltip
18
  text-decoration: underline;
19
  }
20
 
21
+ .paymill-card-number-visa
22
  {
23
+ background-image: url('../../images/paymill/icon_32x20_visa.png') !important;
24
+ background-repeat: no-repeat !important;
25
+ background-position: right center !important;
26
  }
27
 
28
+ .paymill-card-number-mastercard
29
  {
30
+ background-image: url('../../images/paymill/icon_32x20_mastercard.png') !important;
31
+ background-repeat: no-repeat !important;
32
+ background-position: right center !important;
33
  }
34
 
35
+ .paymill-card-number-amex
36
  {
37
+ background-image: url('../../images/paymill/icon_32x20_amex.png') !important;
38
+ background-repeat: no-repeat !important;
39
+ background-position: right center !important;
40
  }
41
 
42
+ .paymill-card-number-jcb
43
  {
44
+ background-image: url('../../images/paymill/icon_32x20_jcb.png') !important;
45
+ background-repeat: no-repeat !important;
46
+ background-position: right center !important;
47
+
48
  }
49
 
50
+ .paymill-card-number-maestro
51
  {
52
+ background-image: url('../../images/paymill/icon_32x20_maestro.png') !important;
53
+ background-repeat: no-repeat !important;
54
+ background-position: right center !important;
55
  }
56
 
57
+ .paymill-card-number-carte-bleue
58
  {
59
+ background-image: url('../../images/paymill/icon_32x20_unionpay.png') !important;
60
+ background-repeat: no-repeat !important;
61
+ background-position: right center !important;
62
  }
63
 
64
+ .paymill-card-number-diners
65
  {
66
+ background-image: url('../../images/paymill/icon_32x20_dinersclub.png') !important;
67
+ background-repeat: no-repeat !important;
68
+ background-position: right center !important;
69
  }
70
 
71
+ .paymill-card-number-discover
72
  {
73
+ background-image: url('../../images/paymill/icon_32x20_discover.png') !important;
74
+ background-repeat: no-repeat !important;
75
+ background-position: right center !important;
76
  }
77
 
78
  .tooltip
skin/frontend/base/default/images/paymill/icon_32x20_unionpay.png ADDED
Binary file