fix(dispute): change dispute currency type to currency enum
Type of Change
- [x] Bugfix
- [ ] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
Changed Dispute Currency from String to ENUM.
Webhook testing:
curl --location 'http://localhost:8080/webhooks/merchant_1731037648/mca_X1y5O8y5i29CXmimByPp' \ --header 'stripe-signature: t=1730987258,v1=a14fb764daad587d06d78bc3fe89c2321d4b1ea6309b2f479d497878d440e612,v0=34aeb90ac51a48cdba1808317706ee2a1ef72b8b569d89ad907bec62d167caca' \ --header 'Content-Type: application/json' \ --data '{ "id": "evt_1QIW3iD5R7gDAGffqLkKU7uK", "object": "event", "api_version": "2022-11-15", "created": 1730987257, "data": { "object": { "id": "dp_1QIW3hD5R7gDAGffIDgTp3hd", "object": "dispute", "amount": 100, "balance_transaction": null, "balance_transactions": [], "charge": "ch_3QIW3hD5R7gDAGff1ZNgFNL9", "created": 1730987257, "currency": "usd", "enhanced_eligibility_types": [], "evidence": { "access_activity_log": null, "billing_address": null, "cancellation_policy": null, "cancellation_policy_disclosure": null, "cancellation_rebuttal": null, "customer_communication": null, "customer_email_address": null, "customer_name": null, "customer_purchase_ip": null, "customer_signature": null, "duplicate_charge_documentation": null, "duplicate_charge_explanation": null, "duplicate_charge_id": null, "enhanced_evidence": {}, "product_description": null, "receipt": null, "refund_policy": null, "refund_policy_disclosure": null, "refund_refusal_explanation": null, "service_date": null, "service_documentation": null, "shipping_address": null, "shipping_carrier": null, "shipping_date": null, "shipping_documentation": null, "shipping_tracking_number": null, "uncategorized_file": null, "uncategorized_text": null }, "evidence_details": { "due_by": 1731801599, "enhanced_eligibility": {}, "has_evidence": false, "past_due": false, "submission_count": 0 }, "is_charge_refundable": true, "livemode": false, "metadata": {}, "payment_intent": "pi_3QIjEqD5R7gDAGff1hTCMHyE", "payment_method_details": { "card": { "brand": "visa", "case_type": "inquiry", "network_reason_code": "10" }, "type": "card" }, "reason": "fraudulent", "status": "warning_needs_response" } }, "livemode": false, "pending_webhooks": 12, "request": { "id": "req_LYPj1MWBqlb5QS", "idempotency_key": "7469f2e2-fe9f-4c8d-b863-cf7d4d7e325c" }, "type": "charge.dispute.created" }'
Connectors that returns uppercase currency but implemented as String: Airwallex, Braintree, Checkout, TrustPay and lowercase currency("usd"): Stripe
Migration query to be run before running up.sql:
UPDATE dispute SET currency = UPPER(currency);
Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
Motivation and Context
How did you test it?
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
Changed Files
Can you please post a Kafka message which is being pushed as the sample log as well please