Skip to content

Commit 01d2e96

Browse files
committed
emerchantpay V10 migration
1 parent ab0f2a6 commit 01d2e96

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+558
-437
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
function CurrencyController($scope, umbracoFormsIntegrationsCommerceEMerchantPayResource) {
1+
function CurrencyController($scope, umbracoFormsIntegrationsCommerceEmerchantpayResource) {
22

33
var vm = this;
44

55
if ($scope.setting && $scope.setting.value) vm.selectedCurrency = $scope.setting.value;
66

7-
umbracoFormsIntegrationsCommerceEMerchantPayResource.getCurrencies().then(function (response) {
7+
umbracoFormsIntegrationsCommerceEmerchantpayResource.getCurrencies().then(function (response) {
88
vm.currencies = response;
99
});
1010

@@ -14,4 +14,4 @@
1414
}
1515

1616
angular.module("umbraco")
17-
.controller("UmbracoForms.Integrations.Commerce.eMerchantPay.CurrencyController", CurrencyController);
17+
.controller("UmbracoForms.Integrations.Commerce.emerchantpay.CurrencyController", CurrencyController);

src/Umbraco.Forms.Integrations.Commerce.EMerchantPay/App_Plugins/UmbracoForms.Integrations/Commerce/eMerchantPay/currency.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div ng-controller="UmbracoForms.Integrations.Commerce.eMerchantPay.CurrencyController as vm">
1+
<div ng-controller="UmbracoForms.Integrations.Commerce.emerchantpay.CurrencyController as vm">
22

33
<div>
44
<select ng-model="vm.selectedCurrency" ng-click="vm.saveCurrency()">

src/Umbraco.Forms.Integrations.Commerce.EMerchantPay/App_Plugins/UmbracoForms.Integrations/Commerce/eMerchantPay/customer-details-mapper.controller.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function CustomerDetailsMapperController($scope, notificationsService, emerchantpayService) {
1+
function CustomerDetailsMapperController($scope, notificationsService, emerchantpayService, umbracoFormsIntegrationsCommerceEmerchantpayResource) {
22

33
var vm = this;
44

@@ -31,10 +31,29 @@
3131

3232

3333
function init() {
34-
vm.customerProperties = ["Email", "FirstName", "LastName", "Phone", "Address", "ZipCode", "City", "State", "Country"];
34+
35+
umbracoFormsIntegrationsCommerceEmerchantpayResource.isAccountAvailable().then(function (response) {
36+
if (response === "UNAVAILABLE") {
37+
notificationsService.add({
38+
headline: "emerchantpay",
39+
message: "Account details are missing. Please create an account before continuing",
40+
type: "error",
41+
sticky: true,
42+
url: "https://www.emerchantpay.com/"
43+
});
44+
}
45+
});
46+
47+
umbracoFormsIntegrationsCommerceEmerchantpayResource.getAvailableMappingFields().then(function (response) {
48+
vm.customerProperties = response;
49+
});
3550

3651
vm.fields = [];
3752

53+
umbracoFormsIntegrationsCommerceEmerchantpayResource.getRequiredMappingFields().then(function (response) {
54+
vm.requiredFields = response.join();
55+
});
56+
3857
emerchantpayService.getFormFields(function (response) {
3958
vm.fields = response;
4059
});
@@ -49,4 +68,4 @@
4968
}
5069

5170
angular.module("umbraco")
52-
.controller("UmbracoForms.Integrations.Commerce.eMerchantPay.CustomerDetailsMapperController", CustomerDetailsMapperController);
71+
.controller("UmbracoForms.Integrations.Commerce.emerchantpay.CustomerDetailsMapperController", CustomerDetailsMapperController);

src/Umbraco.Forms.Integrations.Commerce.EMerchantPay/App_Plugins/UmbracoForms.Integrations/Commerce/eMerchantPay/customer-details-mapper.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div ng-controller="UmbracoForms.Integrations.Commerce.eMerchantPay.CustomerDetailsMapperController as vm">
1+
<div ng-controller="UmbracoForms.Integrations.Commerce.emerchantpay.CustomerDetailsMapperController as vm">
22

33
<div>
44
<select ng-model="vm.selectedCustomerProperty">
@@ -10,15 +10,19 @@
1010
<option ng-repeat="field in vm.fields" value="{{ field.id }}">{{ field.value }}</option>
1111
</select>
1212
</div>
13-
13+
14+
<div ng-if="vm.requiredFields.length > 0" class="alert alert-info mt2 mr3" role="alert">
15+
<span>Mandatory fields: {{ vm.requiredFields }}</span>
16+
</div>
17+
1418
<div class="mt2">
1519
<umb-button type="button" class="mt2"
1620
action="vm.addMapping()"
1721
label="Add mapping"
1822
disabled="vm.selectedCustomerProperty.length === 0 || vm.selectedField.length === 0">
1923
</umb-button>
2024
</div>
21-
25+
2226
<div class="umb-forms-mappings mt2" ng-if="vm.mappings.length > 0">
2327

2428
<div class="umb-forms-mapping-header">
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
1-
function eMerchantPayResource($http, umbRequestHelper) {
1+
function emerchantpayResource($http, umbRequestHelper) {
22

3-
const apiEndpoint = "backoffice/UmbracoFormsIntegrationsCommerceEmerchantPay/EmerchantPay";
3+
const apiEndpoint = "backoffice/UmbracoFormsIntegrationsCommerceEmerchantpay/emerchantpay";
44

55
return {
6+
isAccountAvailable: function () {
7+
return umbRequestHelper.resourcePromise(
8+
$http.get(`${apiEndpoint}/IsAccountAvailable`),
9+
"Failed to get resource");
10+
},
611
getCurrencies: function () {
712
return umbRequestHelper.resourcePromise(
813
$http.get(`${apiEndpoint}/GetCurrencies`),
914
"Failed to get resource");
1015
},
16+
getAvailableMappingFields: function () {
17+
return umbRequestHelper.resourcePromise(
18+
$http.get(`${apiEndpoint}/GetAvailableMappingFields`),
19+
"Failed to get resource");
20+
},
21+
getRequiredMappingFields: function () {
22+
return umbRequestHelper.resourcePromise(
23+
$http.get(`${apiEndpoint}/GetRequiredMappingFields`),
24+
"Failed to get resource");
25+
}
1126
};
1227
}
1328

14-
angular.module('umbraco.resources').factory('umbracoFormsIntegrationsCommerceEMerchantPayResource', eMerchantPayResource);
29+
angular.module('umbraco.resources').factory('umbracoFormsIntegrationsCommerceEmerchantpayResource', emerchantpayResource);

src/Umbraco.Forms.Integrations.Commerce.EMerchantPay/App_Plugins/UmbracoForms.Integrations/Commerce/eMerchantPay/field-picker.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
}
2222

2323
angular.module("umbraco")
24-
.controller("UmbracoForms.Integrations.Commerce.eMerchantPay.FieldPickerController", FieldPickerController);
24+
.controller("UmbracoForms.Integrations.Commerce.emerchantpay.FieldPickerController", FieldPickerController);

src/Umbraco.Forms.Integrations.Commerce.EMerchantPay/App_Plugins/UmbracoForms.Integrations/Commerce/eMerchantPay/field-picker.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div ng-controller="UmbracoForms.Integrations.Commerce.eMerchantPay.FieldPickerController as vm">
1+
<div ng-controller="UmbracoForms.Integrations.Commerce.emerchantpay.FieldPickerController as vm">
22

33
<div>
44
<select ng-model="vm.selectedField" ng-click="vm.saveField()">
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"javascript": [
3-
"~/App_Plugins/UmbracoForms.Integrations/Commerce/eMerchantPay/customer-details-mapper.controller.js",
4-
"~/App_Plugins/UmbracoForms.Integrations/Commerce/eMerchantPay/currency.controller.js",
5-
"~/App_Plugins/UmbracoForms.Integrations/Commerce/eMerchantPay/emerchantpay.resource.js",
6-
"~/App_Plugins/UmbracoForms.Integrations/Commerce/eMerchantPay/emerchantpay.service.js",
7-
"~/App_Plugins/UmbracoForms.Integrations/Commerce/eMerchantPay/field-picker.controller.js"
3+
"~/App_Plugins/UmbracoForms.Integrations/Commerce/emerchantpay/customer-details-mapper.controller.js",
4+
"~/App_Plugins/UmbracoForms.Integrations/Commerce/emerchantpay/currency.controller.js",
5+
"~/App_Plugins/UmbracoForms.Integrations/Commerce/emerchantpay/emerchantpay.resource.js",
6+
"~/App_Plugins/UmbracoForms.Integrations/Commerce/emerchantpay/emerchantpay.service.js",
7+
"~/App_Plugins/UmbracoForms.Integrations/Commerce/emerchantpay/field-picker.controller.js"
88
],
99
"css": [ "" ]
1010
}

src/Umbraco.Forms.Integrations.Commerce.EMerchantPay/Builders/MappingBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
using System.Linq;
44

55
using Umbraco.Forms.Core.Persistence.Dtos;
6-
using Umbraco.Forms.Integrations.Commerce.EMerchantPay.Models.Dtos;
6+
using Umbraco.Forms.Integrations.Commerce.Emerchantpay.Models.Dtos;
77

8-
namespace Umbraco.Forms.Integrations.Commerce.EMerchantPay.Builders
8+
namespace Umbraco.Forms.Integrations.Commerce.Emerchantpay.Builders
99
{
1010
public class MappingBuilder
1111
{
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System.Collections.Generic;
2+
3+
namespace Umbraco.Forms.Integrations.Commerce.Emerchantpay.Configuration
4+
{
5+
public interface ISettingsParser
6+
{
7+
IEnumerable<string> AsEnumerable(string propertyName);
8+
9+
Dictionary<string, string> AsDictionary(string propertyName);
10+
}
11+
}

0 commit comments

Comments
 (0)