Skip to content

Conversation

@PayManiRazor
Copy link
Contributor

  • Add DeviceActivity resource with create() and get_status() methods
  • Support PUBLIC authentication for DeviceActivity APIs
  • Add X-Razorpay-Device-Mode header injection for wired/wireless modes
  • Add DeviceMode constants (WIRED, WIRELESS)
  • Enhance Client to support public_auth parameter
  • Add comprehensive test coverage and mock responses
  • Fix test_multiple_client URL mismatch
  • Maintain backward compatibility with existing APIs

Endpoints:

  • POST /v1/devices/activity (create device activity)
  • GET /v1/devices/activity/{id} (get activity status)

Usage:
client = razorpay.Client(auth=(...), public_auth=(...)) client.device_activity.create(data, mode='wired')
client.device_activity.get_status('act_123', mode='wireless')

Note :- Please follow the below points while attaching test cases document link below:

- If label Tested is added then test cases document URL is mandatory.

- Link added should be a valid URL and accessible throughout the org.

- If the branch name contains hotfix / revert by default the BVT workflow check will pass.

Test Case Document URL
Please paste test case document link here....

- Add DeviceActivity resource with create() and get_status() methods
- Support PUBLIC authentication for DeviceActivity APIs
- Add X-Razorpay-Device-Mode header injection for wired/wireless modes
- Add DeviceMode constants (WIRED, WIRELESS)
- Enhance Client to support public_auth parameter
- Add comprehensive test coverage and mock responses
- Fix test_multiple_client URL mismatch
- Maintain backward compatibility with existing APIs

Endpoints:
- POST /v1/devices/activity (create device activity)
- GET /v1/devices/activity/{id} (get activity status)

Usage:
client = razorpay.Client(auth=(...), public_auth=(...))
client.device_activity.create(data, mode='wired')
client.device_activity.get_status('act_123', mode='wireless')
}

def __init__(self, session=None, auth=None, **options):
def __init__(self, session=None, auth=None, public_auth=None, **options):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't make sense, auth already contains the public key, should directly use from there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first, I thought the integration team would create only one client, so I added a field to separate the auth. Removed this now, integration team will create two different client (one for public auth for activity related API and other for private auth for Order related APIs)

if not activity_id:
raise BadRequestError("Activity ID must be provided")

device_mode = None

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be extracted as separate method

@PayManiRazor PayManiRazor changed the title feat: Add DeviceActivity support for POS Gateway integration feat:ISS-971955 Add DeviceActivity support for POS Gateway integration Aug 26, 2025
@PayManiRazor PayManiRazor changed the title feat:ISS-971955 Add DeviceActivity support for POS Gateway integration feat: ISS-971955 Add DeviceActivity support for POS Gateway integration Aug 26, 2025
@PayManiRazor PayManiRazor changed the title feat: ISS-971955 Add DeviceActivity support for POS Gateway integration feat: Add DeviceActivity support for POS Gateway integration Aug 26, 2025
@PayManiRazor PayManiRazor changed the title feat: Add DeviceActivity support for POS Gateway integration ISS-971955 feat: Add DeviceActivity support for POS Gateway integration Aug 26, 2025
- Remove public_auth complexity from Client class
- Use standard HTTP Basic Auth for all APIs instead of dual auth system
- Refactor DeviceActivity to use single authentication approach
- Extract device mode validation into reusable private method
- Update tests to use simplified client initialization
- Maintain backward compatibility while reducing authentication complexity
- Modified client.py to use use_public_auth parameter for authentication type selection
- When use_public_auth=True, only key_id is used for authentication (empty key_secret)
- Device APIs in device_activity.py now automatically pass use_public_auth=True
- Regular APIs continue using full authentication (use_public_auth=False by default)
- Single client can handle both device APIs and regular APIs seamlessly
- Updated tests to reflect new authentication approach
- No breaking changes to existing API usage
@PayManiRazor PayManiRazor added the TestingNotRequired TestingNotRequired label for BVT label Aug 27, 2025
@PayManiRazor PayManiRazor merged commit c1a9b4d into master Aug 27, 2025
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

TestingNotRequired TestingNotRequired label for BVT

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants