cyberSource_client 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/AuthenticationSDK/Cybersource.gemspec +23 -23
- data/AuthenticationSDK/authentication/http/GetSignatureParameter.rb +62 -62
- data/AuthenticationSDK/authentication/http/HttpSignatureHeader.rb +50 -50
- data/AuthenticationSDK/authentication/jwt/JwtToken.rb +62 -62
- data/AuthenticationSDK/authentication/payloadDigest/digest.rb +10 -10
- data/AuthenticationSDK/core/Authorization.rb +24 -24
- data/AuthenticationSDK/core/ITokenGeneration.rb +4 -4
- data/AuthenticationSDK/core/Logger.rb +26 -26
- data/AuthenticationSDK/core/MerchantConfig.rb +181 -181
- data/AuthenticationSDK/util/ApiException.rb +18 -18
- data/AuthenticationSDK/util/Cache.rb +36 -36
- data/AuthenticationSDK/util/Constants.rb +133 -133
- data/AuthenticationSDK/util/PropertiesUtil.rb +21 -21
- data/AuthenticationSDK/util/Utility.rb +30 -30
- data/lib/cyberSource_client.rb +286 -286
- data/lib/cyberSource_client/api/capture_api.rb +133 -133
- data/lib/cyberSource_client/api/credit_api.rb +127 -127
- data/lib/cyberSource_client/api/default_api.rb +75 -75
- data/lib/cyberSource_client/api/instrument_identifier_api.rb +393 -393
- data/lib/cyberSource_client/api/key_generation_api.rb +75 -75
- data/lib/cyberSource_client/api/payment_api.rb +127 -127
- data/lib/cyberSource_client/api/payment_instrument_api.rb +312 -312
- data/lib/cyberSource_client/api/refund_api.rb +191 -191
- data/lib/cyberSource_client/api/reversal_api.rb +133 -133
- data/lib/cyberSource_client/api/tokenization_api.rb +71 -71
- data/lib/cyberSource_client/api/void_api.rb +307 -307
- data/lib/cyberSource_client/api_client.rb +437 -437
- data/lib/cyberSource_client/api_error.rb +38 -38
- data/lib/cyberSource_client/configuration.rb +202 -202
- data/lib/cyberSource_client/models/auth_reversal_request.rb +219 -219
- data/lib/cyberSource_client/models/body.rb +295 -295
- data/lib/cyberSource_client/models/body_1.rb +183 -183
- data/lib/cyberSource_client/models/body_2.rb +331 -331
- data/lib/cyberSource_client/models/body_3.rb +331 -331
- data/lib/cyberSource_client/models/capture_payment_request.rb +267 -267
- data/lib/cyberSource_client/models/card_info.rb +214 -214
- data/lib/cyberSource_client/models/create_credit_request.rb +267 -267
- data/lib/cyberSource_client/models/create_payment_request.rb +285 -285
- data/lib/cyberSource_client/models/der_public_key.rb +205 -205
- data/lib/cyberSource_client/models/error.rb +192 -192
- data/lib/cyberSource_client/models/error_links.rb +205 -205
- data/lib/cyberSource_client/models/error_response.rb +192 -192
- data/lib/cyberSource_client/models/generate_public_key_request.rb +184 -184
- data/lib/cyberSource_client/models/inline_response_200.rb +202 -202
- data/lib/cyberSource_client/models/inline_response_200_1.rb +255 -255
- data/lib/cyberSource_client/models/inline_response_200_2.rb +377 -377
- data/lib/cyberSource_client/models/inline_response_200_2_buyer_information.rb +270 -270
- data/lib/cyberSource_client/models/inline_response_200_2_device_information.rb +219 -219
- data/lib/cyberSource_client/models/inline_response_200_2_merchant_information.rb +233 -233
- data/lib/cyberSource_client/models/inline_response_200_2_order_information.rb +230 -230
- data/lib/cyberSource_client/models/inline_response_200_2_order_information_amount_details.rb +385 -385
- data/lib/cyberSource_client/models/inline_response_200_2_order_information_bill_to.rb +459 -459
- data/lib/cyberSource_client/models/inline_response_200_2_order_information_invoice_details.rb +315 -315
- data/lib/cyberSource_client/models/inline_response_200_2_order_information_line_items.rb +564 -564
- data/lib/cyberSource_client/models/inline_response_200_2_order_information_ship_to.rb +429 -429
- data/lib/cyberSource_client/models/inline_response_200_2_payment_information.rb +192 -192
- data/lib/cyberSource_client/models/inline_response_200_2_payment_information_card.rb +274 -274
- data/lib/cyberSource_client/models/inline_response_200_2_payment_information_tokenized_card.rb +299 -299
- data/lib/cyberSource_client/models/inline_response_200_2_processing_information.rb +199 -199
- data/lib/cyberSource_client/models/inline_response_200_2_processor_information.rb +227 -227
- data/lib/cyberSource_client/models/inline_response_200_2_processor_information_avs.rb +199 -199
- data/lib/cyberSource_client/models/inline_response_200_2_processor_information_card_verification.rb +199 -199
- data/lib/cyberSource_client/models/inline_response_200_3.rb +314 -314
- data/lib/cyberSource_client/models/inline_response_200_4.rb +350 -350
- data/lib/cyberSource_client/models/inline_response_200_4_device_information.rb +199 -199
- data/lib/cyberSource_client/models/inline_response_200_4_order_information.rb +230 -230
- data/lib/cyberSource_client/models/inline_response_200_4_order_information_amount_details.rb +360 -360
- data/lib/cyberSource_client/models/inline_response_200_4_order_information_invoice_details.rb +305 -305
- data/lib/cyberSource_client/models/inline_response_200_4_order_information_ship_to.rb +249 -249
- data/lib/cyberSource_client/models/inline_response_200_4_processing_information.rb +208 -208
- data/lib/cyberSource_client/models/inline_response_200_4_processing_information_authorization_options.rb +199 -199
- data/lib/cyberSource_client/models/inline_response_200_5.rb +305 -305
- data/lib/cyberSource_client/models/inline_response_200_6.rb +305 -305
- data/lib/cyberSource_client/models/inline_response_200_7.rb +295 -295
- data/lib/cyberSource_client/models/inline_response_200_8.rb +277 -277
- data/lib/cyberSource_client/models/inline_response_200_8__links.rb +219 -219
- data/lib/cyberSource_client/models/inline_response_200_8__links_first.rb +184 -184
- data/lib/cyberSource_client/models/inline_response_200_8__links_last.rb +184 -184
- data/lib/cyberSource_client/models/inline_response_200_8__links_next.rb +184 -184
- data/lib/cyberSource_client/models/inline_response_200_8__links_prev.rb +184 -184
- data/lib/cyberSource_client/models/inline_response_200_8__links_self.rb +184 -184
- data/lib/cyberSource_client/models/inline_response_200_der.rb +205 -205
- data/lib/cyberSource_client/models/inline_response_200_jwk.rb +225 -225
- data/lib/cyberSource_client/models/inline_response_201.rb +350 -350
- data/lib/cyberSource_client/models/inline_response_201_1.rb +332 -332
- data/lib/cyberSource_client/models/inline_response_201_1_authorization_information.rb +224 -224
- data/lib/cyberSource_client/models/inline_response_201_1_processor_information.rb +324 -324
- data/lib/cyberSource_client/models/inline_response_201_1_reversal_amount_details.rb +249 -249
- data/lib/cyberSource_client/models/inline_response_201_2.rb +314 -314
- data/lib/cyberSource_client/models/inline_response_201_2__links.rb +201 -201
- data/lib/cyberSource_client/models/inline_response_201_2_order_information.rb +192 -192
- data/lib/cyberSource_client/models/inline_response_201_2_order_information_amount_details.rb +224 -224
- data/lib/cyberSource_client/models/inline_response_201_2_processor_information.rb +199 -199
- data/lib/cyberSource_client/models/inline_response_201_3.rb +323 -323
- data/lib/cyberSource_client/models/inline_response_201_3__links.rb +192 -192
- data/lib/cyberSource_client/models/inline_response_201_3_order_information.rb +183 -183
- data/lib/cyberSource_client/models/inline_response_201_3_processor_information.rb +224 -224
- data/lib/cyberSource_client/models/inline_response_201_3_refund_amount_details.rb +224 -224
- data/lib/cyberSource_client/models/inline_response_201_4.rb +323 -323
- data/lib/cyberSource_client/models/inline_response_201_4_credit_amount_details.rb +224 -224
- data/lib/cyberSource_client/models/inline_response_201_5.rb +280 -280
- data/lib/cyberSource_client/models/inline_response_201_5_void_amount_details.rb +219 -219
- data/lib/cyberSource_client/models/inline_response_201_6.rb +331 -331
- data/lib/cyberSource_client/models/inline_response_201__embedded.rb +183 -183
- data/lib/cyberSource_client/models/inline_response_201__embedded_capture.rb +193 -193
- data/lib/cyberSource_client/models/inline_response_201__embedded_capture__links.rb +183 -183
- data/lib/cyberSource_client/models/inline_response_201__links.rb +201 -201
- data/lib/cyberSource_client/models/inline_response_201__links_self.rb +194 -194
- data/lib/cyberSource_client/models/inline_response_201_client_reference_information.rb +199 -199
- data/lib/cyberSource_client/models/inline_response_201_error_information.rb +239 -239
- data/lib/cyberSource_client/models/inline_response_201_error_information_details.rb +228 -228
- data/lib/cyberSource_client/models/inline_response_201_order_information.rb +192 -192
- data/lib/cyberSource_client/models/inline_response_201_order_information_amount_details.rb +249 -249
- data/lib/cyberSource_client/models/inline_response_201_order_information_invoice_details.rb +184 -184
- data/lib/cyberSource_client/models/inline_response_201_payment_information.rb +201 -201
- data/lib/cyberSource_client/models/inline_response_201_payment_information_account_features.rb +623 -623
- data/lib/cyberSource_client/models/inline_response_201_payment_information_card.rb +199 -199
- data/lib/cyberSource_client/models/inline_response_201_payment_information_tokenized_card.rb +349 -349
- data/lib/cyberSource_client/models/inline_response_201_point_of_sale_information.rb +208 -208
- data/lib/cyberSource_client/models/inline_response_201_point_of_sale_information_emv.rb +199 -199
- data/lib/cyberSource_client/models/inline_response_201_processor_information.rb +642 -642
- data/lib/cyberSource_client/models/inline_response_201_processor_information_avs.rb +224 -224
- data/lib/cyberSource_client/models/inline_response_201_processor_information_card_verification.rb +224 -224
- data/lib/cyberSource_client/models/inline_response_201_processor_information_consumer_authentication_response.rb +224 -224
- data/lib/cyberSource_client/models/inline_response_201_processor_information_customer.rb +199 -199
- data/lib/cyberSource_client/models/inline_response_201_processor_information_electronic_verification_results.rb +474 -474
- data/lib/cyberSource_client/models/inline_response_201_processor_information_issuer.rb +224 -224
- data/lib/cyberSource_client/models/inline_response_201_processor_information_merchant_advice.rb +224 -224
- data/lib/cyberSource_client/models/inline_response_400.rb +271 -271
- data/lib/cyberSource_client/models/inline_response_400_1.rb +271 -271
- data/lib/cyberSource_client/models/inline_response_400_2.rb +271 -271
- data/lib/cyberSource_client/models/inline_response_400_3.rb +271 -271
- data/lib/cyberSource_client/models/inline_response_400_4.rb +271 -271
- data/lib/cyberSource_client/models/inline_response_400_5.rb +259 -259
- data/lib/cyberSource_client/models/inline_response_400_6.rb +202 -202
- data/lib/cyberSource_client/models/inline_response_409.rb +183 -183
- data/lib/cyberSource_client/models/inline_response_409__links.rb +183 -183
- data/lib/cyberSource_client/models/inline_response_409__links_payment_instruments.rb +183 -183
- data/lib/cyberSource_client/models/inline_response_502.rb +260 -260
- data/lib/cyberSource_client/models/inline_response_default.rb +192 -192
- data/lib/cyberSource_client/models/inline_response_default__links.rb +205 -205
- data/lib/cyberSource_client/models/inline_response_default__links_next.rb +204 -204
- data/lib/cyberSource_client/models/inline_response_default_response_status.rb +225 -225
- data/lib/cyberSource_client/models/inline_response_default_response_status_details.rb +194 -194
- data/lib/cyberSource_client/models/instrumentidentifiers__links.rb +201 -201
- data/lib/cyberSource_client/models/instrumentidentifiers__links_self.rb +183 -183
- data/lib/cyberSource_client/models/instrumentidentifiers_authorization_options_merchant_initiated_transaction.rb +184 -184
- data/lib/cyberSource_client/models/instrumentidentifiers_bank_account.rb +194 -194
- data/lib/cyberSource_client/models/instrumentidentifiers_card.rb +184 -184
- data/lib/cyberSource_client/models/instrumentidentifiers_details.rb +194 -194
- data/lib/cyberSource_client/models/instrumentidentifiers_metadata.rb +184 -184
- data/lib/cyberSource_client/models/instrumentidentifiers_processing_information.rb +183 -183
- data/lib/cyberSource_client/models/instrumentidentifiers_processing_information_authorization_options.rb +183 -183
- data/lib/cyberSource_client/models/instrumentidentifiers_processing_information_authorization_options_initiator.rb +183 -183
- data/lib/cyberSource_client/models/json_web_key.rb +225 -225
- data/lib/cyberSource_client/models/key_parameters.rb +184 -184
- data/lib/cyberSource_client/models/key_result.rb +202 -202
- data/lib/cyberSource_client/models/link.rb +204 -204
- data/lib/cyberSource_client/models/links.rb +205 -205
- data/lib/cyberSource_client/models/oct_create_payment_request.rb +237 -237
- data/lib/cyberSource_client/models/paymentinstruments_bank_account.rb +184 -184
- data/lib/cyberSource_client/models/paymentinstruments_bill_to.rb +284 -284
- data/lib/cyberSource_client/models/paymentinstruments_buyer_information.rb +215 -215
- data/lib/cyberSource_client/models/paymentinstruments_buyer_information_issued_by.rb +184 -184
- data/lib/cyberSource_client/models/paymentinstruments_buyer_information_personal_identification.rb +203 -203
- data/lib/cyberSource_client/models/paymentinstruments_card.rb +278 -278
- data/lib/cyberSource_client/models/paymentinstruments_instrument_identifier.rb +295 -295
- data/lib/cyberSource_client/models/paymentinstruments_merchant_information.rb +183 -183
- data/lib/cyberSource_client/models/paymentinstruments_merchant_information_merchant_descriptor.rb +184 -184
- data/lib/cyberSource_client/models/paymentinstruments_processing_information.rb +193 -193
- data/lib/cyberSource_client/models/paymentinstruments_processing_information_bank_transfer_options.rb +184 -184
- data/lib/cyberSource_client/models/paymentsflexv1tokens_card_info.rb +214 -214
- data/lib/cyberSource_client/models/refund_capture_request.rb +267 -267
- data/lib/cyberSource_client/models/refund_payment_request.rb +267 -267
- data/lib/cyberSource_client/models/response_status.rb +225 -225
- data/lib/cyberSource_client/models/response_status_details.rb +194 -194
- data/lib/cyberSource_client/models/tokenize_parameters.rb +193 -193
- data/lib/cyberSource_client/models/tokenize_request.rb +193 -193
- data/lib/cyberSource_client/models/tokenize_result.rb +255 -255
- data/lib/cyberSource_client/models/v2credits_point_of_sale_information.rb +183 -183
- data/lib/cyberSource_client/models/v2credits_point_of_sale_information_emv.rb +221 -221
- data/lib/cyberSource_client/models/v2credits_processing_information.rb +383 -383
- data/lib/cyberSource_client/models/v2payments_aggregator_information.rb +233 -233
- data/lib/cyberSource_client/models/v2payments_aggregator_information_sub_merchant.rb +424 -424
- data/lib/cyberSource_client/models/v2payments_buyer_information.rb +285 -285
- data/lib/cyberSource_client/models/v2payments_buyer_information_personal_identification.rb +252 -252
- data/lib/cyberSource_client/models/v2payments_client_reference_information.rb +219 -219
- data/lib/cyberSource_client/models/v2payments_consumer_authentication_information.rb +374 -374
- data/lib/cyberSource_client/models/v2payments_device_information.rb +249 -249
- data/lib/cyberSource_client/models/v2payments_merchant_defined_information.rb +224 -224
- data/lib/cyberSource_client/models/v2payments_merchant_information.rb +308 -308
- data/lib/cyberSource_client/models/v2payments_merchant_information_merchant_descriptor.rb +374 -374
- data/lib/cyberSource_client/models/v2payments_order_information.rb +230 -230
- data/lib/cyberSource_client/models/v2payments_order_information_amount_details.rb +605 -605
- data/lib/cyberSource_client/models/v2payments_order_information_amount_details_amex_additional_amounts.rb +224 -224
- data/lib/cyberSource_client/models/v2payments_order_information_amount_details_surcharge.rb +209 -209
- data/lib/cyberSource_client/models/v2payments_order_information_amount_details_tax_details.rb +328 -328
- data/lib/cyberSource_client/models/v2payments_order_information_bill_to.rb +618 -618
- data/lib/cyberSource_client/models/v2payments_order_information_invoice_details.rb +330 -330
- data/lib/cyberSource_client/models/v2payments_order_information_invoice_details_transaction_advice_addendum.rb +199 -199
- data/lib/cyberSource_client/models/v2payments_order_information_line_items.rb +649 -649
- data/lib/cyberSource_client/models/v2payments_order_information_ship_to.rb +474 -474
- data/lib/cyberSource_client/models/v2payments_order_information_shipping_details.rb +234 -234
- data/lib/cyberSource_client/models/v2payments_payment_information.rb +210 -210
- data/lib/cyberSource_client/models/v2payments_payment_information_card.rb +474 -474
- data/lib/cyberSource_client/models/v2payments_payment_information_customer.rb +202 -202
- data/lib/cyberSource_client/models/v2payments_payment_information_fluid_data.rb +259 -259
- data/lib/cyberSource_client/models/v2payments_payment_information_tokenized_card.rb +424 -424
- data/lib/cyberSource_client/models/v2payments_point_of_sale_information.rb +440 -440
- data/lib/cyberSource_client/models/v2payments_point_of_sale_information_emv.rb +256 -256
- data/lib/cyberSource_client/models/v2payments_processing_information.rb +432 -432
- data/lib/cyberSource_client/models/v2payments_processing_information_authorization_options.rb +361 -361
- data/lib/cyberSource_client/models/v2payments_processing_information_authorization_options_initiator.rb +247 -247
- data/lib/cyberSource_client/models/{v2payments_processing_information_authorization_options_initiator_merchant_initiated_transaction.rb → v2payments_processing_information_authorization_options_merchant_initiated_transaction.rb} +224 -224
- data/lib/cyberSource_client/models/v2payments_processing_information_capture_options.rb +267 -267
- data/lib/cyberSource_client/models/v2payments_processing_information_issuer.rb +199 -199
- data/lib/cyberSource_client/models/v2payments_processing_information_recurring_options.rb +198 -198
- data/lib/cyberSource_client/models/v2payments_recipient_information.rb +249 -249
- data/lib/cyberSource_client/models/v2paymentsidcaptures_aggregator_information.rb +233 -233
- data/lib/cyberSource_client/models/v2paymentsidcaptures_aggregator_information_sub_merchant.rb +374 -374
- data/lib/cyberSource_client/models/v2paymentsidcaptures_buyer_information.rb +224 -224
- data/lib/cyberSource_client/models/v2paymentsidcaptures_merchant_information.rb +258 -258
- data/lib/cyberSource_client/models/v2paymentsidcaptures_order_information.rb +230 -230
- data/lib/cyberSource_client/models/v2paymentsidcaptures_order_information_amount_details.rb +546 -546
- data/lib/cyberSource_client/models/v2paymentsidcaptures_order_information_bill_to.rb +449 -449
- data/lib/cyberSource_client/models/v2paymentsidcaptures_order_information_invoice_details.rb +320 -320
- data/lib/cyberSource_client/models/v2paymentsidcaptures_order_information_ship_to.rb +249 -249
- data/lib/cyberSource_client/models/v2paymentsidcaptures_order_information_shipping_details.rb +199 -199
- data/lib/cyberSource_client/models/v2paymentsidcaptures_payment_information.rb +183 -183
- data/lib/cyberSource_client/models/v2paymentsidcaptures_point_of_sale_information.rb +208 -208
- data/lib/cyberSource_client/models/v2paymentsidcaptures_point_of_sale_information_emv.rb +211 -211
- data/lib/cyberSource_client/models/v2paymentsidcaptures_processing_information.rb +351 -351
- data/lib/cyberSource_client/models/v2paymentsidcaptures_processing_information_authorization_options.rb +249 -249
- data/lib/cyberSource_client/models/v2paymentsidcaptures_processing_information_capture_options.rb +242 -242
- data/lib/cyberSource_client/models/v2paymentsidrefunds_merchant_information.rb +258 -258
- data/lib/cyberSource_client/models/v2paymentsidrefunds_order_information.rb +230 -230
- data/lib/cyberSource_client/models/v2paymentsidrefunds_order_information_line_items.rb +639 -639
- data/lib/cyberSource_client/models/v2paymentsidrefunds_payment_information.rb +183 -183
- data/lib/cyberSource_client/models/v2paymentsidrefunds_payment_information_card.rb +374 -374
- data/lib/cyberSource_client/models/v2paymentsidrefunds_point_of_sale_information.rb +183 -183
- data/lib/cyberSource_client/models/v2paymentsidrefunds_processing_information.rb +333 -333
- data/lib/cyberSource_client/models/v2paymentsidrefunds_processing_information_recurring_options.rb +186 -186
- data/lib/cyberSource_client/models/v2paymentsidreversals_client_reference_information.rb +209 -209
- data/lib/cyberSource_client/models/v2paymentsidreversals_order_information.rb +185 -185
- data/lib/cyberSource_client/models/v2paymentsidreversals_order_information_line_items.rb +233 -233
- data/lib/cyberSource_client/models/v2paymentsidreversals_point_of_sale_information.rb +183 -183
- data/lib/cyberSource_client/models/v2paymentsidreversals_processing_information.rb +308 -308
- data/lib/cyberSource_client/models/v2paymentsidreversals_reversal_information.rb +211 -211
- data/lib/cyberSource_client/models/v2paymentsidreversals_reversal_information_amount_details.rb +224 -224
- data/lib/cyberSource_client/models/v2payouts_merchant_information.rb +258 -258
- data/lib/cyberSource_client/models/v2payouts_merchant_information_merchant_descriptor.rb +324 -324
- data/lib/cyberSource_client/models/v2payouts_order_information.rb +192 -192
- data/lib/cyberSource_client/models/v2payouts_order_information_amount_details.rb +249 -249
- data/lib/cyberSource_client/models/v2payouts_order_information_bill_to.rb +443 -443
- data/lib/cyberSource_client/models/v2payouts_payment_information.rb +183 -183
- data/lib/cyberSource_client/models/v2payouts_payment_information_card.rb +299 -299
- data/lib/cyberSource_client/models/v2payouts_processing_information.rb +283 -283
- data/lib/cyberSource_client/models/v2payouts_processing_information_payouts_options.rb +274 -274
- data/lib/cyberSource_client/models/v2payouts_recipient_information.rb +433 -433
- data/lib/cyberSource_client/models/v2payouts_sender_information.rb +517 -517
- data/lib/cyberSource_client/models/v2payouts_sender_information_account.rb +233 -233
- data/lib/cyberSource_client/models/void_capture_request.rb +183 -183
- data/lib/cyberSource_client/models/void_credit_request.rb +183 -183
- data/lib/cyberSource_client/models/void_payment_request.rb +183 -183
- data/lib/cyberSource_client/models/void_refund_request.rb +183 -183
- data/lib/cyberSource_client/version.rb +15 -15
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 229ce8735320b7100ea0c2f48d035d0527c60643892251dc5014e681bed1c3a1
|
4
|
+
data.tar.gz: a1dbe5adef61e8e5c52657b5ac000f62b665bfc81ed2108532a9d7805cd9b7f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01310da0c2b979c0259a65f24b870a5eda03663fc8740a739d01fb27c3890863d04a18c7ec3e69b2bc405ad73b88a72973a068a44c058ec7876162de4e065364
|
7
|
+
data.tar.gz: 8741bdbcbab8d201822a921dc60ce3cf06f1b590136e31ab2f50588bb4e51427c481e0927bbe38f757efc2e09a4417aa4a9c5ca5febc561f68aea18ece02b22f
|
@@ -1,23 +1,23 @@
|
|
1
|
-
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}/**/*")
|
11
|
-
|
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
|
1
|
+
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}/**/*")
|
11
|
+
|
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
|
@@ -1,62 +1,62 @@
|
|
1
|
-
require_relative '../../util/Constants.rb'
|
2
|
-
require_relative '.././payloadDigest/digest.rb'
|
3
|
-
require 'openssl'
|
4
|
-
# This function returns value for paramter Signature which is then passed to Signature header
|
5
|
-
# paramter 'Signature' is calucated based on below key values and then signed with SECRET KEY -
|
6
|
-
# host: Sandbox (apitest.cybersource.com) or Production (api.cybersource.com) hostname
|
7
|
-
# date: "HTTP-date" format as defined by RFC7231.
|
8
|
-
# (request-target): Should be in format of httpMethod: path
|
9
|
-
# Example: "post /pts/v2/payments"
|
10
|
-
# Digest: Only needed for POST calls.
|
11
|
-
# digestString = BASE64( HMAC-SHA256 ( Payload ));
|
12
|
-
# Digest: “SHA-256=“ + digestString;
|
13
|
-
# v-c-merchant-id: set value to Cybersource Merchant ID
|
14
|
-
# This ID can be found on EBC portal*/
|
15
|
-
class SignatureParameter
|
16
|
-
def generateSignatureParameter(merchantconfig_obj, gmtdatetime, log_obj)
|
17
|
-
request_type = merchantconfig_obj.requestType.upcase
|
18
|
-
merchantSecretKey = merchantconfig_obj.merchantSecretKey
|
19
|
-
signatureString = Constants::HOST + ': ' + merchantconfig_obj.requestHost
|
20
|
-
signatureString << "\n"+ Constants::DATE + ': ' + gmtdatetime
|
21
|
-
signatureString << "\n(request-target): "
|
22
|
-
if request_type == Constants::GET_REQUEST_TYPE || request_type == Constants::DELETE_REQUEST_TYPE
|
23
|
-
targetUrl=gettargetUrlForGetDelete(request_type,merchantconfig_obj)
|
24
|
-
signatureString << targetUrl + "\n"
|
25
|
-
elsif request_type == Constants::POST_REQUEST_TYPE || request_type == Constants::PUT_REQUEST_TYPE
|
26
|
-
targetUrl=gettargetUrlForPutPost(request_type,merchantconfig_obj)
|
27
|
-
signatureString << targetUrl + "\n"
|
28
|
-
payload = merchantconfig_obj.requestJsonData
|
29
|
-
digest = DigestGeneration.new.generateDigest(payload, log_obj)
|
30
|
-
digest_payload = Constants::SHA256 + digest
|
31
|
-
signatureString << Constants::DIGEST + ': ' + digest_payload + "\n"
|
32
|
-
end
|
33
|
-
signatureString << Constants::V_C_MERCHANT_ID + ': ' + merchantconfig_obj.merchantId
|
34
|
-
encodedSignatureString = signatureString.force_encoding(Encoding::UTF_8)
|
35
|
-
decodedKey = Base64.decode64(merchantSecretKey)
|
36
|
-
base64EncodedSignature = Base64.strict_encode64(OpenSSL::HMAC.digest('sha256', decodedKey, encodedSignatureString))
|
37
|
-
return base64EncodedSignature
|
38
|
-
rescue StandardError => err
|
39
|
-
log_obj.logger.error(err.message)
|
40
|
-
log_obj.logger.error(err.backtrace)
|
41
|
-
puts 'Check log for more details.'
|
42
|
-
exit!
|
43
|
-
end
|
44
|
-
def gettargetUrlForGetDelete(request_type, merchantconfig_obj)
|
45
|
-
targetUrlForGetDelete = ''
|
46
|
-
if request_type == Constants::DELETE_REQUEST_TYPE
|
47
|
-
targetUrlForGetDelete = Constants::DELETE_REQUEST_TYPE_LOWER + ' ' + merchantconfig_obj.requestTarget
|
48
|
-
elsif request_type == Constants::GET_REQUEST_TYPE
|
49
|
-
targetUrlForGetDelete = Constants::GET_REQUEST_TYPE_LOWER + ' ' + merchantconfig_obj.requestTarget
|
50
|
-
end
|
51
|
-
return targetUrlForGetDelete
|
52
|
-
end
|
53
|
-
def gettargetUrlForPutPost(request_type, merchantconfig_obj)
|
54
|
-
targetUrlForPutPost = ''
|
55
|
-
if request_type == Constants::POST_REQUEST_TYPE
|
56
|
-
targetUrlForPutPost = Constants::POST_REQUEST_TYPE_LOWER + ' ' + merchantconfig_obj.requestTarget
|
57
|
-
elsif request_type == Constants::PUT_REQUEST_TYPE
|
58
|
-
targetUrlForPutPost = Constants::PUT_REQUEST_TYPE_LOWER + ' ' + merchantconfig_obj.requestTarget
|
59
|
-
end
|
60
|
-
return targetUrlForPutPost
|
61
|
-
end
|
62
|
-
end
|
1
|
+
require_relative '../../util/Constants.rb'
|
2
|
+
require_relative '.././payloadDigest/digest.rb'
|
3
|
+
require 'openssl'
|
4
|
+
# This function returns value for paramter Signature which is then passed to Signature header
|
5
|
+
# paramter 'Signature' is calucated based on below key values and then signed with SECRET KEY -
|
6
|
+
# host: Sandbox (apitest.cybersource.com) or Production (api.cybersource.com) hostname
|
7
|
+
# date: "HTTP-date" format as defined by RFC7231.
|
8
|
+
# (request-target): Should be in format of httpMethod: path
|
9
|
+
# Example: "post /pts/v2/payments"
|
10
|
+
# Digest: Only needed for POST calls.
|
11
|
+
# digestString = BASE64( HMAC-SHA256 ( Payload ));
|
12
|
+
# Digest: “SHA-256=“ + digestString;
|
13
|
+
# v-c-merchant-id: set value to Cybersource Merchant ID
|
14
|
+
# This ID can be found on EBC portal*/
|
15
|
+
class SignatureParameter
|
16
|
+
def generateSignatureParameter(merchantconfig_obj, gmtdatetime, log_obj)
|
17
|
+
request_type = merchantconfig_obj.requestType.upcase
|
18
|
+
merchantSecretKey = merchantconfig_obj.merchantSecretKey
|
19
|
+
signatureString = Constants::HOST + ': ' + merchantconfig_obj.requestHost
|
20
|
+
signatureString << "\n"+ Constants::DATE + ': ' + gmtdatetime
|
21
|
+
signatureString << "\n(request-target): "
|
22
|
+
if request_type == Constants::GET_REQUEST_TYPE || request_type == Constants::DELETE_REQUEST_TYPE
|
23
|
+
targetUrl=gettargetUrlForGetDelete(request_type,merchantconfig_obj)
|
24
|
+
signatureString << targetUrl + "\n"
|
25
|
+
elsif request_type == Constants::POST_REQUEST_TYPE || request_type == Constants::PUT_REQUEST_TYPE
|
26
|
+
targetUrl=gettargetUrlForPutPost(request_type,merchantconfig_obj)
|
27
|
+
signatureString << targetUrl + "\n"
|
28
|
+
payload = merchantconfig_obj.requestJsonData
|
29
|
+
digest = DigestGeneration.new.generateDigest(payload, log_obj)
|
30
|
+
digest_payload = Constants::SHA256 + digest
|
31
|
+
signatureString << Constants::DIGEST + ': ' + digest_payload + "\n"
|
32
|
+
end
|
33
|
+
signatureString << Constants::V_C_MERCHANT_ID + ': ' + merchantconfig_obj.merchantId
|
34
|
+
encodedSignatureString = signatureString.force_encoding(Encoding::UTF_8)
|
35
|
+
decodedKey = Base64.decode64(merchantSecretKey)
|
36
|
+
base64EncodedSignature = Base64.strict_encode64(OpenSSL::HMAC.digest('sha256', decodedKey, encodedSignatureString))
|
37
|
+
return base64EncodedSignature
|
38
|
+
rescue StandardError => err
|
39
|
+
log_obj.logger.error(err.message)
|
40
|
+
log_obj.logger.error(err.backtrace)
|
41
|
+
puts 'Check log for more details.'
|
42
|
+
exit!
|
43
|
+
end
|
44
|
+
def gettargetUrlForGetDelete(request_type, merchantconfig_obj)
|
45
|
+
targetUrlForGetDelete = ''
|
46
|
+
if request_type == Constants::DELETE_REQUEST_TYPE
|
47
|
+
targetUrlForGetDelete = Constants::DELETE_REQUEST_TYPE_LOWER + ' ' + merchantconfig_obj.requestTarget
|
48
|
+
elsif request_type == Constants::GET_REQUEST_TYPE
|
49
|
+
targetUrlForGetDelete = Constants::GET_REQUEST_TYPE_LOWER + ' ' + merchantconfig_obj.requestTarget
|
50
|
+
end
|
51
|
+
return targetUrlForGetDelete
|
52
|
+
end
|
53
|
+
def gettargetUrlForPutPost(request_type, merchantconfig_obj)
|
54
|
+
targetUrlForPutPost = ''
|
55
|
+
if request_type == Constants::POST_REQUEST_TYPE
|
56
|
+
targetUrlForPutPost = Constants::POST_REQUEST_TYPE_LOWER + ' ' + merchantconfig_obj.requestTarget
|
57
|
+
elsif request_type == Constants::PUT_REQUEST_TYPE
|
58
|
+
targetUrlForPutPost = Constants::PUT_REQUEST_TYPE_LOWER + ' ' + merchantconfig_obj.requestTarget
|
59
|
+
end
|
60
|
+
return targetUrlForPutPost
|
61
|
+
end
|
62
|
+
end
|
@@ -1,50 +1,50 @@
|
|
1
|
-
require 'base64'
|
2
|
-
require_relative '../../core/ITokenGeneration.rb'
|
3
|
-
require_relative '../../util/Constants.rb'
|
4
|
-
require_relative '../../util/ApiException.rb'
|
5
|
-
require_relative '.././payloadDigest/digest.rb'
|
6
|
-
require_relative '.././http/GetSignatureParameter.rb'
|
7
|
-
public
|
8
|
-
# SignatureHeader return SignatureHeader Value that contains following paramters
|
9
|
-
# * keyid -- Merchant ID obtained from EBC portal
|
10
|
-
# * algorithm -- Should have value as "HmacSHA256"
|
11
|
-
# * headers -- List of all header name passed in the Signature paramter below
|
12
|
-
# String getHeaders = "host date (request-target)" + " " + "v-c-merchant-id";
|
13
|
-
# String postHeaders = "host date (request-target) digest v-c-merchant-id";
|
14
|
-
# Note: Digest is not passed for GET calls
|
15
|
-
# * signature -- Signature header has paramter called signature
|
16
|
-
# Paramter 'Signature' must contain all the paramters mentioned in header above in given order
|
17
|
-
class GenerateHttpSignature
|
18
|
-
# Generates Signature based on the requestType
|
19
|
-
def getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
20
|
-
request_type = merchantconfig_obj.requestType.upcase
|
21
|
-
signatureHeaderValue =''
|
22
|
-
signatureHeaderValue << Constants::KEY_ID + merchantconfig_obj.merchantKeyId + "\""
|
23
|
-
# Algorithm should be always HmacSHA256 for http signature
|
24
|
-
signatureHeaderValue << ', ' + Constants::ALGORITHM + Constants::SIGNATURE_ALGORITHM + "\""
|
25
|
-
# Headers - list is choosen based on HTTP method
|
26
|
-
signatureheader=getsignatureHeader(request_type)
|
27
|
-
signatureHeaderValue << ', ' + Constants::HEADERS_PARAM + signatureheader + "\""
|
28
|
-
# Get Value for parameter 'Signature' to be passed to Signature Header
|
29
|
-
signature_value = SignatureParameter.new.generateSignatureParameter(merchantconfig_obj, gmtdatetime, log_obj)
|
30
|
-
signatureHeaderValue << ', ' + Constants::SIGNATURE_PARAM + signature_value + "\""
|
31
|
-
return signatureHeaderValue
|
32
|
-
rescue StandardError => err
|
33
|
-
ApiException.new.apiexception(err,log_obj)
|
34
|
-
exit!
|
35
|
-
end
|
36
|
-
def getsignatureHeader(request_type)
|
37
|
-
headers = ''
|
38
|
-
if request_type == Constants::POST_REQUEST_TYPE
|
39
|
-
headers = 'host date (request-target) digest ' + Constants::V_C_MERCHANT_ID
|
40
|
-
elsif request_type == Constants::GET_REQUEST_TYPE || request_type == Constants::DELETE_REQUEST_TYPE
|
41
|
-
headers = 'host date (request-target)' + ' ' + Constants::V_C_MERCHANT_ID
|
42
|
-
elsif request_type == Constants::PUT_REQUEST_TYPE
|
43
|
-
headers = 'host date (request-target) digest ' + Constants::V_C_MERCHANT_ID
|
44
|
-
else
|
45
|
-
raise StandardError.new(Constants::ERROR_PREFIX + Constants::INVALID_REQUEST_TYPE_METHOD)
|
46
|
-
end
|
47
|
-
return headers
|
48
|
-
end
|
49
|
-
implements TokenInterface
|
50
|
-
end
|
1
|
+
require 'base64'
|
2
|
+
require_relative '../../core/ITokenGeneration.rb'
|
3
|
+
require_relative '../../util/Constants.rb'
|
4
|
+
require_relative '../../util/ApiException.rb'
|
5
|
+
require_relative '.././payloadDigest/digest.rb'
|
6
|
+
require_relative '.././http/GetSignatureParameter.rb'
|
7
|
+
public
|
8
|
+
# SignatureHeader return SignatureHeader Value that contains following paramters
|
9
|
+
# * keyid -- Merchant ID obtained from EBC portal
|
10
|
+
# * algorithm -- Should have value as "HmacSHA256"
|
11
|
+
# * headers -- List of all header name passed in the Signature paramter below
|
12
|
+
# String getHeaders = "host date (request-target)" + " " + "v-c-merchant-id";
|
13
|
+
# String postHeaders = "host date (request-target) digest v-c-merchant-id";
|
14
|
+
# Note: Digest is not passed for GET calls
|
15
|
+
# * signature -- Signature header has paramter called signature
|
16
|
+
# Paramter 'Signature' must contain all the paramters mentioned in header above in given order
|
17
|
+
class GenerateHttpSignature
|
18
|
+
# Generates Signature based on the requestType
|
19
|
+
def getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
20
|
+
request_type = merchantconfig_obj.requestType.upcase
|
21
|
+
signatureHeaderValue =''
|
22
|
+
signatureHeaderValue << Constants::KEY_ID + merchantconfig_obj.merchantKeyId + "\""
|
23
|
+
# Algorithm should be always HmacSHA256 for http signature
|
24
|
+
signatureHeaderValue << ', ' + Constants::ALGORITHM + Constants::SIGNATURE_ALGORITHM + "\""
|
25
|
+
# Headers - list is choosen based on HTTP method
|
26
|
+
signatureheader=getsignatureHeader(request_type)
|
27
|
+
signatureHeaderValue << ', ' + Constants::HEADERS_PARAM + signatureheader + "\""
|
28
|
+
# Get Value for parameter 'Signature' to be passed to Signature Header
|
29
|
+
signature_value = SignatureParameter.new.generateSignatureParameter(merchantconfig_obj, gmtdatetime, log_obj)
|
30
|
+
signatureHeaderValue << ', ' + Constants::SIGNATURE_PARAM + signature_value + "\""
|
31
|
+
return signatureHeaderValue
|
32
|
+
rescue StandardError => err
|
33
|
+
ApiException.new.apiexception(err,log_obj)
|
34
|
+
exit!
|
35
|
+
end
|
36
|
+
def getsignatureHeader(request_type)
|
37
|
+
headers = ''
|
38
|
+
if request_type == Constants::POST_REQUEST_TYPE
|
39
|
+
headers = 'host date (request-target) digest ' + Constants::V_C_MERCHANT_ID
|
40
|
+
elsif request_type == Constants::GET_REQUEST_TYPE || request_type == Constants::DELETE_REQUEST_TYPE
|
41
|
+
headers = 'host date (request-target)' + ' ' + Constants::V_C_MERCHANT_ID
|
42
|
+
elsif request_type == Constants::PUT_REQUEST_TYPE
|
43
|
+
headers = 'host date (request-target) digest ' + Constants::V_C_MERCHANT_ID
|
44
|
+
else
|
45
|
+
raise StandardError.new(Constants::ERROR_PREFIX + Constants::INVALID_REQUEST_TYPE_METHOD)
|
46
|
+
end
|
47
|
+
return headers
|
48
|
+
end
|
49
|
+
implements TokenInterface
|
50
|
+
end
|
@@ -1,62 +1,62 @@
|
|
1
|
-
require 'base64'
|
2
|
-
require 'openssl'
|
3
|
-
require 'jwt'
|
4
|
-
require 'json'
|
5
|
-
require 'active_support'
|
6
|
-
require_relative '../../core/ITokenGeneration.rb'
|
7
|
-
require_relative '../../util/Constants.rb'
|
8
|
-
require_relative '../../util/ApiException.rb'
|
9
|
-
require_relative '../../util/Cache.rb'
|
10
|
-
require_relative '../../authentication/payloadDigest/digest.rb'
|
11
|
-
public
|
12
|
-
#JWT Token-generated based on the Request type
|
13
|
-
class GenerateJwtToken
|
14
|
-
def getToken(merchantconfig_obj,gmtDatetime,log_obj)
|
15
|
-
jwtBody = ''
|
16
|
-
request_type = merchantconfig_obj.requestType.upcase
|
17
|
-
filePath = merchantconfig_obj.keysDirectory + '/' + merchantconfig_obj.keyFilename + '.p12'
|
18
|
-
if (!File.exist?(filePath))
|
19
|
-
raise Constants::ERROR_PREFIX + Constants::FILE_NOT_FOUND + filePath
|
20
|
-
end
|
21
|
-
p12File = File.binread(filePath)
|
22
|
-
jwtBody=getJwtBody(request_type, gmtDatetime, merchantconfig_obj, log_obj)
|
23
|
-
claimSet = JSON.parse(jwtBody)
|
24
|
-
p12FilePath = OpenSSL::PKCS12.new(p12File, merchantconfig_obj.keyPass)
|
25
|
-
# Generating certificate.
|
26
|
-
cacheObj = ActiveSupport::Cache::MemoryStore.new
|
27
|
-
x5Cert = Cache.new.fetchCachedCertificate(filePath, p12File, merchantconfig_obj.keyPass, cacheObj)
|
28
|
-
# Generating Public key.
|
29
|
-
publicKey = OpenSSL::PKey::RSA.new(p12FilePath.key.public_key)
|
30
|
-
#Generating Private Key
|
31
|
-
privateKey = OpenSSL::PKey::RSA.new(p12FilePath.key)
|
32
|
-
# JWT token-Generates using RS256 algorithm only
|
33
|
-
x5clist = [x5Cert]
|
34
|
-
customHeaders = {}
|
35
|
-
customHeaders['v-c-merchant-id'] = merchantconfig_obj.keyAlias
|
36
|
-
customHeaders['x5c'] = x5clist
|
37
|
-
# Generating JWT token
|
38
|
-
token = JWT.encode(claimSet, privateKey, 'RS256', customHeaders)
|
39
|
-
return token
|
40
|
-
rescue StandardError => err
|
41
|
-
if err.message.include? 'PKCS12_parse: mac verify failure'
|
42
|
-
ApiException.new.customerror(Constants::ERROR_PREFIX + Constants::INCORRECT_KEY_PASS,log_obj)
|
43
|
-
exit!
|
44
|
-
else
|
45
|
-
ApiException.new.apiexception(err,log_obj)
|
46
|
-
exit!
|
47
|
-
end
|
48
|
-
end
|
49
|
-
def getJwtBody(request_type, gmtDatetime, merchantconfig_obj,log_obj)
|
50
|
-
if request_type == Constants::POST_REQUEST_TYPE || request_type == Constants::PUT_REQUEST_TYPE
|
51
|
-
payload = merchantconfig_obj.requestJsonData
|
52
|
-
# Note: Digest is not passed for GET calls
|
53
|
-
digest = DigestGeneration.new.generateDigest(payload, log_obj)
|
54
|
-
jwtBody = "{\n \"digest\":\"" + digest + "\", \"digestAlgorithm\":\"SHA-256\", \"iat\":\"" + gmtDatetime + "\"}"
|
55
|
-
elsif request_type == Constants::GET_REQUEST_TYPE || request_type == Constants::DELETE_REQUEST_TYPE
|
56
|
-
jwtBody = "{\n \"iat\":\"" + gmtDatetime + "\"\n} \n\n"
|
57
|
-
else
|
58
|
-
raise StandardError.new(Constants::ERROR_PREFIX + Constants::INVALID_REQUEST_TYPE_METHOD)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
implements TokenInterface
|
62
|
-
end
|
1
|
+
require 'base64'
|
2
|
+
require 'openssl'
|
3
|
+
require 'jwt'
|
4
|
+
require 'json'
|
5
|
+
require 'active_support'
|
6
|
+
require_relative '../../core/ITokenGeneration.rb'
|
7
|
+
require_relative '../../util/Constants.rb'
|
8
|
+
require_relative '../../util/ApiException.rb'
|
9
|
+
require_relative '../../util/Cache.rb'
|
10
|
+
require_relative '../../authentication/payloadDigest/digest.rb'
|
11
|
+
public
|
12
|
+
#JWT Token-generated based on the Request type
|
13
|
+
class GenerateJwtToken
|
14
|
+
def getToken(merchantconfig_obj,gmtDatetime,log_obj)
|
15
|
+
jwtBody = ''
|
16
|
+
request_type = merchantconfig_obj.requestType.upcase
|
17
|
+
filePath = merchantconfig_obj.keysDirectory + '/' + merchantconfig_obj.keyFilename + '.p12'
|
18
|
+
if (!File.exist?(filePath))
|
19
|
+
raise Constants::ERROR_PREFIX + Constants::FILE_NOT_FOUND + filePath
|
20
|
+
end
|
21
|
+
p12File = File.binread(filePath)
|
22
|
+
jwtBody=getJwtBody(request_type, gmtDatetime, merchantconfig_obj, log_obj)
|
23
|
+
claimSet = JSON.parse(jwtBody)
|
24
|
+
p12FilePath = OpenSSL::PKCS12.new(p12File, merchantconfig_obj.keyPass)
|
25
|
+
# Generating certificate.
|
26
|
+
cacheObj = ActiveSupport::Cache::MemoryStore.new
|
27
|
+
x5Cert = Cache.new.fetchCachedCertificate(filePath, p12File, merchantconfig_obj.keyPass, cacheObj)
|
28
|
+
# Generating Public key.
|
29
|
+
publicKey = OpenSSL::PKey::RSA.new(p12FilePath.key.public_key)
|
30
|
+
#Generating Private Key
|
31
|
+
privateKey = OpenSSL::PKey::RSA.new(p12FilePath.key)
|
32
|
+
# JWT token-Generates using RS256 algorithm only
|
33
|
+
x5clist = [x5Cert]
|
34
|
+
customHeaders = {}
|
35
|
+
customHeaders['v-c-merchant-id'] = merchantconfig_obj.keyAlias
|
36
|
+
customHeaders['x5c'] = x5clist
|
37
|
+
# Generating JWT token
|
38
|
+
token = JWT.encode(claimSet, privateKey, 'RS256', customHeaders)
|
39
|
+
return token
|
40
|
+
rescue StandardError => err
|
41
|
+
if err.message.include? 'PKCS12_parse: mac verify failure'
|
42
|
+
ApiException.new.customerror(Constants::ERROR_PREFIX + Constants::INCORRECT_KEY_PASS,log_obj)
|
43
|
+
exit!
|
44
|
+
else
|
45
|
+
ApiException.new.apiexception(err,log_obj)
|
46
|
+
exit!
|
47
|
+
end
|
48
|
+
end
|
49
|
+
def getJwtBody(request_type, gmtDatetime, merchantconfig_obj,log_obj)
|
50
|
+
if request_type == Constants::POST_REQUEST_TYPE || request_type == Constants::PUT_REQUEST_TYPE
|
51
|
+
payload = merchantconfig_obj.requestJsonData
|
52
|
+
# Note: Digest is not passed for GET calls
|
53
|
+
digest = DigestGeneration.new.generateDigest(payload, log_obj)
|
54
|
+
jwtBody = "{\n \"digest\":\"" + digest + "\", \"digestAlgorithm\":\"SHA-256\", \"iat\":\"" + gmtDatetime + "\"}"
|
55
|
+
elsif request_type == Constants::GET_REQUEST_TYPE || request_type == Constants::DELETE_REQUEST_TYPE
|
56
|
+
jwtBody = "{\n \"iat\":\"" + gmtDatetime + "\"\n} \n\n"
|
57
|
+
else
|
58
|
+
raise StandardError.new(Constants::ERROR_PREFIX + Constants::INVALID_REQUEST_TYPE_METHOD)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
implements TokenInterface
|
62
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'digest'
|
2
|
-
public
|
3
|
-
# This method return Digest value which is SHA-256
|
4
|
-
# hash of payload that is BASE64 encoded
|
5
|
-
class DigestGeneration
|
6
|
-
def generateDigest(payload, log_obj)
|
7
|
-
digest = Digest::SHA256.base64digest(payload)
|
8
|
-
return digest
|
9
|
-
end
|
10
|
-
end
|
1
|
+
require 'digest'
|
2
|
+
public
|
3
|
+
# This method return Digest value which is SHA-256
|
4
|
+
# hash of payload that is BASE64 encoded
|
5
|
+
class DigestGeneration
|
6
|
+
def generateDigest(payload, log_obj)
|
7
|
+
digest = Digest::SHA256.base64digest(payload)
|
8
|
+
return digest
|
9
|
+
end
|
10
|
+
end
|
@@ -1,24 +1,24 @@
|
|
1
|
-
require_relative '../authentication/http/HttpSignatureHeader.rb'
|
2
|
-
require_relative '../authentication/jwt/JwtToken.rb'
|
3
|
-
require_relative '../util/Constants.rb'
|
4
|
-
require_relative '../util/ApiException.rb'
|
5
|
-
public
|
6
|
-
# This function calls for the generation of Signature message depending on the authentication type.
|
7
|
-
class Authorization
|
8
|
-
def getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
9
|
-
authenticationType = merchantconfig_obj.authenticationType.upcase
|
10
|
-
if merchantconfig_obj.requestType.to_s.empty?
|
11
|
-
raise StandardError.new(Constants::ERROR_PREFIX + Constants::REQUEST_TYPE_EMPTY)
|
12
|
-
end
|
13
|
-
if authenticationType == Constants::AUTH_TYPE_HTTP
|
14
|
-
token = GenerateHttpSignature.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
15
|
-
elsif authenticationType == Constants::AUTH_TYPE_JWT
|
16
|
-
token = GenerateJwtToken.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
17
|
-
elsif authenticationType != Constants::AUTH_TYPE_HTTP || authenticationType != Constants::AUTH_TYPE_JWT
|
18
|
-
raise StandardError.ner(Constants::ERROR_PREFIX + Constants::AUTH_ERROR)
|
19
|
-
end
|
20
|
-
rescue StandardError => err
|
21
|
-
ApiException.new.apiexception(err,log_obj)
|
22
|
-
exit!
|
23
|
-
end
|
24
|
-
end
|
1
|
+
require_relative '../authentication/http/HttpSignatureHeader.rb'
|
2
|
+
require_relative '../authentication/jwt/JwtToken.rb'
|
3
|
+
require_relative '../util/Constants.rb'
|
4
|
+
require_relative '../util/ApiException.rb'
|
5
|
+
public
|
6
|
+
# This function calls for the generation of Signature message depending on the authentication type.
|
7
|
+
class Authorization
|
8
|
+
def getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
9
|
+
authenticationType = merchantconfig_obj.authenticationType.upcase
|
10
|
+
if merchantconfig_obj.requestType.to_s.empty?
|
11
|
+
raise StandardError.new(Constants::ERROR_PREFIX + Constants::REQUEST_TYPE_EMPTY)
|
12
|
+
end
|
13
|
+
if authenticationType == Constants::AUTH_TYPE_HTTP
|
14
|
+
token = GenerateHttpSignature.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
15
|
+
elsif authenticationType == Constants::AUTH_TYPE_JWT
|
16
|
+
token = GenerateJwtToken.new.getToken(merchantconfig_obj, gmtdatetime, log_obj)
|
17
|
+
elsif authenticationType != Constants::AUTH_TYPE_HTTP || authenticationType != Constants::AUTH_TYPE_JWT
|
18
|
+
raise StandardError.ner(Constants::ERROR_PREFIX + Constants::AUTH_ERROR)
|
19
|
+
end
|
20
|
+
rescue StandardError => err
|
21
|
+
ApiException.new.apiexception(err,log_obj)
|
22
|
+
exit!
|
23
|
+
end
|
24
|
+
end
|