-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSftpProcessingPlugin.cs
More file actions
127 lines (121 loc) · 4.89 KB
/
Copy pathSftpProcessingPlugin.cs
File metadata and controls
127 lines (121 loc) · 4.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
using System;
using System.Collections.Generic;
using PX.CCProcessingBase;
using PX.CCProcessingBase.Attributes;
using PX.CCProcessingBase.Interfaces.V2;
using PX.Common;
using PX.Data;
namespace Velixo.EBanking
{
[PXDisplayTypeName("SFTP Upload plug-in")]
public class SftpProcessingPlugin : ICCProcessingPlugin
{
public static class SettingsKeys
{
public static class Key
{
//Not more Then 10 chars
public const string Host = "HOST";
public const string Port = "PORT";
public const string Username = "USERNAME";
public const string Password = "PASSWORD";
public const string SshIdentityCert = "SSHCERT";
public const string PgpPublicKeyCert = "PGPPUBLIC";
public const string PgpPrivateKeyCert = "PGPPRIVATE";
public const string Path = "PATH";
}
[PXLocalizable]
public static class Descr
{
public const string Host = "Address of the SFTP Site";
public const string Port = "Port used for connecting to the SFTP Site";
public const string Username = "User Name";
public const string Password = "Password";
public const string SshIdentityCert = "SSH Private Key Certificate (optional)";
public const string PgpPublicKeyCert = "PGP Encryption Public Key Certificate (optional)";
public const string PgpPrivateKeyCert = "PGP Signature Private Key Certificate (optional)";
public const string Path = "Folder Path (blank for root)";
}
}
public IEnumerable<SettingsDetail> ExportSettings()
{
Dictionary<string, SettingsDetail> dictionary = new Dictionary<string, SettingsDetail>();
dictionary[SettingsKeys.Key.Host] = new SettingsDetail
{
DetailID = SettingsKeys.Key.Host,
Descr = PXLocalizer.Localize(SettingsKeys.Descr.Host),
DefaultValue = "",
IsEncryptionRequired = false
};
dictionary[SettingsKeys.Key.Port] = new SettingsDetail
{
DetailID = SettingsKeys.Key.Port,
Descr = PXLocalizer.Localize(SettingsKeys.Descr.Port),
DefaultValue = "22",
IsEncryptionRequired = false
};
dictionary[SettingsKeys.Key.Username] = new SettingsDetail
{
DetailID = SettingsKeys.Key.Username,
Descr = PXLocalizer.Localize(SettingsKeys.Descr.Username),
DefaultValue = "",
IsEncryptionRequired = false
};
dictionary[SettingsKeys.Key.Password] = new SettingsDetail
{
DetailID = SettingsKeys.Key.Password,
Descr = PXLocalizer.Localize(SettingsKeys.Descr.Password),
DefaultValue = "",
IsEncryptionRequired = true
};
dictionary[SettingsKeys.Key.SshIdentityCert] = new SettingsDetail
{
DetailID = SettingsKeys.Key.SshIdentityCert,
Descr = PXLocalizer.Localize(SettingsKeys.Descr.SshIdentityCert),
DefaultValue = "",
IsEncryptionRequired = false
};
dictionary[SettingsKeys.Key.PgpPublicKeyCert] = new SettingsDetail
{
DetailID = SettingsKeys.Key.PgpPublicKeyCert,
Descr = PXLocalizer.Localize(SettingsKeys.Descr.PgpPublicKeyCert),
DefaultValue = "",
IsEncryptionRequired = false
};
dictionary[SettingsKeys.Key.PgpPrivateKeyCert] = new SettingsDetail
{
DetailID = SettingsKeys.Key.PgpPrivateKeyCert,
Descr = PXLocalizer.Localize(SettingsKeys.Descr.PgpPrivateKeyCert),
DefaultValue = "",
IsEncryptionRequired = false
};
dictionary[SettingsKeys.Key.Path] = new SettingsDetail
{
DetailID = SettingsKeys.Key.Path,
Descr = PXLocalizer.Localize(SettingsKeys.Descr.Path),
DefaultValue = "",
IsEncryptionRequired = false
};
return dictionary.Values;
}
public string ValidateSettings(SettingsValue setting)
{
return String.Empty; //All good!
}
public void TestCredentials(IEnumerable<SettingsValue> settingValues)
{
throw new NotImplementedException();
}
public T CreateProcessor<T>(IEnumerable<SettingsValue> settingValues) where T : class
{
if(typeof(T) == typeof(IAPPaymentProcessor))
{
return new SftpPaymentProcessor(settingValues) as T;
}
else
{
return default(T);
}
}
}
}