Mehr Informationen finden Sie auf www.heidelpay.de"
@@ -24,14 +25,12 @@
"Insert 0 to disable limit.","Tragen Sie 0 ein um das Limit zu deaktivieren."
"If 'Debit' is enabled the card will be charged immediately. Otherwise the amount will first be authorised and charged at order creation.","Wenn diese Einstellung auf Ja steht, wird die Karte sofort belastet. Ansonsten wird der Betrag nur reserviert und bei erstellter Bestellung abgebucht."
"An unexpected error occurred. Please contact us to get further information.","Es ist ein Fehler aufgetreten. Bitte kontaktieren Sie uns für weitere Informationen."
+"Billing address should be same as shipping address.","Bitte wählen Sie die selbe Rechnungsadresse wie Lieferadresse."
"Never","Nie"
"Same Shipping Address","Selbe Lieferadresse"
"Always","Immer"
-"Please confirm your payment:","Bitte führen Sie nun die Zahlung durch:"
-"pay now","Jetzt bezahlen"
-
"Credit Card","Kreditkarte"
"Debit Card","Debitkarte"
"Direct Debit","Lastschrift"
@@ -44,6 +43,7 @@
"Mangirkart","MangirKart"
"MasterPass","MasterPass"
"Sofort.","Sofort."
+"Santander Hire Purchase","Ratenkauf von Santander"
"IBAN", "IBAN"
"BIC","BIC"
@@ -59,6 +59,8 @@
"Year","Jahr"
"The given IBAN is invalid.","Die angegebene IBAN ist ungültig."
+"The given date is invalid.","Das angegebene Datum ist ungültig"
+"You have to be at least 18 years old.","Die Verwendung der Zahlart ist erst ab 18 Jahren möglich"
"January","Januar"
"February","Februar"
@@ -73,15 +75,22 @@
"November","November"
"December","Dezember"
-"This is a required field.","Dieses Feld ist erforderlich."
-
"ShortId : %1","ShortId : %1"
-"Amount or currency missmatch : %1","Abweichender Betrag oder Währung : %1"
+"Amount or currency missmatch : %1","Abweichender Betrag oder Währung : %1"
+
+"Please confirm your payment:","Bitte führen Sie nun die Zahlung durch:"
+"pay now","Jetzt bezahlen"
+"Select installment plan","Ratenplan auswählen"
+"This is a required field.","Dieses Feld ist erforderlich."
"Payment information","Zahlungsinformationen"
"Reference","Verwendungszweck"
+"Place Order","Bestellung anlegen"
"Please transfer the amount of %1 %2 to the following account
Holder: %3 IBAN: %4 BIC: %5
Please use only this identification number as the descriptor : %6","Bitte überweisen Sie uns den Betrag von %1 %2 auf folgendes Konto:
Inhaber: %3 IBAN: %4 BIC: %5
Geben Sie als Verwendungszweck bitte ausschließlich diese Identifikationsnummer an: %6"
"Please transfer the amount of %1 %2 to the following account after your order has arrived:
Holder: %3 IBAN: %4 BIC: %5
Please use only this identification number as the descriptor : %6","Bitte überweisen Sie uns den Betrag von %1 %2 nach Erhalt der Ware auf folgendes Konto:
Inhaber: %3 IBAN: %4 BIC: %5
Geben Sie als Verwendungszweck bitte ausschließlich diese Identifikationsnummer an: %6"
"The amount of %1 %2 will be debited from this account within the next days:
IBAN: %3
The booking contains the mandate reference ID: %4 and the creditor identifier: %5
Please ensure that there will be sufficient funds on the corresponding account.","Der Betrag von %1 %2 wird in den nächsten Tagen von folgendem Konto abgebucht:
IBAN: %3
Die Abbuchung enthält die Mandatsreferenz-ID: %4 und die Gläubiger ID: %5
Bitte sorgen Sie für ausreichende Deckung auf dem entsprechenden Konto."
"Heidelpay Error at sending Finalize Request. The Shipment was not created.","Heidelpay Fehler beim Senden des Finalize Requests. Der Versand wurde nicht erstellt."
"Shipping Notification has been sent to Heidelpay.","Versandbenachrichtigung wurde an Heidelpay gesendet."
+
+"Hire Purchase Precontract","Vorvertragliche Informationen:"
+"Hire Purchase Precontract download","Vorvertragliche Informationen zum Ratenkauf hier abrufen"
diff --git a/i18n/en_US.csv b/i18n/en_US.csv
index 30e5af84645..574a17b1b5b 100755
--- a/i18n/en_US.csv
+++ b/i18n/en_US.csv
@@ -11,11 +11,21 @@
"HGWIV","Invoice"
"HGWIVS","Invoice Secured (B2C)"
"HGWIDL","iDeal"
+"HGWSANHP","Santander Hire Purchase"
"HGW_ABOUT_US","heidelpay GmbH, shortly: heidelpay, is a leading payment institution for online payment methods authorized and regulated by BaFin, which offers the full range of services for an electronic payment processing from one single source: from processing of transactions and providing of acceptance contracts to monitoring and risk management.
For more information please visit www.heidelpay.de"
+"Security Sender","Sender-ID"
+"User Login","Login"
+"User Password","Password"
+"Sandbox Mode","Sandbox"
"If this is enabled the heidelpay sandbox will be used. Otherwise the real payment system will be used.","If this is enabled the heidelpay sandbox will be used. Otherwise the real payment system will be used."
+"Enabled","Enabled"
+"Channel","Channel-ID"
+"Insert 0 to disable limit.","Insert 0 to disable limit."
+"If 'Debit' is enabled the card will be charged immediately. Otherwise the amount will first be authorised and charged at order creation.","If 'Debit' is enabled the card will be charged immediately. Otherwise the amount will first be authorised and charged at order creation."
"An unexpected error occurred. Please contact us to get further information.","An unexpected error occurred. Please contact us to get further information."
+"Billing address should be same as shipping address.","Billing address should be same as shipping address."
"Never","Never"
"Same Shipping Address","Same Shipping Address"
@@ -33,6 +43,7 @@
"Mangirkart","MangirKart"
"MasterPass","MasterPass"
"Sofort.","Sofort."
+"Santander Hire Purchase","Santander Hire Purchase"
"IBAN","IBAN"
"BIC","BIC"
@@ -48,6 +59,8 @@
"Year","Year"
"The given IBAN is invalid.","The given IBAN is invalid."
+"The given date is invalid.","The given date is invalid."
+"You have to be at least 18 years old.","You have to be at least 18 years old."
"January","January"
"February","February"
@@ -67,12 +80,17 @@
"Please confirm your payment:","Please confirm your payment:"
"pay now","pay now"
-"Place Order","Place Order"
+"Select installment plan","Select installment plan"
+"This is a required field.","This is a required field."
"Payment information","Payment information"
"Reference","Reference"
+"Place Order","Place Order"
"Please transfer the amount of %1 %2 to the following account
Holder: %3 IBAN: %4 BIC: %5
Please use only this identification number as the descriptor : %6","Please transfer the amount of %1 %2 to the following account
Holder: %3 IBAN: %4 BIC: %5
Please use only this identification number as the descriptor : %6"
"Please transfer the amount of %1 %2 to the following account after your order has arrived:
Holder: %3 IBAN: %4 BIC: %5
Please use only this identification number as the descriptor : %6","Please transfer the amount of %1 %2 to the following account after your order has arrived:
Holder: %3 IBAN: %4 BIC: %5
Please use only this identification number as the descriptor : %6"
"The amount of %1 %2 will be debited from this account within the next days:
IBAN: %3
The booking contains the mandate reference ID: %4 and the creditor identifier: %5
Please ensure that there will be sufficient funds on the corresponding account.", "The amount of %1 %2 will be debited from this account within the next days:
IBAN: %3
The booking contains the mandate reference ID: %4 and the creditor identifier: %5
Please ensure that there will be sufficient funds on the corresponding account."
"Heidelpay Error at sending Finalize Request. The Shipment was not created.","Heidelpay Error at sending Finalize Request. The Shipment was not created."
"Shipping Notification has been sent to Heidelpay.","Shipping Notification has been sent to Heidelpay."
+
+"Hire Purchase Precontract","Precontract:"
+"Hire Purchase Precontract download","Download precontract here"
diff --git a/view/frontend/layout/checkout_index_index.xml b/view/frontend/layout/checkout_index_index.xml
old mode 100644
new mode 100755
index e0c74392d53..5e64451122b
--- a/view/frontend/layout/checkout_index_index.xml
+++ b/view/frontend/layout/checkout_index_index.xml
@@ -36,7 +36,7 @@
true
- false
+ truetrue
@@ -48,16 +48,19 @@
true
- false
+ true
- false
+ true
- false
+ true
- false
+ true
+
+
+ true
diff --git a/view/frontend/layout/hgw_index_installmentplan.xml b/view/frontend/layout/hgw_index_installmentplan.xml
new file mode 100644
index 00000000000..0bfdcbf3daa
--- /dev/null
+++ b/view/frontend/layout/hgw_index_installmentplan.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/view/frontend/templates/installment_plan.phtml b/view/frontend/templates/installment_plan.phtml
new file mode 100644
index 00000000000..a3f107e581f
--- /dev/null
+++ b/view/frontend/templates/installment_plan.phtml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/view/frontend/web/js/view/payment/hgw-payments.js b/view/frontend/web/js/view/payment/hgw-payments.js
old mode 100644
new mode 100755
index 27a49694994..6aaceeb0dc4
--- a/view/frontend/web/js/view/payment/hgw-payments.js
+++ b/view/frontend/web/js/view/payment/hgw-payments.js
@@ -23,7 +23,7 @@ define(
},
{
type: 'hgwpal',
- component: 'Heidelpay_Gateway/js/view/payment/method-renderer/hgw-abstract'
+ component: 'Heidelpay_Gateway/js/view/payment/method-renderer/hgw-paypal'
},
{
type: 'hgwpp',
@@ -52,6 +52,10 @@ define(
{
type: 'hgwidl',
component: 'Heidelpay_Gateway/js/view/payment/method-renderer/hgw-ideal'
+ },
+ {
+ type: 'hgwsanhp',
+ component: 'Heidelpay_Gateway/js/view/payment/method-renderer/hgw-santander-hire-purchase'
}
);
return Component.extend({});
diff --git a/view/frontend/web/js/view/payment/method-renderer/hgw-abstract.js b/view/frontend/web/js/view/payment/method-renderer/hgw-abstract.js
index 5d9615ac4a9..6fa269b01f1 100644
--- a/view/frontend/web/js/view/payment/method-renderer/hgw-abstract.js
+++ b/view/frontend/web/js/view/payment/method-renderer/hgw-abstract.js
@@ -7,9 +7,10 @@ define(
'Magento_Checkout/js/action/select-payment-method',
'Magento_Checkout/js/checkout-data',
'Magento_Checkout/js/model/quote',
+ 'Magento_Checkout/js/action/select-billing-address',
'moment'
],
- function ($, Component, placeOrderAction, additionalValidators, selectPaymentMethodAction, checkoutData, quote) {
+ function ($, Component, placeOrderAction, additionalValidators, selectPaymentMethodAction, checkoutData, quote, selectBillingAddress, moment) {
'use strict';
// add IBAN validator
@@ -20,6 +21,25 @@ define(
}, $.mage.__('The given IBAN is invalid.')
);
+ $.validator.addMethod(
+ 'valid-date', function (date){
+ return (date);
+ }, $.mage.__('Invalid date.')
+ );
+ $.validator.addMethod(
+ 'is-customer-18', function (date){
+ var inputDate = new Date(date);
+ var currentDate = new Date();
+ var is18 = new Date(currentDate-inputDate).getFullYear() - new Date(0).getFullYear() >= 18;
+
+ return is18;
+ }, $.mage.__('You have to be at least 18.')
+ );
+
+ $.validator.setDefaults({
+ ignore: ''
+ });
+
return Component.extend({
/**
@@ -29,11 +49,16 @@ define(
savesAdditionalData: false,
defaults: {
- template: 'Heidelpay_Gateway/payment/heidelpay-form'
+ template: 'Heidelpay_Gateway/payment/heidelpay-form',
+ useShippingAddressAsBillingAddress: false,
+ hgwDobYear: '',
+ hgwDobMonth: '',
+ hgwDobDay: '',
+ hgwSalutation: ''
},
/**
- * Indicates if the payment method is storing addtional
+ * Indicates if the payment method is storing additional
* information for the payment.
*
* @returns {boolean}
@@ -55,27 +80,21 @@ define(
*
* This method needs to be overloaded by the payment renderer component, if needed.
*/
- getBirthdate: function() {},
+ getBirthdate: function() {
+ var day = this.hgwDobDay();
+ var date = new Date(this.hgwDobYear(), this.hgwDobMonth(), day);
+
+ // checks whether created date is same as input and return null if not.
+ if(!(Boolean(+date) && date.getDate() == day)) {return null;}
+ return moment(date).format('YYYY-MM-DD');
+ },
/**
* Function to receive the customer's full name.
*/
getFullName: function() {
- var name = '', billingAddress = quote.billingAddress();
-
- if (billingAddress !== null) {
- if (typeof billingAddress.firstname !== 'undefined' && billingAddress.firstname !== null) {
- name += billingAddress.firstname;
- }
-
- if (typeof billingAddress.middlename !== 'undefined' && billingAddress.middlename !== null) {
- name += ' ' + billingAddress.middlename;
- }
-
- if (typeof billingAddress.lastname !== 'undefined' && billingAddress.lastname !== null) {
- name += ' ' + billingAddress.lastname;
- }
- }
+ var billingAddress = quote.billingAddress();
+ var name = this.getNameFromAddress(billingAddress);
// fallback, if name isn't set yet.
if (name === '') {
@@ -99,6 +118,25 @@ define(
return name;
},
+ getNameFromAddress: function(address) {
+ var name = '';
+
+ if (address !== null) {
+ if (typeof address.firstname !== 'undefined' && address.firstname !== null) {
+ name += address.firstname;
+ }
+
+ if (typeof address.middlename !== 'undefined' && address.middlename !== null) {
+ name += ' ' + address.middlename;
+ }
+
+ if (typeof address.lastname !== 'undefined' && address.lastname !== null) {
+ name += ' ' + address.lastname;
+ }
+ }
+ return name;
+ },
+
/**
* Redirect to hgw controller
* Override magento placepayment function
@@ -142,6 +180,10 @@ define(
selectPaymentMethodAction(this.getData());
checkoutData.setSelectedPaymentMethod(this.item.method);
+ if(this.useShippingAddressAsBillingAddress) {
+ selectBillingAddress(quote.shippingAddress());
+ }
+
return true;
}
});
diff --git a/view/frontend/web/js/view/payment/method-renderer/hgw-directdebitsecured.js b/view/frontend/web/js/view/payment/method-renderer/hgw-directdebitsecured.js
index 14abd5df1ba..804f745b015 100644
--- a/view/frontend/web/js/view/payment/method-renderer/hgw-directdebitsecured.js
+++ b/view/frontend/web/js/view/payment/method-renderer/hgw-directdebitsecured.js
@@ -25,11 +25,8 @@ define(
template: 'Heidelpay_Gateway/payment/heidelpay-directdebit-secured-form',
hgwIban: '',
hgwHolder: '',
- hgwSalutation: '',
- hgwDobYear: '',
- hgwDobMonth: '',
- hgwDobDay: '',
- years: [null]
+ years: [null],
+ useShippingAddressAsBillingAddress: true
},
initialize: function () {
@@ -124,17 +121,6 @@ define(
};
},
- /**
- * Returns the birthdate in ISO 8601 format.
- *
- * @returns {string}
- */
- getBirthdate: function () {
- return moment(
- new Date(this.hgwDobYear(), this.hgwDobMonth(), this.hgwDobDay())
- ).format('YYYY-MM-DD');
- },
-
validate: function () {
var form = $('#hgw-directdebit-secured-form');
diff --git a/view/frontend/web/js/view/payment/method-renderer/hgw-invoicesecured.js b/view/frontend/web/js/view/payment/method-renderer/hgw-invoicesecured.js
index 910186ff541..e72c1b02f3e 100644
--- a/view/frontend/web/js/view/payment/method-renderer/hgw-invoicesecured.js
+++ b/view/frontend/web/js/view/payment/method-renderer/hgw-invoicesecured.js
@@ -23,11 +23,8 @@ define(
defaults: {
template: 'Heidelpay_Gateway/payment/heidelpay-invoice-secured-form',
- hgwDobYear: '',
- hgwDobMonth: '',
- hgwDobDay: '',
- hgwSalutation: '',
- years: [null]
+ years: [null],
+ useShippingAddressAsBillingAddress: true
},
initialize: function () {
@@ -106,17 +103,6 @@ define(
};
},
- /**
- * Returns the birthdate in ISO 8601 format.
- *
- * @returns {string}
- */
- getBirthdate: function () {
- return moment(
- new Date(this.hgwDobYear(), this.hgwDobMonth(), this.hgwDobDay())
- ).format('YYYY-MM-DD');
- },
-
validate: function() {
var form = $('#hgw-invoice-secured-form');
diff --git a/view/frontend/web/js/view/payment/method-renderer/hgw-paypal.js b/view/frontend/web/js/view/payment/method-renderer/hgw-paypal.js
new file mode 100644
index 00000000000..c2a8497aaa4
--- /dev/null
+++ b/view/frontend/web/js/view/payment/method-renderer/hgw-paypal.js
@@ -0,0 +1,22 @@
+define(
+ [
+ 'jquery',
+ 'Heidelpay_Gateway/js/view/payment/method-renderer/hgw-abstract',
+ 'Heidelpay_Gateway/js/action/place-order',
+ 'Magento_Checkout/js/model/url-builder',
+ 'mage/storage',
+ 'Magento_Checkout/js/model/payment/additional-validators',
+ 'Magento_Customer/js/model/customer',
+ 'Magento_Checkout/js/model/quote'
+ ],
+ function ($, Component, placeOrderAction, urlBuilder, storage, additionalValidators, customer, quote) {
+ 'use strict';
+
+ return Component.extend({
+ defaults: {
+ useShippingAddressAsBillingAddress: true
+ }
+
+ });
+ }
+);
\ No newline at end of file
diff --git a/view/frontend/web/js/view/payment/method-renderer/hgw-santander-hire-purchase.js b/view/frontend/web/js/view/payment/method-renderer/hgw-santander-hire-purchase.js
new file mode 100644
index 00000000000..495712b66af
--- /dev/null
+++ b/view/frontend/web/js/view/payment/method-renderer/hgw-santander-hire-purchase.js
@@ -0,0 +1,116 @@
+define(
+ [
+ 'jquery',
+ 'Heidelpay_Gateway/js/view/payment/method-renderer/hgw-abstract',
+ 'Heidelpay_Gateway/js/action/place-order',
+ 'Magento_Checkout/js/model/url-builder',
+ 'mage/storage',
+ 'Magento_Checkout/js/model/payment/additional-validators',
+ 'Magento_Customer/js/model/customer',
+ 'Magento_Checkout/js/model/quote',
+ 'moment'
+ ],
+ function ($, Component, placeOrderAction, urlBuilder, storage, additionalValidators, customer, quote, moment) {
+ 'use strict';
+
+ return Component.extend({
+
+ /**
+ * Property that indicates, if the payment method is storing
+ * additional data.
+ */
+ savesAdditionalData: true,
+
+ defaults: {
+ template: 'Heidelpay_Gateway/payment/heidelpay-santander-hire-purchase',
+ years: [null],
+ useShippingAddressAsBillingAddress: true
+ },
+
+ initialize: function () {
+ this._super();
+ this.getAdditionalPaymentInformation();
+
+ // init years select menu
+ for (let i = (new Date().getFullYear() - 17); i >= new Date().getFullYear() - 120; i--) {
+ this.years.push(i);
+ }
+
+ return this;
+ },
+
+ initObservable: function() {
+ this._super()
+ .observe(['hgwSalutation', 'hgwDobYear', 'hgwDobMonth', 'hgwDobDay', 'years', 'hgwInstallmentPlanUrl', 'hgwInstallmentPlanVisible']);
+ return this;
+ },
+
+ getAdditionalPaymentInformation: function() {
+ // recognition: only when there is a logged in customer
+ if (customer.isLoggedIn()) {
+ // if we have a shipping address, go on
+ if( quote.shippingAddress() !== null ) {
+ var parent = this;
+ var serviceUrl = urlBuilder.createUrl('/hgw/get-payment-info', {});
+ var hgwPayload = {
+ quoteId: quote.getQuoteId(),
+ paymentMethod: this.item.method
+ };
+
+ storage.post(
+ serviceUrl, JSON.stringify(hgwPayload)
+ ).done(
+ function(data) {
+ var info = JSON.parse(data);
+
+ // set salutation and birthdate, if set.
+ if( info !== null ) {
+ if (info.hasOwnProperty('hgw_salutation'))
+ parent.hgwSalutation(info.hgw_salutation);
+
+ if (info.hasOwnProperty('hgw_birthdate') && info.hgw_birthdate !== null) {
+ var date = moment(info.hgw_birthdate, 'YYYY-MM-DD');
+
+ parent.hgwDobDay(date.date());
+ parent.hgwDobMonth(date.month());
+ parent.hgwDobYear(date.year());
+
+ // workaround: if month is 'january', the month isn't selected.
+ if (date.month() === 0) {
+ $("#hgwivs_birthdate_month option:eq(1)").prop('selected', true);
+ }
+ }
+ }
+ }
+ );
+ }
+ }
+ },
+
+ getCode: function () {
+ return 'hgwsanhp';
+ },
+
+ getData: function () {
+ return {
+ 'method': this.item.method,
+ 'additional_data': {
+ 'hgw_birthdate': this.getBirthdate(),
+ 'hgw_salutation': this.hgwSalutation()
+ }
+ };
+ },
+
+ /**
+ * Returns true if validation succeeded
+ *
+ * @returns {*}
+ */
+ validate: function() {
+ var form = $('#hgw-santander-hire-purchase');
+
+ return form.validation() && form.validation('isValid');
+ }
+ });
+ }
+);
\ No newline at end of file
diff --git a/view/frontend/web/template/payment/heidelpay-directdebit-form.html b/view/frontend/web/template/payment/heidelpay-directdebit-form.html
index 6e4d0418de2..685f471e30a 100644
--- a/view/frontend/web/template/payment/heidelpay-directdebit-form.html
+++ b/view/frontend/web/template/payment/heidelpay-directdebit-form.html
@@ -1,7 +1,13 @@