CroemincRubyGem 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.idea/.gitignore +3 -0
  4. data/.idea/.rakeTasks +7 -0
  5. data/.idea/MetropagoRubyGem.iml +19 -0
  6. data/.idea/inspectionProfiles/Project_Default.xml +6 -0
  7. data/.idea/metropago-gateway-rubygem-sdk.iml +19 -0
  8. data/.idea/misc.xml +7 -0
  9. data/.idea/modules.xml +8 -0
  10. data/.idea/vcs.xml +6 -0
  11. data/.rspec +3 -0
  12. data/.travis.yml +7 -0
  13. data/CODE_OF_CONDUCT.md +74 -0
  14. data/CroemincRubyGem.gemspec +42 -0
  15. data/Gemfile +4 -0
  16. data/Gemfile.lock +35 -0
  17. data/LICENSE.txt +21 -0
  18. data/Rakefile +6 -0
  19. data/SDKDemo.rb +464 -0
  20. data/bin/console +14 -0
  21. data/bin/setup +8 -0
  22. data/lib/Catalogs/environment_type.rb +3 -0
  23. data/lib/Certificates/ca-bundle.crt +3866 -0
  24. data/lib/Config/application.yml +2 -0
  25. data/lib/CroemincRubyGem/version.rb +3 -0
  26. data/lib/CroemincRubyGem.rb +13 -0
  27. data/lib/Entities/ach.rb +37 -0
  28. data/lib/Entities/address.rb +97 -0
  29. data/lib/Entities/amount_range_filter.rb +60 -0
  30. data/lib/Entities/base_entity.rb +15 -0
  31. data/lib/Entities/beneficiary.rb +89 -0
  32. data/lib/Entities/credit_card.rb +150 -0
  33. data/lib/Entities/customer.rb +218 -0
  34. data/lib/Entities/customer_entity.rb +130 -0
  35. data/lib/Entities/customer_entity_response.rb +79 -0
  36. data/lib/Entities/customer_response.rb +90 -0
  37. data/lib/Entities/customer_search.rb +80 -0
  38. data/lib/Entities/customer_search_option.rb +55 -0
  39. data/lib/Entities/date_range_filter.rb +59 -0
  40. data/lib/Entities/instruction.rb +136 -0
  41. data/lib/Entities/instruction_response.rb +63 -0
  42. data/lib/Entities/instrument.rb +73 -0
  43. data/lib/Entities/instrument_response.rb +70 -0
  44. data/lib/Entities/request_model.rb +80 -0
  45. data/lib/Entities/response_model.rb +39 -0
  46. data/lib/Entities/service.rb +70 -0
  47. data/lib/Entities/text_filter.rb +45 -0
  48. data/lib/Entities/transaction.rb +162 -0
  49. data/lib/Entities/transaction_options.rb +49 -0
  50. data/lib/Entities/transaction_response.rb +79 -0
  51. data/lib/Entities/transaction_search_request.rb +57 -0
  52. data/lib/Entities/validation_error.rb +60 -0
  53. data/lib/Entities/wallet.rb +20 -0
  54. data/lib/Gateway/croeminc_gateway.rb +56 -0
  55. data/lib/Helpers/api_helper.rb +96 -0
  56. data/lib/Helpers/jso_nable.rb +56 -0
  57. data/lib/Helpers/model_parser.rb +235 -0
  58. data/lib/Managers/customer_manager.rb +148 -0
  59. data/lib/Managers/transaction_manager.rb +264 -0
  60. data/lib/MetropagoRubyGem/version.rb +3 -0
  61. data/lib/Test/customer_operations.rb +395 -0
  62. data/lib/Test/transaction_operations.rb +259 -0
  63. metadata +146 -0
