Skip to content

Commit 183139f

Browse files
authored
Merge pull request #5 from CyberSource/cybersource-rest-client-ruby-phase2
BT Api's integration
2 parents eeae287 + c01bc2c commit 183139f

File tree

1,287 files changed

+77708
-54080
lines changed

Some content is hidden

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

1,287 files changed

+77708
-54080
lines changed
Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
Gem::Specification.new do |s|
2-
s.name = "AuthenticationSDK"
3-
s.version = "0.0.1"
4-
s.platform = Gem::Platform::RUBY
5-
s.date = "2018-07-17"
6-
s.summary = "Cybersource Payments REST API Ruby Gem"
7-
s.description = "Move your business forward with the Cybersource Payments REST API"
8-
s.authors = ["cybersource"]
9-
s.email = ""
10-
s.files = Dir.glob("{lib}/**/*")
2+
s.name = "authenticationSDK"
3+
s.version = "0.0.1"
4+
s.platform = Gem::Platform::RUBY
5+
s.date = "2018-07-17"
6+
s.summary = "Cybersource Payments REST API Ruby Gem"
7+
s.description = "Move your business forward with the Cybersource Payments REST API"
8+
s.authors = ["cybersource"]
9+
s.email = ""
10+
s.files = Dir.glob("{lib}/**/*")
11+
12+
s.required_ruby_version = '>= 2.2.2'
13+
s.required_rubygems_version = '>= 1.3.6'
1114

12-
s.required_ruby_version = '>= 2.2.2'
13-
s.required_rubygems_version = '>= 1.3.6'
14-
15-
s.add_runtime_dependency 'activesupport', '~> 5.2', '>= 5.2.0'
16-
s.add_runtime_dependency 'json', '~> 2.1.0', '>= 1.8.1'
17-
s.add_runtime_dependency 'interface','~> 1.0', '>= 1.0.4'
18-
s.add_runtime_dependency 'jwt', '~> 2.1.0'
19-
20-
s.add_development_dependency 'rspec', '~> 2.1'
21-
s.add_development_dependency 'simplecov'
22-
s.add_development_dependency 'rubocop', '~> 0.57.2'
23-
end
15+
s.add_runtime_dependency 'activesupport', '~> 5.2', '>= 5.2.0'
16+
s.add_runtime_dependency 'json', '~> 2.1.0', '>= 1.8.1'
17+
s.add_runtime_dependency 'interface','~> 1.0', '>= 1.0.4'
18+
s.add_runtime_dependency 'jwt', '~> 2.1.0'
19+
20+
s.add_development_dependency 'rspec', '~> 2.1'
21+
s.add_development_dependency 'simplecov'
22+
s.add_development_dependency 'rubocop', '~> 0.57.2'
23+
end
24+

AuthenticationSDK/authentication/http/GetSignatureParameter.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def generateSignatureParameter(merchantconfig_obj, gmtdatetime, log_obj)
2222
if request_type == Constants::GET_REQUEST_TYPE || request_type == Constants::DELETE_REQUEST_TYPE
2323
targetUrl=gettargetUrlForGetDelete(request_type,merchantconfig_obj)
2424
signatureString << targetUrl + "\n"
25-
elsif request_type == Constants::POST_REQUEST_TYPE || request_type == Constants::PUT_REQUEST_TYPE
25+
elsif request_type == Constants::POST_REQUEST_TYPE || request_type == Constants::PUT_REQUEST_TYPE || request_type == Constants::PATCH_REQUEST_TYPE
2626
targetUrl=gettargetUrlForPutPost(request_type,merchantconfig_obj)
2727
signatureString << targetUrl + "\n"
2828
payload = merchantconfig_obj.requestJsonData
@@ -56,6 +56,8 @@ def gettargetUrlForPutPost(request_type, merchantconfig_obj)
5656
targetUrlForPutPost = Constants::POST_REQUEST_TYPE_LOWER + ' ' + merchantconfig_obj.requestTarget
5757
elsif request_type == Constants::PUT_REQUEST_TYPE
5858
targetUrlForPutPost = Constants::PUT_REQUEST_TYPE_LOWER + ' ' + merchantconfig_obj.requestTarget
59+
elsif request_type == Constants::PATCH_REQUEST_TYPE
60+
targetUrlForPutPost = Constants::PATCH_REQUEST_TYPE_LOWER + ' ' + merchantconfig_obj.requestTarget
5961
end
6062
return targetUrlForPutPost
6163
end

