I am developing a custom payment provider, but I have some problems populating $scope.dialogData.provider.extendedData.items, which means that I cannot save/get any custom settings.
I have been looking at the implementation of different payment providers (braintree, quickpay, sage), but as I am fairly new to angularjs, I find it difficult to wrap my head around.
angular.module("merchello.plugins.epay")
.controller("Merchello.Providers.Dialogs.EPayProviderSettingsController", ["$scope",
function ($scope) {
$scope.init = function () {
if ($scope.dialogData.provider.extendedData.items.length > 0) {
var settingsString = items[0].value;
$scope.epaySettings = JSON.parse(settingsString);
}
$scope.$watch(function () {
return $scope.epaySettings;
}, function (newValue, oldValue) {
$scope.dialogData.provider.extendedData.items[0].value = angular.toJson(newValue);
}, true);
};
$scope.init();
}
]);
In my controller I get an error when I try to access the first element of extendedData.items, which occurs when I click the 'edit' button on the providers page in the backoffice.
Can anybody tell me what I might be missing here, and how exactly is data transferred between my C# models/methods and angular modules?
I got the code working - I made a lot of changes at once, and kind of lost track of what exactly the crucial bit was. I think it was partly my providersettings model and some GatewayProvider attributes, but as Rusty mentioned, setValue() and getValue() was definitely a nice touch once the object had been populated with data.
Problems getting/saving custom paymentprovider settings
Hello,
I am developing a custom payment provider, but I have some problems populating
$scope.dialogData.provider.extendedData.items
, which means that I cannot save/get any custom settings.I have been looking at the implementation of different payment providers (braintree, quickpay, sage), but as I am fairly new to angularjs, I find it difficult to wrap my head around.
My two javascript files look like this:
payment.epay.module.js:
payment.epay.providersettings.controller.js:
In my controller I get an error when I try to access the first element of extendedData.items, which occurs when I click the 'edit' button on the providers page in the backoffice.
Can anybody tell me what I might be missing here, and how exactly is data transferred between my C# models/methods and angular modules?
Br Peter
Hey Peter
You should use the
setValue('myAlias', settingsJson)
andgetValue('myAlias')
instead of working with the JS array directlyHello again,
I got the code working - I made a lot of changes at once, and kind of lost track of what exactly the crucial bit was. I think it was partly my providersettings model and some GatewayProvider attributes, but as Rusty mentioned, setValue() and getValue() was definitely a nice touch once the object had been populated with data.
BR Peter
is working on a reply...