@@ -0,0 +1,73 @@
1
+ require_relative '../Helpers/jso_nable'
2
+ require_relative '../Entities/instrument_response'
3
+ class Instrument < JSONable
4
+ def CustomerId=(customerId)
5
+ @customerId = customerId
6
+ end
7
+
8
+ def FriendlyName=(friendlyName)
9
+ @friendlyName = friendlyName
10
+ end
11
+
12
+ def Status=(status)
13
+ @status = status
14
+ end
15
+
16
+ def Token=(token)
17
+ @token = token
18
+ end
19
+
20
+ def IssuerBank=(issuerBank)
21
+ @issuerBank = issuerBank
22
+ end
23
+
24
+ def CustomerIdentifier=(customerIdentifier)
25
+ @customerIdentifier = customerIdentifier
26
+ end
27
+
28
+ def ResponseDetails=(responseDetails) #InstrumentResponse type
29
+ @responseDetails = responseDetails
30
+ end
31
+
32
+ def CustomFields=(customFields) # Hash type
33
+ @customFields = customFields
34
+ end
35
+
36
+ #Getters
37
+ def getCustomerId
38
+ return @customerId
39
+ end
40
+
41
+ def getFriendlyName
42
+ return @friendlyName
43
+ end
44
+
45
+ def getStatus
46
+ return @status
47
+ end
48
+
49
+ def getToken
50
+ return @token
51
+ end
52
+
53
+ def getIssuerBank
54
+ return @issuerBank
55
+ end
56
+
57
+ def getCustomerIdentifier
58
+ return @customerIdentifier
59
+ end
60
+
61
+ def getResponseDetails
62
+ return @responseDetails
63
+ end
64
+
65
+ def getCustomFields
66
+ return @customFields
67
+ end
68
+ #protected String Token;
69
+ #private String IssuerBank;
70
+ #private String CustomerIdentifier;
71
+ #private InstrumentResponse ResponseDetails;
72
+
73
+ end
@@ -0,0 +1,70 @@
1
+ require_relative '../Entities/validation_error'
2
+ class InstrumentResponse
3
+
4
+ def initialize(h = nil)
5
+
6
+ if(h != nil)
7
+ h.each {
8
+ |k,v|
9
+
10
+ propNameFormatted = k.to_s + "="
11
+
12
+ #passing true because we also need to check if property exists in parent class.
13
+ if(InstrumentResponse.instance_methods(true).include?(propNameFormatted.to_sym))
14
+ public_send("#{k}=",v)
15
+ end
16
+ }
17
+ end
18
+
19
+ end
20
+
21
+ def Id=(id)
22
+ @id = id
23
+ end
24
+
25
+ def ResponseCode=(responseCode)
26
+ @responseCode = responseCode
27
+ end
28
+
29
+ def ResponseSummary=(responseSummary)
30
+ @responseSummary = responseSummary
31
+ end
32
+
33
+ def IsSuccess=(isSuccess)
34
+ @isSuccess = isSuccess
35
+ end
36
+
37
+ def ValidationErrors=(validationErrors) #ValidationError type
38
+ @validationErrors = validationErrors
39
+ end
40
+
41
+
42
+ #Getters
43
+ def getId
44
+ return @id
45
+ end
46
+
47
+ def getResponseCode
48
+ return @responseCode
49
+ end
50
+
51
+ def getResponseSummary
52
+ return @responseSummary
53
+ end
54
+
55
+ def getIsSuccess
56
+ return @isSuccess
57
+ end
58
+
59
+ def getValidationErrors
60
+ return @validationErrors
61
+ end
62
+
63
+ end
64
+
65
+
66
+ #private ValidationError ValidationErrors;
67
+ #private String ResponseSummary;
68
+ #private String ResponseCode;
69
+ #private String Id;
70
+ #private boolean IsSuccess ;#
@@ -0,0 +1,80 @@
1
+ require_relative '../Helpers/jso_nable'
2
+ class RequestModel < JSONable
3
+
4
+ def Identification=(identification)
5
+ @identification = identification
6
+ end
7
+
8
+ def DateTimeStamp=(dateTimeStamp)
9
+ @dateTimeStamp = dateTimeStamp
10
+ end
11
+
12
+ def SDKVersion=(sDKVersion)
13
+ @sDKVersion = sDKVersion
14
+ end
15
+
16
+ def RequestMessage=(requestMessage)
17
+ @requestMessage = requestMessage
18
+ end
19
+
20
+ def TerminalId=(terminalId)
21
+ @terminalId = terminalId
22
+ end
23
+
24
+ def BeneficiaryEnabledMerchant=(beneficiaryEnabledMerchant)
25
+ @beneficiaryEnabledMerchant = beneficiaryEnabledMerchant
26
+ end
27
+
28
+ def Culture=(culture)
29
+ @culture = culture
30
+ end
31
+
32
+ def MerchantId=(merchantId)
33
+ @merchantId = merchantId
34
+ end
35
+
36
+ def EnableLogs=(enableLogs)
37
+ @enableLogs = enableLogs
38
+ end
39
+
40
+
41
+ #Getters
42
+ def getIdentification
43
+ return @identification
44
+ end
45
+
46
+ def getDateTimeStamp
47
+ return @dateTimeStamp
48
+ end
49
+
50
+ def getSDKVersion
51
+ return @sDKVersion
52
+ end
53
+
54
+ def getRequestMessage
55
+ return @requestMessage
56
+ end
57
+
58
+ def getTerminalId
59
+ return @terminalId
60
+ end
61
+
62
+ def getBeneficiaryEnabledMerchant
63
+ return @beneficiaryEnabledMerchant
64
+ end
65
+
66
+ def getCulture
67
+ return @culture
68
+ end
69
+
70
+ def getMerchantId
71
+ return @merchantId
72
+ end
73
+
74
+ def getEnableLogs
75
+ return @enableLogs
76
+ end
77
+
78
+
79
+
80
+ end
@@ -0,0 +1,39 @@
1
+ require_relative '../Helpers/jso_nable'
2
+ class ResponseModel < JSONable
3
+
4
+ def APIVersion=(aPIVersion)
5
+ @aPIVersion = aPIVersion
6
+ end
7
+
8
+ def ResponseMessage=(responseMessage)
9
+ @responseMessage = responseMessage
10
+ end
11
+
12
+ def Identification=(identification)
13
+ @identification = identification
14
+ end
15
+
16
+ def Errors=(errors)
17
+ @errors = errors
18
+ end
19
+
20
+
21
+ #Getters
22
+
23
+ def getAPIVersion
24
+ return @aPIVersion
25
+ end
26
+
27
+ def getResponseMessage
28
+ return @responseMessage
29
+ end
30
+
31
+ def getIdentification
32
+ return @identification
33
+ end
34
+
35
+ def getErrors
36
+ return @errors
37
+ end
38
+
39
+ end
@@ -0,0 +1,70 @@
1
+ require_relative '../Helpers/jso_nable'
2
+ class Service < JSONable
3
+
4
+ def initialize(h = nil)
5
+
6
+ if(h != nil)
7
+ h.each {
8
+ |k,v|
9
+
10
+ propNameFormatted = k.to_s + "="
11
+
12
+
13
+ if(Service.instance_methods(false).include?(propNameFormatted.to_sym))
14
+ public_send("#{k}=",v)
15
+ end
16
+ }
17
+ end
18
+
19
+ end
20
+
21
+ def Id=(id)
22
+ @id = id
23
+ end
24
+
25
+ def Name=(name)
26
+ @name = name
27
+ end
28
+
29
+ def Description=(description)
30
+ @description = description
31
+ end
32
+
33
+ def IdentificationName=(identificationName)
34
+ @identificationName = identificationName
35
+ end
36
+
37
+ def CustomFields=(customFields) #Hash type
38
+ @customFields = customFields
39
+ end
40
+
41
+ #Getters
42
+ def getId
43
+ return @id
44
+ end
45
+
46
+ def getName
47
+ return @name
48
+ end
49
+
50
+ def getDescription
51
+ return @description
52
+ end
53
+
54
+ def getIdentificationName
55
+ return @identificationName
56
+ end
57
+
58
+ def getCustomFields
59
+ return @customFields
60
+ end
61
+
62
+
63
+
64
+ #private int Id;
65
+ #private String Name;
66
+ #private String Description;
67
+ #private String IdentificationName;
68
+ #private HashMap CustomFields;
69
+
70
+ end
@@ -0,0 +1,45 @@
1
+ require_relative '../Helpers/jso_nable'
2
+ class TextFilter < JSONable
3
+
4
+ def Text=(text)
5
+ @text = text
6
+ end
7
+
8
+ def OperatioClearFilter
9
+ @operation = operation
10
+ end
11
+
12
+
13
+ #Methods
14
+ def StartsWith(text)
15
+ self.ClearFilter
16
+ @text = text
17
+ @operation = "STARTS_WITH"
18
+ return self
19
+ end
20
+
21
+ def EndsWith(text)
22
+ self.ClearFilter
23
+ @text = text
24
+ @operation = "ENDS_WITH"
25
+ return self
26
+ end
27
+
28
+ def Is(text)
29
+ self.ClearFilter
30
+ @text = text
31
+ @operation = "IS"
32
+ return self
33
+ end
34
+
35
+
36
+ #private
37
+ def ClearFilter
38
+ @text = ""
39
+ @operation = ""
40
+ end
41
+
42
+ #private String Text;
43
+ #private String Operation;
44
+
45
+ end
@@ -0,0 +1,162 @@
1
+ require_relative '../Helpers/jso_nable'
2
+ class Transaction < JSONable
3
+
4
+ def initialize(h = nil)
5
+
6
+ if(h != nil)
7
+
8
+ h.each {
9
+ |k,v|
10
+
11
+ propNameFormatted = k.to_s + "="
12
+
13
+ if(Transaction.instance_methods(false).include?(propNameFormatted.to_sym))
14
+ public_send("#{k}=",v)
15
+ end
16
+
17
+ }
18
+
19
+ end
20
+
21
+ end
22
+
23
+ def CreditCardDetail=(creditCardDetail) #CreditCard type
24
+ @creditCardDetail = creditCardDetail
25
+ end
26
+
27
+ def PaymentMethodToken=(paymentMethodToken)
28
+ @paymentMethodToken = paymentMethodToken
29
+ end
30
+
31
+ def BillingAddressId=(billingAddressId)
32
+ @billingAddressId = billingAddressId
33
+ end
34
+
35
+ def TerminalId=(terminalId)
36
+ @terminalId = terminalId
37
+ end
38
+
39
+ def OrderTrackingNumber=(orderTrackingNumber)
40
+ @orderTrackingNumber = orderTrackingNumber
41
+ end
42
+
43
+ def CustomerId=(customerId)
44
+ @customerId = customerId
45
+ end
46
+
47
+ def OrderId=(orderId)
48
+ @orderId = orderId
49
+ end
50
+
51
+ def ShippingAddressId=(shippingAddressId)
52
+ @shippingAddressId = shippingAddressId
53
+ end
54
+
55
+ def TransactionId=(transactionId)
56
+ @transactionId = transactionId
57
+ end
58
+
59
+ def Amount=(amount) #double type
60
+ @amount = amount
61
+ end
62
+
63
+ def BillingAddress=(billingAddress) #Address Type
64
+ @billingAddress = billingAddress
65
+ end
66
+
67
+ def ShippingAddress=(shippingAddress)
68
+ @shippingAddress = shippingAddress
69
+ end
70
+
71
+ def CustomFields=(customFields) #Hash type
72
+ @customFields = customFields
73
+ end
74
+
75
+ def CustomerData=(customerData) #Customer Type
76
+ @customerData = customerData
77
+ end
78
+
79
+ def TransactOptions=(transactOptions) #TransactionOptions type
80
+ @transactOptions = transactOptions
81
+ end
82
+
83
+ def ResponseDetails=(responseDetails) #TransactionResponse type
84
+ @responseDetails = responseDetails
85
+ end
86
+
87
+ def CustomerEntityDetail=(customerEntityDetail) #CustomerEntity Type
88
+ @customerEntityDetail = customerEntityDetail
89
+ end
90
+
91
+ def ThirdPartyDescription=(thirdPartyDescription)
92
+ @thirdPartyDescription = thirdPartyDescription
93
+ end
94
+
95
+ def ThirdPartyStatus=(thirdPartyStatus)
96
+ @thirdPartyStatus = thirdPartyStatus
97
+ end
98
+
99
+
100
+ #Getters
101
+
102
+ def getResponseDetails
103
+ return @responseDetails
104
+ end
105
+
106
+ def getTransactionId
107
+ return @transactionId
108
+ end
109
+
110
+ def getCustomerId
111
+ return @customerId
112
+ end
113
+
114
+ def getCustomerEntityDetail
115
+ return @customerEntityDetail
116
+ end
117
+
118
+ def getBillingAddress
119
+ return @billingAddress
120
+ end
121
+
122
+ def getShippingAddress
123
+ return @shippingAddress
124
+ end
125
+
126
+ def getCustomerData
127
+ return @customerData
128
+ end
129
+
130
+ def getAmount
131
+ return @amount
132
+ end
133
+
134
+ def getOrderId
135
+ return @orderId
136
+ end
137
+
138
+ def getCreditCardDetail
139
+ return @creditCardDetail
140
+ end
141
+
142
+ #private CreditCard CreditCardDetail;
143
+ #private String PaymentMethodToken;
144
+ #private String BillingAddressId;
145
+ #private String TerminalId;
146
+ #private String OrderTrackingNumber;
147
+ #private String CustomerId;
148
+ #private String OrderId;
149
+ #private String ShippingAddressId;
150
+ #private String TransactionId;
151
+ #private double Amount;
152
+ #private Address BillingAddress;
153
+ #private Address ShippingAddress;
154
+ #private HashMap CustomFields;
155
+ #private Customer CustomerData;
156
+ #private TransactionOptions TransactOptions;
157
+ #private TransactionResponse ResponseDetails;
158
+ #private CustomerEntity CustomerEntityDetail;
159
+ #private String ThirdPartyDescription;
160
+ #private String ThirdPartyStatus;
161
+
162
+ end
@@ -0,0 +1,49 @@
1
+ require_relative '../Helpers/jso_nable'
2
+ class TransactionOptions < JSONable
3
+
4
+ def initialize(h = nil)
5
+
6
+ if(h != nil)
7
+
8
+ h.each {
9
+ |k,v|
10
+
11
+ propNameFormatted = k.to_s + "="
12
+
13
+ if(TransactionOptions.instance_methods(false).include?(propNameFormatted.to_sym))
14
+ public_send("#{k}=",v)
15
+ end
16
+
17
+ }
18
+
19
+ end
20
+
21
+ end
22
+
23
+ def GenerateToken=(generateToken) #bool type
24
+ @generateToken = generateToken
25
+ end
26
+
27
+ def GenerateTokenOnSuccess=(generateTokenOnSuccess) #bool type
28
+ @generateTokenOnSuccess = generateTokenOnSuccess
29
+ end
30
+
31
+ def AddShippingAddressForCustomer=(addShippingAddressForCustomer) #bool type
32
+ @addShippingAddressForCustomer = addShippingAddressForCustomer
33
+ end
34
+
35
+ def UseDefaultCustomerPaymentMethod=(useDefaultCustomerPaymentMethod) #bool type
36
+ @useDefaultCustomerPaymentMethod = useDefaultCustomerPaymentMethod
37
+ end
38
+
39
+ def Operation=(operation)
40
+ @operation = operation
41
+ end
42
+
43
+ #private boolean GenerateToken;
44
+ #private boolean GenerateTokenOnSuccess;
45
+ #private boolean AddShippingAddressForCustomer;
46
+ #private boolean UseDefaultCustomerPaymentMethod;
47
+ #private String Operation;
48
+
49
+ end
@@ -0,0 +1,79 @@
1
+ require_relative '../Helpers/jso_nable'
2
+ class TransactionResponse < JSONable
3
+
4
+ def initialize(h = nil)
5
+
6
+ if(h != nil)
7
+
8
+ h.each {
9
+ |k,v|
10
+
11
+ propNameFormatted = k.to_s + "="
12
+
13
+ if(TransactionResponse.instance_methods(false).include?(propNameFormatted.to_sym))
14
+ public_send("#{k}=",v)
15
+ end
16
+
17
+ }
18
+
19
+ end
20
+
21
+ end
22
+
23
+ def ResponseSummary=(responseSummary)
24
+ @responseSummary = responseSummary
25
+ end
26
+
27
+ def AuthorizationNumber=(authorizationNumber)
28
+ @authorizationNumber = authorizationNumber
29
+ end
30
+
31
+ def ResponseCode=(responseCode)
32
+ @responseCode = responseCode
33
+ end
34
+
35
+ def TransactionId=(transactionId)
36
+ @transactionId = transactionId
37
+ end
38
+
39
+ def ValidationErrors=(validationErrors) #ValidationError type
40
+ @validationErrors = validationErrors
41
+ end
42
+
43
+ def IsSuccess=(isSuccess)
44
+ @isSuccess = isSuccess
45
+ end
46
+
47
+ #Getters
48
+ def getIsSuccess
49
+ return @isSuccess
50
+ end
51
+
52
+ def getResponseCode
53
+ return @responseCode
54
+ end
55
+
56
+ def getResponseSummary
57
+ return @responseSummary
58
+ end
59
+
60
+ def getAuthorizationNumber
61
+ return @authorizationNumber
62
+ end
63
+
64
+ def getTransactionId
65
+ return @transactionId
66
+ end
67
+
68
+ def getValidationErrors
69
+ return @validationErrors
70
+ end
71
+
72
+ #private String ResponseSummary;
73
+ #private String AuthorizationNumber;
74
+ #private String ResponseCode;
75
+ #private String TransactionId;
76
+ #private ValidationError ValidationErrors;
77
+ #private boolean IsSuccess;
78
+
79
+ end
@@ -0,0 +1,57 @@
1
+ require_relative '../Helpers/jso_nable'
2
+ class TransactionSearchRequest < JSONable
3
+
4
+ def TransactionId=(transactionId)
5
+ @transactionId = transactionId
6
+ end
7
+
8
+ def OrderTrackingNumber=(orderTrackingNumber)
9
+ @orderTrackingNumber = orderTrackingNumber
10
+ end
11
+
12
+ def Token=(token)
13
+ @token = token
14
+ end
15
+
16
+ def Amount=(amount) #AmountRangeFilter Type
17
+ @amount = amount
18
+ end
19
+
20
+ def DateCreated=(dateCreated) #DateRangeFilter type
21
+ @dateCreated = dateCreated
22
+ end
23
+
24
+ def SettledDate=(settledDate) #DateRangeFilter type
25
+ @settledDate = settledDate
26
+ end
27
+
28
+ def CardNumber=(cardNumber) #TextFilter type
29
+ @cardNumber = cardNumber
30
+ end
31
+
32
+ def CardHolderName=(cardHolderName)
33
+ @cardHolderName = cardHolderName
34
+ end
35
+
36
+ def CustomerId=(customerId)
37
+ @customerId = customerId
38
+ end
39
+
40
+ def CustomerIdentifier(customerIdentifier)
41
+ @customerIdentifier = customerIdentifier
42
+ end
43
+
44
+ def SearchOption(searchOption)
45
+ @searchOption = searchOption
46
+ end
47
+
48
+ #private String TransactionId;
49
+ #private String OrderTrackingNumber;
50
+ #private String Token;
51
+ #private AmountRangeFilter Amount;
52
+ #private DateRangeFilter DateCreated;
53
+ #private DateRangeFilter SettledDate;
54
+ #private TextFilter CardNumber;
55
+ #private TextFilter CardHolderName;
56
+
57
+ end