AuthenticationSDK/authentication/http/HttpSignatureHeader.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ def getsignatureHeader(request_type)
4141
headers = 'host date (request-target)' + ' ' + Constants::V_C_MERCHANT_ID
4242
elsif request_type == Constants::PUT_REQUEST_TYPE
4343
headers = 'host date (request-target) digest ' + Constants::V_C_MERCHANT_ID
44-
else
44+
elsif request_type == Constants::PATCH_REQUEST_TYPE
45+
headers = 'host date (request-target) digest ' + Constants::V_C_MERCHANT_ID
46+
else
4547
raise StandardError.new(Constants::ERROR_PREFIX + Constants::INVALID_REQUEST_TYPE_METHOD)
4648
end
4749
return headers

AuthenticationSDK/authentication/jwt/JwtToken.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def getToken(merchantconfig_obj,gmtDatetime,log_obj)
1616
request_type = merchantconfig_obj.requestType.upcase
1717
filePath = merchantconfig_obj.keysDirectory + '/' + merchantconfig_obj.keyFilename + '.p12'
1818
if (!File.exist?(filePath))
19-
raise Constants::ERROR_PREFIX + Constants::FILE_NOT_FOUND + filePath
19+
raise Constants::ERROR_PREFIX + Constants::FILE_NOT_FOUND + File.expand_path(filePath)
2020
end
2121
p12File = File.binread(filePath)
2222
jwtBody=getJwtBody(request_type, gmtDatetime, merchantconfig_obj, log_obj)
@@ -47,7 +47,7 @@ def getToken(merchantconfig_obj,gmtDatetime,log_obj)
4747
end
4848
end
4949
def getJwtBody(request_type, gmtDatetime, merchantconfig_obj,log_obj)
50-
if request_type == Constants::POST_REQUEST_TYPE || request_type == Constants::PUT_REQUEST_TYPE
50+
if request_type == Constants::POST_REQUEST_TYPE || request_type == Constants::PUT_REQUEST_TYPE || request_type == Constants::PATCH_REQUEST_TYPE
5151
payload = merchantconfig_obj.requestJsonData
5252
# Note: Digest is not passed for GET calls
5353
digest = DigestGeneration.new.generateDigest(payload, log_obj)

AuthenticationSDK/util/Constants.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ class Constants
55
POST_REQUEST_TYPE_LOWER = 'post' unless const_defined?(:POST_REQUEST_TYPE_LOWER)
66

77
PUT_REQUEST_TYPE_LOWER = 'put' unless const_defined?(:PUT_REQUEST_TYPE_LOWER)
8+
9+
PATCH_REQUEST_TYPE_LOWER = 'patch' unless const_defined?(:PATCH_REQUEST_TYPE_LOWER)
810

911
DELETE_REQUEST_TYPE_LOWER = 'delete' unless const_defined?(:DELETE_REQUEST_TYPE_LOWER)
1012

@@ -13,6 +15,8 @@ class Constants
1315
POST_REQUEST_TYPE = 'POST' unless const_defined?(:POST_REQUEST_TYPE)
1416

1517
PUT_REQUEST_TYPE = 'PUT' unless const_defined?(:PUT_REQUEST_TYPE)
18+
19+
PATCH_REQUEST_TYPE = 'PATCH' unless const_defined?(:PATCH_REQUEST_TYPE)
1620

1721
DELETE_REQUEST_TYPE = 'DELETE' unless const_defined?(:DELETE_REQUEST_TYPE)
1822

cyberSource_client.gemspec

Lines changed: 0 additions & 39 deletions
This file was deleted.

cybersource_rest_client.gemspec

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# -*- encoding: utf-8 -*-
2+
3+
=begin
4+
#CyberSource Flex API
5+
6+
#Simple PAN tokenization service
7+
8+
OpenAPI spec version: 0.0.1
9+
10+
Generated by: https://github.com/swagger-api/swagger-codegen.git
11+
Swagger Codegen version: 2.2.3
12+
13+
=end
14+
15+
$:.push File.expand_path("../lib", __FILE__)
16+
require "cybersource_rest_client/version"
17+
18+
Gem::Specification.new do |s|
19+
s.name = "cybersource_rest_client"
20+
s.version = "0.0.4"
21+
s.platform = Gem::Platform::RUBY
22+
s.authors = ["CyberSource"]
23+
s.email = ["[email protected]"]
24+
s.homepage = "https://developer.cybersource.com"
25+
s.summary = "CyberSource Ruby SDK Gem"
26+
s.description = "Simple REST API for the CyberSource Global Payments Platform"
27+
s.license = "CyberSource"
28+
s.files = Dir.glob("{lib,AuthenticationSDK}/**/*")
29+
s.required_ruby_version = ">= 1.9"
30+
31+
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
32+
s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
33+
34+
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
35+
s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
36+
s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
37+
s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
38+
s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
39+
s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
40+
s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
41+
42+
s.add_runtime_dependency 'activesupport', '~> 5.2', '>= 5.2.0'
43+
s.add_runtime_dependency 'interface','~> 1.0', '>= 1.0.4'
44+
s.add_runtime_dependency 'jwt', '~> 2.1.0'
45+
46+
s.add_development_dependency 'simplecov'
47+
s.add_development_dependency 'rubocop', '~> 0.57.2'
48+
49+
s.require_paths = ["lib"]
50+
end

