hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

feat(opensearch): refactoring

Open ivor11 opened this issue 1 year ago • 2 comments

Type of Change

  • [ ] Bugfix
  • [ ] New feature
  • [ ] Enhancement
  • [x] Refactoring
  • [ ] Dependency updates
  • [ ] Documentation
  • [ ] CI/CD

Description

refactoring opensearch to module structure

Additional Changes

  • [ ] This PR modifies the API contract
  • [ ] This PR modifies the database schema
  • [ ] This PR modifies application configuration/environment variables

Motivation and Context

refactoring

How did you test it?

test cases added below

Checklist

  • [x] I formatted the code cargo +nightly fmt --all
  • [x] I addressed lints thrown by cargo clippy
  • [x] I reviewed the submitted code
  • [ ] I added unit tests for my changes where possible
  • [ ] I added a CHANGELOG entry if applicable

ivor11 avatar Mar 28 '24 08:03 ivor11

curl --location --request POST 'http://localhost:8080/analytics/v1/search' \
--header 'api-key: hyperswitch' \
--header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNTUwOTc1ZjItNTljOS00OWNlLTk1YWEtNTQ1ZDIyOWY2NWUzIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzA5MDIxNzI4Iiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTcxMjMwNDcyNywib3JnX2lkIjoib3JnX1VkY1B0dTZLTXEyc0dRZGZjUHh0In0.fSvYSUPZwpnxmUae1JtX3YRPxurxjCpb5Yk8vRCU8AM' \
--header 'content-type: application/json' \
--data-raw '{
    "query": "usd",   
    "offset": 0,
    "count": 10
}'
[{"count":1,"index":"payment_attempts","hits":[{"payment_id":"pay_YZ6cvIRVGuor0UQbbpwK","merchant_id":"merchant_1711523270","attempt_id":"pay_YZ6cvIRVGuor0UQbbpwK_1","status":"failure","amount":6540,"currency":"USD","save_to_locker":null,"connector":"stripe","error_message":"No error message","offer_amount":null,"surcharge_amount":null,"tax_amount":null,"payment_method_id":null,"payment_method":"card","connector_transaction_id":null,"capture_method":"automatic","capture_on":1662804672,"confirm":true,"authentication_type":"no_three_ds","created_at":1711957023,"modified_at":1711957025,"last_synced":1711957023,"cancellation_reason":null,"amount_to_capture":6540,"mandate_id":null,"browser_info":null,"error_code":"No error code","connector_metadata":null,"payment_experience":null,"payment_method_type":"credit","payment_method_data":"{\"card\":{\"last4\":\"4242\",\"bank_code\":null,\"card_isin\":\"424242\",\"card_type\":null,\"card_issuer\":null,\"card_network\":null,\"card_exp_year\":\"25\",\"card_exp_month\":\"10\",\"payment_checks\":null,\"card_holder_name\":\"joseph Doe\",\"card_extended_bin\":\"42424242\",\"authentication_data\":null,\"card_issuing_country\":null}}","error_reason":"You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY'). See https://stripe.com/docs/api#authentication for details, or we can help at https://support.stripe.com/.","multiple_capture_count":null,"amount_capturable":0,"merchant_connector_id":"mca_sXQz50iTACoIT3f08fBo","net_amount":6540,"unified_code":null,"unified_message":null,"mandate_data":null,"sign_flag":1}]},{"count":1,"index":"payment_intents","hits":[{"payment_id":"pay_YZ6cvIRVGuor0UQbbpwK","merchant_id":"merchant_1711523270","status":"failed","amount":6540,"currency":"USD","amount_captured":null,"customer_id":"StripeCustomer","description":"Its my first payment request","return_url":"https://google.com/","connector_id":null,"statement_descriptor_name":"joseph","statement_descriptor_suffix":"JS","created_at":1711957023,"modified_at":1711957025,"last_synced":1711957023,"setup_future_usage":null,"off_session":null,"client_secret":"pay_YZ6cvIRVGuor0UQbbpwK_secret_qxf5k89plfKfbpEXiPSb","active_attempt_id":"pay_YZ6cvIRVGuor0UQbbpwK_1","business_country":"US","business_label":"default","attempt_count":1,"sign_flag":1}]}, {"count":0,"index":"refunds","hits":[]},{"count":0,"index":"disputes","hits":[]}]

ivor11 avatar Apr 03 '24 10:04 ivor11

curl 'http://localhost:8080/health/ready'
{"database":true,"redis":true,"analytics":true,"opensearch":true,"outgoing_request":true}

ivor11 avatar Apr 03 '24 10:04 ivor11