@@ -335,9 +335,7 @@
'cvc'
];
var value = errorHtml[index];
- jQuery('.'+value).after(
- '
This field is required '
- );
+ jQuery('.'+value).after('
This field is required ');
jQuery('.'+value).focus();
}
diff --git a/view/frontend/templates/recurring/customer/subscription/edit.phtml b/view/frontend/templates/recurring/customer/subscription/edit.phtml
index 3acee44..d698a80 100644
--- a/view/frontend/templates/recurring/customer/subscription/edit.phtml
+++ b/view/frontend/templates/recurring/customer/subscription/edit.phtml
@@ -3,20 +3,66 @@
* Copyright © 2018 Worldpay, LLC. All rights reserved.
* See LICENSE.txt for license details.
*/
-
-
?>
+
+
\ No newline at end of file
diff --git a/view/frontend/templates/recurring/customer/subscription/index.phtml b/view/frontend/templates/recurring/customer/subscription/index.phtml
index b53c4dc..2895031 100644
--- a/view/frontend/templates/recurring/customer/subscription/index.phtml
+++ b/view/frontend/templates/recurring/customer/subscription/index.phtml
@@ -83,7 +83,7 @@
- = /* @noEscape */ $escaper->escapeHtml($subscription->getStatusLabel()) ?>
+ = /* @noEscape */ $escaper->escapeHtml($subscription->getStatusLabel()) ?>
getStatus() == 'active'): ?>
@@ -95,6 +95,15 @@
class="action delete">= /* @noEscape */ $block->getMyAccountLabels('AC23') ?>
+ getSubscriptionId();
+ $nextOrder = $block->getNextRecurringOrder($subscriptionId);
+ if (!empty($nextOrder)) { ?>
+
+ = /* @noEscape */ __('Upcoming Delivery') ?>
+ = /* @noEscape */ $nextOrder->getRecurringDate() ?>
+
+
diff --git a/view/frontend/templates/recurring/edit/order_address_info.phtml b/view/frontend/templates/recurring/edit/order_address_info.phtml
new file mode 100644
index 0000000..8129c84
--- /dev/null
+++ b/view/frontend/templates/recurring/edit/order_address_info.phtml
@@ -0,0 +1,53 @@
+
+getAddressOptions() ?>
+
+
+
+
= $escaper->escapeHtml(__('Shipping Address')) ?>:
+
+ $option): ?>
+
+ = $escaper->escapeHtml(__($option['label'])); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/view/frontend/templates/recurring/edit/order_info.phtml b/view/frontend/templates/recurring/edit/order_info.phtml
new file mode 100644
index 0000000..fc2b215
--- /dev/null
+++ b/view/frontend/templates/recurring/edit/order_info.phtml
@@ -0,0 +1,83 @@
+
+
+getCurrentSubscriptionOrder() ?>
+
+
+
+ = $escaper->escapeHtml(__('Subscription Addresses')) ?>
+
+
+
+
+ = $escaper->escapeHtml(__('Billing Address')) ?>
+
+
+
+ = /* @noEscape */ $block->getFormattedAddress($_order->getBillingAddress()) ?>
+
+
+
+ getIsVirtual()): ?>
+
+
+
+ getIsVirtual()): ?>
+
+ = $escaper->escapeHtml(__('Shipping Method')) ?>
+
+
+ getShippingDescription()): ?>
+ = $escaper->escapeHtml($_order->getShippingDescription()) ?>
+
+ = $escaper->escapeHtml(__('No shipping information available')) ?>
+
+
+
+
+ = $escaper->escapeHtml(__('Payment Method')) ?>
+
+
+ getTransactionData($_order); ?>
+
= $escaper->escapeHtml(__($transactionData->getCardNumber())) ?> -
+ = $escaper->escapeHtml(__($transactionData->getCardBrand())); ?>
+
+ = $escaper->escapeHtml(__('Change Payment Method')) ?>
+
+
+
+= $block->getChildHtml('recurring_additional_info') ?>
+
+
\ No newline at end of file
diff --git a/view/frontend/templates/recurring/edit/tokens.phtml b/view/frontend/templates/recurring/edit/tokens.phtml
new file mode 100644
index 0000000..6f939dc
--- /dev/null
+++ b/view/frontend/templates/recurring/edit/tokens.phtml
@@ -0,0 +1,17 @@
+
+
+
+
= $escaper->escapeHtml(__('Your Saved Card')) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/view/frontend/templates/recurring/order/skiporders.phtml b/view/frontend/templates/recurring/order/skiporders.phtml
new file mode 100644
index 0000000..bb2fff4
--- /dev/null
+++ b/view/frontend/templates/recurring/order/skiporders.phtml
@@ -0,0 +1,135 @@
+
+getskipSubscriptionOrderCollection(); ?>
+
+
+
+
+
+
+
+ = /* @noEscape */ $escaper->escapeHtml('View:') ?>
+
+
+
+
+
+
+
+
+
+
+ = /* @noEscape */ $escaper->escapeHtml(count($orderData) .' Order placed in') ?>
+
+
+
+
+ checkSelectedFilter('m-6')): ?>
+ = /* @noEscape */ $escaper->escapeHtml('selected') ?>
+ >
+ = /* @noEscape */ $escaper->escapeHtml('6 Month') ?>
+
+ "
+ checkSelectedFilter('y-'.date("Y"))): ?>
+ = /* @noEscape */ $escaper->escapeHtml('selected') ?>
+ >
+ = /* @noEscape */ $escaper->escapeHtml(date("Y")) ?>
+
+
+
+
+
+
+
+ = /* @noEscape */ $escaper->escapeHtml(__('Subscriptions')) ?>
+
+
+
+ = /* @noEscape */ $escaper->escapeHtml(__('Order Id#')) ?>
+
+
+ = /* @noEscape */ $escaper->escapeHtml(__('Subscription Item')) ?>
+
+
+ = /* @noEscape */ $escaper->escapeHtml(__('Plan')) ?>
+
+
+ = /* @noEscape */ $escaper->escapeHtml($block->getMyAccountLabels('AC20')) ?>
+
+
+ = /* @noEscape */ $escaper->escapeHtml(__('Sheduled At')) ?>
+
+
+ = /* @noEscape */ $escaper->escapeHtml($block->getMyAccountLabels('AC21')) ?>
+
+
+
+
+
+
+
+ = /* @noEscape */ $escaper->escapeHtml(__('N/A')) ?>
+
+ = /* @noEscape */ $escaper->escapeHtml($subscription->getProductName()) ?>
+
+
+ = /* @noEscape */ $escaper->escapeHtml(
+ $block->getSubscriptionIntervalLabel($subscription->getInterval())
+ ) ?>
+
+
+ = /* @noEscape */ $escaper->escapeHtml(__('Skipped')) ?>
+
+
+ = /* @noEscape */ $block->formatDate(
+ $subscription->getData('old_recurring_date'),
+ \IntlDateFormatter::SHORT,
+ false,
+ date_default_timezone_get()
+ ); ?>
+
+
+
+
+
+
+
+
+ getPaginationHtml()): ?>
+
+ = /* @noEscape */ $paginationHtml; ?>
+
+
+
+
+ = $escaper->escapeHtml(__('You have not any reccurring order yet.')); ?>
+
+
+
\ No newline at end of file
diff --git a/view/frontend/templates/recurring/order/view.phtml b/view/frontend/templates/recurring/order/view.phtml
new file mode 100644
index 0000000..e4ae6e6
--- /dev/null
+++ b/view/frontend/templates/recurring/order/view.phtml
@@ -0,0 +1,185 @@
+
+getsubscriptionOrderCollection(); ?>
+
+
+
+
+
+
+
+ = /* @noEscape */ $escaper->escapeHtml('View:') ?>
+
+
+
+
+
+
+
+
+
+
+ = /* @noEscape */ $escaper->escapeHtml(count($orderData) .' Order placed in') ?>
+
+
+
+
+ checkSelectedFilter('m-6')): ?>
+ = /* @noEscape */ $escaper->escapeHtml('selected') ?>
+ >
+ = /* @noEscape */ $escaper->escapeHtml('6 Month') ?>
+
+ "
+ checkSelectedFilter('y-'.date("Y"))): ?>
+ = /* @noEscape */ $escaper->escapeHtml('selected') ?>
+ >
+ = /* @noEscape */ $escaper->escapeHtml(date("Y")) ?>
+
+
+
+
+
+
+
+ = /* @noEscape */ $escaper->escapeHtml(__('Subscriptions')) ?>
+
+
+
+ = /* @noEscape */ $escaper->escapeHtml(__('Order Id#')) ?>
+
+
+ = /* @noEscape */ $escaper->escapeHtml(__('Subscription Item')) ?>
+
+
+ = /* @noEscape */ $escaper->escapeHtml(__('Plan')) ?>
+
+
+ = /* @noEscape */ $escaper->escapeHtml($block->getMyAccountLabels('AC20')) ?>
+
+
+ = /* @noEscape */ $escaper->escapeHtml(__('Sheduled At')) ?>
+
+
+ = /* @noEscape */ $escaper->escapeHtml($block->getMyAccountLabels('AC21')) ?>
+
+
+
+
+
+
+
+ = /* @noEscape */ $block->getOrderIdLabel($subscription) ?>
+
+ = /* @noEscape */ $escaper->escapeHtml($subscription->getProductName()) ?>
+
+
+ = /* @noEscape */ $escaper->escapeHtml(
+ $block->getSubscriptionIntervalLabel($subscription->getInterval())
+ ) ?>
+ = /* @noEscape */ $subscription->getFormattedIntervalAmount() ?>
+
+
+ getNotAlreadyCanceled($subscription)): ?>
+ = /* @noEscape */ $escaper->escapeHtml(__('Cancelled')) ?>
+
+ = /* @noEscape */ $escaper->escapeHtml($subscription->getStatus()) ?>
+
+
+
+ = /* @noEscape */ $block->formatDate(
+ $subscription->getCreatedAt(),
+ \IntlDateFormatter::SHORT,
+ false,
+ date_default_timezone_get()
+ ); ?>
+
+
+ getNotAlreadyCanceled($subscription)): ?>
+
+ = /* @noEscape */ $escaper->escapeHtml(__('View')) ?>
+
+ checkOrderShipment($subscription) &&
+ $block->checkOrderBufferTime($subscription)): ?>
+
+ = /* @noEscape */ $block->getMyAccountLabels('AC23') ?>
+
+
+
+
+
+
+
+
+
+ getPaginationHtml()): ?>
+
+ = /* @noEscape */ $paginationHtml; ?>
+
+
+
+
+ = $escaper->escapeHtml(__('You have not any reccurring order yet.')); ?>
+
+
+
\ No newline at end of file
diff --git a/view/frontend/templates/webpayment.phtml b/view/frontend/templates/webpayment.phtml
index 4a0a894..7ea6cd9 100644
--- a/view/frontend/templates/webpayment.phtml
+++ b/view/frontend/templates/webpayment.phtml
@@ -555,12 +555,26 @@ $cusToken = 'Bearer ' . $block->getCustomerToken();
let expiryMonth = instrumentResponse.details.expiryMonth;
let expiryYear = instrumentResponse.details.expiryYear;
let encyptedCseData = cseData.length>0 ? cseData : null;
-
- //Add payment information and place the order
- var paymentDetails = {
- "paymentMethod": {
- "method": "worldpay_cc",
- "additional_data": {
+ var additionalData = "";
+ if(encyptedCseData){
+ additionalData = {
+ "cc_cid" : "",
+ "cc_type" : "",
+ "cc_exp_year" : "",
+ "cc_exp_month" : "",
+ "cc_number" : "",
+ "cc_name" : "",
+ "save_my_card" : false,
+ "cse_enabled" : isClientSideEncryptionEnabled(),
+ "encryptedData" : encyptedCseData,
+ "tokenCode" : null,
+ "isSavedCardPayment" : false,
+ "isChromePay" : "1",
+ "dfReferenceId": window.sessionId
+ }
+
+ }else{
+ additionalData = {
"cc_cid" : cvc,
"cc_type" : cardType,
"cc_exp_year" : expiryYear,
@@ -575,6 +589,16 @@ $cusToken = 'Bearer ' . $block->getCustomerToken();
"isChromePay" : "1",
"dfReferenceId": window.sessionId
}
+
+ }
+
+
+
+ //Add payment information and place the order
+ var paymentDetails = {
+ "paymentMethod": {
+ "method": "worldpay_cc",
+ "additional_data": additionalData
},
"billing_address": {
"email": instrumentResponse.payerEmail,
diff --git a/view/frontend/web/css/wp-myaccount.css b/view/frontend/web/css/wp-myaccount.css
new file mode 100644
index 0000000..786e642
--- /dev/null
+++ b/view/frontend/web/css/wp-myaccount.css
@@ -0,0 +1,191 @@
+.wp-right {
+ text-align: right !important;
+}
+.wp-error{
+ color: #e02b27;
+ font-size: 1.2rem;
+}
+.mb-20{
+ margin-bottom: 20px;
+}
+.mb-30{
+ margin-bottom: 30px;
+}
+.worldpay-savedcard-addnewcard .form-edit-account #dialog{
+ display: none;
+}
+.worldpay-savedcard-addnewcard .form-edit-account #cvv{
+ width:12%;
+}
+
+.worldpay-recurring-edit .box-order-billing-address .box-content{
+ padding-left: 10px;
+}
+.worldpay-recurring-edit .box-order-shipping-address .box-title{
+ margin-left: 30px!important;
+}
+.worldpay-recurring-edit .box-order-shipping-address .box-content{
+ padding-left: 40px;
+ border-left: 1.5px solid #808080a3;
+}
+.worldpay-recurring-edit .field.product-name,
+.worldpay-recurring-edit .field.plan{
+ width: 25%;
+ float: left;
+ clear: none;
+}
+.worldpay-recurring-edit .field.plan{
+ border-left: 1.5px solid #808080a3;
+ padding-left: 30px;
+}
+.worldpay-recurring-edit .payment-method p,
+.worldpay-recurring-edit .payment-method span{
+ float: left;
+ padding-right: 40px;
+}
+@media only screen and (max-width: 768px){
+ .worldpay-recurring-edit .account .column.main .block:not(.widget) .block-content .box:last-child {
+ margin-bottom: 30px;
+ }
+ .worldpay-recurring-edit .box-order-shipping-address .box-title{
+ margin-left: 0px!important;
+ }
+ .worldpay-recurring-edit .box-order-shipping-address .box-content{
+ padding-left: 10px;
+ border-left: none;
+ margin-bottom: 20px;
+ }
+ .worldpay-recurring-edit .field.plan{
+ border-left: none;
+ padding-left: 0px;
+ }
+ .worldpay-recurring-edit .field.product-name,
+ .worldpay-recurring-edit .field.plan{
+ width: 100%;
+ float: none;
+ clear: none;
+ }
+ .worldpay-recurring-edit .payment-method span{
+ padding-bottom: 30px;
+ }
+ .worldpay-recurring-edit .modal-popup.modal-slide {
+ left: 25px;
+ right: 25px;
+ }
+ .worldpay-recurring-edit .all-recurring-order-mobile{
+ display: block;
+ margin: 10px 0;
+ }
+ .worldpay-recurring-edit .all-recurring-order-desktop{
+ display: none;
+ }
+ .worldpay-recurring-edit .upcoming-delivery.desktop{
+ display: none;
+ }
+ .modal-popup .modal-footer .add-new-btn {
+ float: right;
+ }
+}
+.worldpay-recurring-edit .skip-next-order a.action.primary{
+ float: none;
+}
+.worldpay-recurring-edit .skip-next-order strong{
+ color: #eb5202;
+}
+@media only screen and (min-width: 768px){
+ .worldpay-recurring-edit .actions-toolbar{
+ text-align: right;
+ }
+ .worldpay-recurring-edit h1.page-title{
+ margin-bottom: 15px;
+ }
+ .worldpay-recurring-edit .skip-next-order{
+ margin-top: -50px;
+ }
+ .worldpay-recurring-edit .upcoming-delivery{
+ float: right;
+ margin-top: 6px;
+ font-size: 11px!important;
+ }
+ .worldpay-recurring-edit .upcoming-delivery.mobile{
+ display: none;
+ }
+
+ .worldpay-recurring-edit .all-recurring-order-mobile{
+ display: none;
+ }
+ .worldpay-recurring-edit .all-recurring-order-desktop{
+ display: block;
+ float: right;
+ margin-top: 6px;
+ }
+ .modal-popup .modal-footer .add-new-btn {
+ float: left;
+ }
+}
+.worldpay-recurring-edit .change-shipping-address-modal .shipping-modal-body-content label,
+.worldpay-recurring-edit .change-shipping-address-modal .shipping-information-title span,
+.worldpay-recurring-edit .change-payment-method-modal .payment-modal-body-content .label{
+ font-weight: 600;
+}
+.worldpay-recurring-edit .change-shipping-address-modal #ship-address-dropdown,
+.worldpay-recurring-edit .change-shipping-address-modal .shipping-information-content{
+ margin-top: 8px;
+}
+.worldpay-recurring-edit .change-shipping-address-modal .successmsg,
+.worldpay-recurring-edit .change-payment-method-modal .successmsg{
+ color: #006400;;
+}
+.worldpay-recurring-edit .modal-popup .action-close{
+ display: none;
+}
+.worldpay-recurring-edit .modal-popup .modal-footer{
+ padding-bottom: 2rem;
+ padding-top: 2rem;
+}
+.worldpay-recurring-edit .modal-popup .modal-header h1{
+ color: #333;
+ font-weight: bold;
+ font-size:1em;
+ margin-top:-10px;
+}
+.worldpay-recurring-edit .modal-popup.modal-slide .modal-inner-wrap {
+ margin: 10rem auto;
+ height: auto!important;
+}
+.worldpay-recurring-edit .change-payment-method-modal .modal-content {
+ max-height: 35vh;
+ overflow: auto;
+}
+.worldpay-recurring-edit .change-payment-method-modal .paymentmethods-radio-wrapper{
+ margin: 10px 0;
+}
+.worldpay-recurring-edit .change-payment-method-modal .paymentmethods-radio-wrapper span.expired {
+ color: red;
+}
+.worldpay-recurring-edit #change-shipping-address,
+.worldpay-recurring-edit #change-payment-method {
+ cursor: pointer;
+}
+#change_shipping_modal .error,
+#change_payment_modal .error{
+ color:#ed0b02;
+}
+#change_shipping_modal .success,
+#change_payment_modal .success{
+ color: #008000;
+}
+.upcoming-delivery{
+ background: #eb5202;
+ color: white;
+ border-radius: 5px;
+ font-size: 9px;
+ padding: 2px 5px;
+ width: fit-content;
+ animation: blinker 2s linear infinite;
+}
+@keyframes blinker {
+ 50% {
+ opacity: 0;
+ }
+}
\ No newline at end of file
diff --git a/view/frontend/web/images/samsungpay/pay-card-dark.png b/view/frontend/web/images/samsungpay/pay-card-dark.png
new file mode 100644
index 0000000..e66f9da
Binary files /dev/null and b/view/frontend/web/images/samsungpay/pay-card-dark.png differ
diff --git a/view/frontend/web/images/samsungpay/pay-card-ver-dark.png b/view/frontend/web/images/samsungpay/pay-card-ver-dark.png
new file mode 100644
index 0000000..a8d4ddf
Binary files /dev/null and b/view/frontend/web/images/samsungpay/pay-card-ver-dark.png differ
diff --git a/view/frontend/web/images/samsungpay/pay-card-ver.png b/view/frontend/web/images/samsungpay/pay-card-ver.png
new file mode 100644
index 0000000..744a818
Binary files /dev/null and b/view/frontend/web/images/samsungpay/pay-card-ver.png differ
diff --git a/view/frontend/web/images/samsungpay/pay-card.png b/view/frontend/web/images/samsungpay/pay-card.png
new file mode 100644
index 0000000..78ef943
Binary files /dev/null and b/view/frontend/web/images/samsungpay/pay-card.png differ
diff --git a/view/frontend/web/js/subscription.js b/view/frontend/web/js/subscription.js
new file mode 100644
index 0000000..a2c644b
--- /dev/null
+++ b/view/frontend/web/js/subscription.js
@@ -0,0 +1,303 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+define([
+ 'uiComponent',
+ 'underscore',
+ 'jquery',
+ 'Magento_Ui/js/modal/modal',
+ 'ko',
+ 'mage/storage',
+ 'Magento_Catalog/js/price-utils'
+], function (Component,_, $,modal,ko,storage,priceUtils) {
+ 'use strict';
+
+ return Component.extend({
+ pm_element: '',
+ sp_element: '',
+ sp_popelement: '',
+ pm_popelement: '',
+ isLoadingShippingMethod : ko.observable(false),
+ availableShippingMethods : ko.observableArray([]),
+ allAvailableShippingMethods : ko.observableArray([]),
+ availableTokens: ko.observableArray([]),
+ successmsg: ko.observable(),
+ msgColor: ko.observable('success'),
+ popupOptions: {
+ type: 'popup',
+ responsive: true,
+ clickableOverlay: false,
+ buttons: []
+ },
+ priceFormat :{
+ decimalSymbol: ".",
+ groupLength: 3,
+ groupSymbol: ",",
+ integerRequired: false,
+ pattern: "$%s",
+ precision: 2,
+ requiredPrecision: 2
+ },
+ shipmentApiUrl: 'rest/default/V1/worldpay/mine/estimate-recurring-shipping-methods',
+ shipmentUpdateApiUrl: 'rest/default/V1/worldpay/mine/update-recurring-shipment',
+ paymentTokenApiUrl: 'rest/default/V1/worldpay/mine/get-customer-payment-tokens',
+ updatePaymentTokenApiUrl: 'rest/default/V1/worldpay/mine/update-recurring-payment-token',
+ initialize: function () {
+ this._super();
+ this.pm_element = $(this.pm_elementId);
+ this.sp_element = $(this.sp_elementId);
+ this.sp_popelement = $(this.sp_popelement);
+ this.pm_popelement = $(this.pm_popelement);
+
+ },
+ closeModalPopup: function(){
+ var self = this;
+ self.sp_popelement.modal("closeModal");
+ window.location.reload();
+ },
+ closePaymentModalPopup: function(){
+ var self = this;
+ self.pm_popelement.modal("closeModal");
+ window.location.reload();
+ },
+ openShippingPopup: function(){
+ var self=this;
+ var popupdetails = self.popupOptions;
+ popupdetails.title = $.mage.__('Change Shipping Address');
+ popupdetails.modalClass = 'change-shipping-address-modal confirm';
+ popupdetails.buttons = [ {
+ text: $.mage.__('Add New Address'),
+ class: 'action-primary add-new-btn',
+ click: function (event) {
+ window.location.href = '/customer/address/new/';
+ }
+ },{
+ text: $.mage.__('Save'),
+ class: 'action-primary',
+ click: function (event) {
+ self.updateShipment();
+ }
+ },{
+ text: $.mage.__('Close'),
+ class: 'action-secondary',
+ click: function (event) {
+ self.closeModalPopup();
+ }
+ }];
+ self.sp_popelement.modal(popupdetails).modal('openModal').on('modalclosed',function(){
+ window.location.reload();
+ });
+ $("#ship-address-dropdown").trigger('change');
+ },
+ getCartLabel: function(item){
+ var self = this;
+ var expiryCard = item.card_expiry_month+"/"+item.card_expiry_year;
+ return item.card_number+", "+expiryCard;
+ },
+ getCartLabelMessage: function(item){
+ var self = this;
+ var expiredMsg = '';
+
+ const currentDate = new Date();
+ const currentYear = currentDate.getFullYear();
+ const currentMonth = currentDate.getMonth() + 1; // January is 0, so we add 1
+
+ // Convert expiryDate and expiryYear to a Date object
+ const expiry = new Date(`${item.card_expiry_year}-${item.card_expiry_month}-01`);
+
+ if (expiry < currentDate) {
+ expiredMsg = $.mage.__('Expired');
+ } else if (expiry.getFullYear() === currentYear && expiry.getMonth() + 1 === currentMonth) {
+ expiredMsg = $.mage.__('Expiring this month');
+ }
+ return expiredMsg;
+ },
+ updatePaymentToken: function(){
+ var self = this;
+ var selectedToken = $('input[name="available_recurring_tokens"]:checked').val();
+ if(typeof selectedToken == 'undefined'){
+ self.successmsg('Please select any card');
+ self.msgColor('error');
+ return false;
+ }
+ var obj ={
+ 'tokenId': selectedToken,
+ 'subscriptionId': self.current_subscription_id
+ };
+ $("body").trigger('processStart');
+ self.successmsg("");
+ storage.post(
+ self.updatePaymentTokenApiUrl,
+ JSON.stringify(obj)
+ ).done(
+ function (response) {
+ if(response.length){
+ response = JSON.parse(response);
+ self.successmsg(response.msg);
+ self.msgColor('success');
+ }
+ $("body").trigger('processStop');
+ }
+ ).fail(
+ function (response) {
+ console.log('Fail',response);
+ $("body").trigger('processStop');
+ }
+ );
+ },
+ openPaymentPopup: function(){
+ var self=this;
+ var popupdetails = self.popupOptions;
+ popupdetails.title = $.mage.__('Change Payment Method');
+ popupdetails.modalClass = 'change-payment-method-modal confirm';
+ popupdetails.buttons = [ {
+ text: $.mage.__('Add New Card'),
+ class: 'action-primary add-new-btn',
+ click: function (event) {
+ window.location.href = '/worldpay/savedcard/addnewcard/';
+ }
+ },{
+ text: $.mage.__('Save'),
+ class: 'action-primary',
+ click: function (event) {
+ self.updatePaymentToken();
+ }
+ },{
+ text: $.mage.__('Close'),
+ class: 'action-secondary',
+ click: function (event) {
+ self.closePaymentModalPopup();
+ }
+ }];
+ self.pm_popelement.modal(popupdetails).modal('openModal').on('modalclosed',function(){
+ window.location.reload();
+ });
+ var obj = {
+ }
+ $("body").trigger('processStart');
+ storage.post(
+ self.paymentTokenApiUrl,
+ JSON.stringify(obj)
+ ).done(
+ function (response) {
+ response = JSON.parse(response);
+ var paymentMethodList = [];
+ if(response.tokens){
+ _.each(response.tokens,function(value){
+ paymentMethodList.push({
+ "token_id": value.token_id,
+ "token_code": value.token_code,
+ "cardholder_name": value.cardholder_name,
+ "card_number": value.card_number,
+ "card_expiry_month": value.card_expiry_month,
+ "card_expiry_year": value.card_expiry_year
+ });
+ });
+ self.availableTokens(paymentMethodList);
+
+ }
+ $("body").trigger('processStop');
+ }
+ ).fail(
+ function (response) {
+ $("body").trigger('processStop');
+ }
+ );
+
+ },
+ getShippingMethodObj: function(selectedMethod){
+ var self = this;
+ var shipObj = "";
+ _.each(self.allAvailableShippingMethods(),function(value){
+ var identifier = value.carrier+'_'+value.method;
+ if(identifier == selectedMethod){
+ shipObj = value;
+ }
+ });
+ return shipObj;
+ },
+ updateShipment: function(){
+ var self=this;
+ var addressId = $('#ship-address-dropdown').val();
+ var orderIncrementId = self.order_incrementId;
+ var selectedShippingMethod = $('input[name="shipping_method_recurring"]:checked').val();
+ if(typeof selectedShippingMethod == 'undefined'){
+ self.successmsg('Please select shipping method');
+ self.msgColor('error');
+ return false;
+ }
+ var shippingMethodObj = self.getShippingMethodObj(selectedShippingMethod);
+ var obj = {
+ shipmentData: {
+ 'orderIncrementId': orderIncrementId,
+ 'addressId': addressId,
+ 'shipping_method': shippingMethodObj,
+ 'subscription_id': self.current_subscription_id
+ }
+ }
+ $(".ship-via").trigger('processStart');
+ storage.post(
+ self.shipmentUpdateApiUrl,
+ JSON.stringify(obj)
+ ).done(
+ function (response) {
+ if(response.length){
+ response = JSON.parse(response);
+ self.successmsg(response.msg);
+ self.msgColor('success');
+ }
+ $(".ship-via").trigger('processStop');
+ }
+ ).fail(
+ function (response) {
+ $(".ship-via").trigger('processStop');
+ }
+ );
+
+ },
+ fetchShippingMethodByAddress: function(){
+ var self=this;
+ var addressId = $('#ship-address-dropdown').val();
+ var orderIncrementId = self.order_incrementId;
+ var obj = {
+ 'orderIncrementId': orderIncrementId,
+ 'addressId': addressId
+ }
+ $(".ship-via").trigger('processStart');
+ $('.shipping-information-content').hide();
+ storage.post(
+ self.shipmentApiUrl,
+ JSON.stringify(obj)
+ ).done(
+ function (response) {
+ response = JSON.parse(response);
+ var shippingMethodList = [];
+ if(response.length){
+ self.allAvailableShippingMethods(response);
+ _.each(response,function(value){
+ var titledesc = priceUtils.formatPrice(value.cost, self.priceFormat)+' '+value.carrier_title+' - '+ value.method_title;
+ shippingMethodList.push({
+ "identifier": value.carrier+'_'+value.method,
+ "label": titledesc,
+ "detail": value.method_title,
+ "amount": value.cost
+ });
+ });
+
+ self.availableShippingMethods(shippingMethodList);
+ $('.shipping-information-content').show();
+ }
+ $(".ship-via").trigger('processStop');
+ }
+ ).fail(
+ function (response) {
+ console.log('Fail',response);
+ $(".ship-via").trigger('processStop');
+ $('.shipping-information-content').show();
+ }
+ );
+ }
+ });
+});
\ No newline at end of file
diff --git a/view/frontend/web/js/view/payment/method-renderer/cc-method.js b/view/frontend/web/js/view/payment/method-renderer/cc-method.js
index f6e32e4..43686cf 100644
--- a/view/frontend/web/js/view/payment/method-renderer/cc-method.js
+++ b/view/frontend/web/js/view/payment/method-renderer/cc-method.js
@@ -943,35 +943,71 @@ define(
selectedCardType = this.selectedPayType();
}
- return {
- 'method': "worldpay_cc",
- 'additional_data': {
- 'cc_cid': this.creditCardVerificationNumber(),
- 'cc_type': selectedCardType,
- 'cc_exp_year': this.creditCardExpYear(),
- 'cc_exp_month': this.creditCardExpMonth(),
- 'cc_number': this.creditCardNumber(),
- 'cc_name': $('#' + this.getCode() + '_cc_name').val(),
- 'save_my_card': this.saveMyCard,
- 'cse_enabled': this.isClientSideEncryptionEnabled(),
- 'encryptedData': this.cseData,
- 'tokenCode': this.paymentToken,
- 'saved_cc_cid': $('.saved-cvv-number').val(),
- 'isSavedCardPayment': this.isSavedCardPayment,
- 'tokenization_enabled': this.isTokenizationEnabled(),
- 'stored_credentials_enabled': this.isStoredCredentialsEnabled(),
- 'dfReferenceId': window.sessionId,
- 'disclaimerFlag': this.disclaimerFlag,
- 'subscriptionStatus': this.isSubscribed(),
- 'cpf_enabled': this.isCPFEnabled(),
- 'instalment_enabled': this.isInstalmentEnabled(),
- 'cpf': $('#' + this.getCode() + '_cpf').val(),
- 'instalment': $('#' + this.getCode() + '_instalment').val(),
- 'statement': this.statement,
- 'shippingfee': this.getShippingFeeForBrazil(),
- 'multishipping': this.multishipping
- }
- };
+
+ if(this.isClientSideEncryptionEnabled()){
+ return {
+ 'method': "worldpay_cc",
+ 'additional_data': {
+ 'cc_cid': this.creditCardVerificationNumber(),
+ 'cc_type': selectedCardType,
+ 'cc_exp_year': '',
+ 'cc_exp_month': '',
+ 'cc_number': '',
+ 'cc_name': $('#' + this.getCode() + '_cc_name').val(),
+ 'save_my_card': this.saveMyCard,
+ 'cse_enabled': this.isClientSideEncryptionEnabled(),
+ 'encryptedData': this.cseData,
+ 'tokenCode': this.paymentToken,
+ 'saved_cc_cid': $('.saved-cvv-number').val(),
+ 'isSavedCardPayment': this.isSavedCardPayment,
+ 'tokenization_enabled': this.isTokenizationEnabled(),
+ 'stored_credentials_enabled': this.isStoredCredentialsEnabled(),
+ 'dfReferenceId': window.sessionId,
+ 'disclaimerFlag': this.disclaimerFlag,
+ 'subscriptionStatus': this.isSubscribed(),
+ 'cpf_enabled': this.isCPFEnabled(),
+ 'instalment_enabled': this.isInstalmentEnabled(),
+ 'cpf': $('#' + this.getCode() + '_cpf').val(),
+ 'instalment': $('#' + this.getCode() + '_instalment').val(),
+ 'statement': this.statement,
+ 'shippingfee': this.getShippingFeeForBrazil(),
+ 'multishipping': this.multishipping
+ }
+ };
+
+ }else{
+ return {
+ 'method': "worldpay_cc",
+ 'additional_data': {
+ 'cc_cid': this.creditCardVerificationNumber(),
+ 'cc_type': selectedCardType,
+ 'cc_exp_year': this.creditCardExpYear(),
+ 'cc_exp_month': this.creditCardExpMonth(),
+ 'cc_number': this.creditCardNumber(),
+ 'cc_name': $('#' + this.getCode() + '_cc_name').val(),
+ 'save_my_card': this.saveMyCard,
+ 'cse_enabled': this.isClientSideEncryptionEnabled(),
+ 'encryptedData': this.cseData,
+ 'tokenCode': this.paymentToken,
+ 'saved_cc_cid': $('.saved-cvv-number').val(),
+ 'isSavedCardPayment': this.isSavedCardPayment,
+ 'tokenization_enabled': this.isTokenizationEnabled(),
+ 'stored_credentials_enabled': this.isStoredCredentialsEnabled(),
+ 'dfReferenceId': window.sessionId,
+ 'disclaimerFlag': this.disclaimerFlag,
+ 'subscriptionStatus': this.isSubscribed(),
+ 'cpf_enabled': this.isCPFEnabled(),
+ 'instalment_enabled': this.isInstalmentEnabled(),
+ 'cpf': $('#' + this.getCode() + '_cpf').val(),
+ 'instalment': $('#' + this.getCode() + '_instalment').val(),
+ 'statement': this.statement,
+ 'shippingfee': this.getShippingFeeForBrazil(),
+ 'multishipping': this.multishipping
+ }
+ };
+ }
+
+
},
isClientSideEncryptionEnabled:function(){
if (this.getCsePublicKey()) {
diff --git a/view/frontend/web/js/view/payment/samsungpay-checkout.js b/view/frontend/web/js/view/payment/samsungpay-checkout.js
index 8518035..cc358a6 100644
--- a/view/frontend/web/js/view/payment/samsungpay-checkout.js
+++ b/view/frontend/web/js/view/payment/samsungpay-checkout.js
@@ -102,6 +102,13 @@ return Component.extend({
}
}
return true;
+ },
+ samsungPayButton: function(){
+ var paybuttonPath = window.checkoutConfig.payment.ccform.samsungPayButton;
+ if(!paybuttonPath){
+ paybuttonPath = 'pay-card';
+ }
+ return require.toUrl('Sapient_Worldpay/images/samsungpay/'+paybuttonPath+'.png');
}
});
});
diff --git a/view/frontend/web/template/payment/wallets/samsungpay-checkout.html b/view/frontend/web/template/payment/wallets/samsungpay-checkout.html
index b15eb17..ca3d833 100644
--- a/view/frontend/web/template/payment/wallets/samsungpay-checkout.html
+++ b/view/frontend/web/template/payment/wallets/samsungpay-checkout.html
@@ -1,13 +1,15 @@
-
+
\ No newline at end of file