Skip to content

Commit 6e05dc2

Browse files
Merge pull request #1 from mdminhazulhaque/claude/update-readme-fields-rd4Qy
Update README with field specifications
2 parents fdc6831 + bc6cde4 commit 6e05dc2

2 files changed

Lines changed: 35 additions & 15 deletions

File tree

README.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,9 @@ $ dpdc-cli get-balance -c 1234567890
7272
**Sample Output:**
7373
```
7474
accountId 1234567890
75-
customerName MD. JOHN DOE
76-
customerClass Residential
77-
mobileNumber 01712345678
78-
emailId customer@example.com
79-
accountType Prepaid
75+
accountType Pre Paid
8076
balanceRemaining 1250.50
8177
connectionStatus Active
82-
customerType Domestic
83-
minRecharge 100
8478
```
8579

8680
### 👤 Get Customer Information
@@ -97,12 +91,6 @@ accountId 1234567890
9791
customerName MD. JOHN DOE
9892
customerClass Residential
9993
mobileNumber 01712345678
100-
emailId customer@example.com
101-
accountType Prepaid
102-
balanceRemaining 1250.50
103-
connectionStatus Active
104-
customerType Domestic
105-
minRecharge 100
10694
```
10795

10896
## 🛠️ Development

dpdc/dpdc.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,11 @@ def get_balance(self) -> List[List[str]]:
144144
data = []
145145
if 'data' in response and 'postBalanceDetails' in response['data']:
146146
balance_details = response['data']['postBalanceDetails']
147+
# Filter to show only specific fields for balance
148+
allowed_fields = ['accountId', 'accountType', 'balanceRemaining', 'connectionStatus']
147149
for key, value in balance_details.items():
148-
data.append([key, str(value) if value is not None else ''])
150+
if key in allowed_fields:
151+
data.append([key, str(value) if value is not None else ''])
149152

150153
return data
151154

@@ -159,4 +162,33 @@ def get_customer_info(self) -> List[List[str]]:
159162
Returns:
160163
List[List[str]]: A list of [key, value] pairs containing customer information
161164
"""
162-
return self.get_balance()
165+
query = f"""query{{
166+
postBalanceDetails(input: {{
167+
customerNumber: "{self.customer_number}",
168+
tenantCode: "{self.TENANT_CODE}"
169+
}}) {{
170+
accountId
171+
customerName
172+
customerClass
173+
mobileNumber
174+
emailId
175+
accountType
176+
balanceRemaining
177+
connectionStatus
178+
customerType
179+
minRecharge
180+
}}
181+
}}"""
182+
183+
response = self._make_graphql_request(query)
184+
185+
data = []
186+
if 'data' in response and 'postBalanceDetails' in response['data']:
187+
balance_details = response['data']['postBalanceDetails']
188+
# Filter to show only specific fields for customer info
189+
allowed_fields = ['accountId', 'customerName', 'customerClass', 'mobileNumber']
190+
for key, value in balance_details.items():
191+
if key in allowed_fields:
192+
data.append([key, str(value) if value is not None else ''])
193+
194+
return data

0 commit comments

Comments
 (0)