docs/AuthReversalRequest.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
## Properties
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
6-
**client_reference_information** | [**V2paymentsidreversalsClientReferenceInformation**](V2paymentsidreversalsClientReferenceInformation.md) | | [optional]
7-
**reversal_information** | [**V2paymentsidreversalsReversalInformation**](V2paymentsidreversalsReversalInformation.md) | | [optional]
8-
**processing_information** | [**V2paymentsidreversalsProcessingInformation**](V2paymentsidreversalsProcessingInformation.md) | | [optional]
9-
**order_information** | [**V2paymentsidreversalsOrderInformation**](V2paymentsidreversalsOrderInformation.md) | | [optional]
10-
**point_of_sale_information** | [**V2paymentsidreversalsPointOfSaleInformation**](V2paymentsidreversalsPointOfSaleInformation.md) | | [optional]
6+
**client_reference_information** | [**Ptsv2paymentsidreversalsClientReferenceInformation**](Ptsv2paymentsidreversalsClientReferenceInformation.md) | | [optional]
7+
**reversal_information** | [**Ptsv2paymentsidreversalsReversalInformation**](Ptsv2paymentsidreversalsReversalInformation.md) | | [optional]
8+
**processing_information** | [**Ptsv2paymentsidreversalsProcessingInformation**](Ptsv2paymentsidreversalsProcessingInformation.md) | | [optional]
9+
**order_information** | [**Ptsv2paymentsidreversalsOrderInformation**](Ptsv2paymentsidreversalsOrderInformation.md) | | [optional]
10+
**point_of_sale_information** | [**Ptsv2paymentsidreversalsPointOfSaleInformation**](Ptsv2paymentsidreversalsPointOfSaleInformation.md) | | [optional]
1111

1212

docs/Body.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
## Properties
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
6-
**_links** | [**InstrumentidentifiersLinks**](InstrumentidentifiersLinks.md) | | [optional]
6+
**_links** | [**Tmsv1instrumentidentifiersLinks**](Tmsv1instrumentidentifiersLinks.md) | | [optional]
77
**id** | **String** | Unique identification number assigned by CyberSource to the submitted request. | [optional]
88
**object** | **String** | Describes type of token. For example: customer, paymentInstrument or instrumentIdentifier. | [optional]
99
**state** | **String** | Current state of the token. | [optional]
10-
**card** | [**InstrumentidentifiersCard**](InstrumentidentifiersCard.md) | | [optional]
11-
**bank_account** | [**InstrumentidentifiersBankAccount**](InstrumentidentifiersBankAccount.md) | | [optional]
12-
**processing_information** | [**InstrumentidentifiersProcessingInformation**](InstrumentidentifiersProcessingInformation.md) | | [optional]
13-
**metadata** | [**InstrumentidentifiersMetadata**](InstrumentidentifiersMetadata.md) | | [optional]
10+
**card** | [**Tmsv1instrumentidentifiersCard**](Tmsv1instrumentidentifiersCard.md) | | [optional]
11+
**bank_account** | [**Tmsv1instrumentidentifiersBankAccount**](Tmsv1instrumentidentifiersBankAccount.md) | | [optional]
12+
**processing_information** | [**Tmsv1instrumentidentifiersProcessingInformation**](Tmsv1instrumentidentifiersProcessingInformation.md) | | [optional]
13+
**metadata** | [**Tmsv1instrumentidentifiersMetadata**](Tmsv1instrumentidentifiersMetadata.md) | | [optional]
1414

1515

docs/Body1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
## Properties
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
6-
**processing_information** | [**InstrumentidentifiersProcessingInformation**](InstrumentidentifiersProcessingInformation.md) | | [optional]
6+
**processing_information** | [**Tmsv1instrumentidentifiersProcessingInformation**](Tmsv1instrumentidentifiersProcessingInformation.md) | | [optional]
77

88

0 commit comments

Comments
 (0)