Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BarryFogarty/254ff2e61cca05f43411 to your computer and use it in GitHub Desktop.
Save BarryFogarty/254ff2e61cca05f43411 to your computer and use it in GitHub Desktop.
Merchello.Plugin.Payments.SagePay: ng-Controller for provider settings
angular.module('merchello.plugins.sagepay').controller('Merchello.Plugin.Payment.SagePayPaymentProviderController',
['$scope',
function ($scope) {
console.info($scope.dialogData);
if ($scope.dialogData.provider.extendedData.items.length > 0) {
var extendedDataKey = 'merchSagePayProviderSettings';
var settingsString = $scope.dialogData.provider.extendedData.getValue(extendedDataKey);
$scope.sagePayProviderSettings = angular.fromJson(settingsString);
console.info($scope.dialogData);
console.info($scope.sagePayProviderSettings);
// Watch with object equality to convert back to a string for the submit() call on the Save button
$scope.$watch(function () {
return $scope.sagePayProviderSettings;
}, function (newValue, oldValue) {
console.info(newValue);
$scope.dialogData.provider.extendedData.setValue(extendedDataKey, angular.toJson(newValue));
}, true);
}
}
]);
@rustyswayne
Copy link

What value is in the database before the dialog is opened?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment