Skip to content

Commit 24d6078

Browse files
committed
customer profile services
1 parent af6e63f commit 24d6078

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-1
lines changed

paynova_api_python_client/paynova.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,25 @@ def refund_payment(self, params):
128128
Refund Payment
129129
Docs: http://docs.paynova.com/display/API/Refund+Payment
130130
"""
131-
return self.request('POST', 'transactions/{transactionId}/refund/{totalAmount}', params)
131+
return self.request('POST', 'transactions/{transactionId}/refund/{totalAmount}', params)
132+
133+
def get_customer_profile(self, params):
134+
"""
135+
Get Customer Profile
136+
Docs: http://docs.paynova.com/display/API/Get+Customer+Profile
137+
"""
138+
return self.request('GET', 'customerprofiles/{profileId}', params)
139+
140+
def remove_customer_profile(self, params):
141+
"""
142+
Remove Customer Profile
143+
Docs: http://docs.paynova.com/display/API/Remove+Customer+Profile
144+
"""
145+
return self.request('DELETE', 'customerprofiles/{profileId}', params)
146+
147+
def remove_customer_profile_card(self, params):
148+
"""
149+
Remove Customer Profile Card
150+
Docs: http://docs.paynova.com/display/API/Remove+Customer+Profile+Card
151+
"""
152+
return self.request('DELETE', 'customerprofiles/{profileId}/cards/{cardId}', params)

tests/test_paynova_services.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,23 @@ def success(content=None):
7272
'batchId': 'batch'
7373
})
7474

75+
# get customer profile
76+
77+
elif url[2] == '/api/customerprofiles/1':
78+
return success({
79+
'profileId': '1'
80+
})
81+
82+
# remove customer profile
83+
84+
elif url[2] == '/api/customerprofiles/1' and request.method == 'DELETE':
85+
return success()
86+
87+
# remove customer profile card
88+
89+
elif url[2] == '/api/customerprofiles/1/cards/1' and request.method == 'DELETE':
90+
return success()
91+
7592
return {'status_code': 404}
7693

7794

@@ -132,3 +149,28 @@ def test_refund_payment(self):
132149
expect(response.get('transactionId')).to_equal('0001')
133150
expect(response.get('batchId')).to_equal('batch')
134151

152+
def test_get_customer_profile(self):
153+
with HTTMock(paynova_mock):
154+
params = {
155+
'profileId': '1'
156+
}
157+
response = self.paynova.get_customer_profile(params)
158+
expect(response).not_to_be_null()
159+
expect(response.get('profileId')).to_equal('1')
160+
161+
def test_remove_customer_profile(self):
162+
with HTTMock(paynova_mock):
163+
params = {
164+
'profileId': '1'
165+
}
166+
response = self.paynova.remove_customer_profile(params)
167+
expect(response).not_to_be_null()
168+
169+
def test_remove_customer_profile_card(self):
170+
with HTTMock(paynova_mock):
171+
params = {
172+
'profileId': '1',
173+
'cardId': '1'
174+
}
175+
response = self.paynova.remove_customer_profile_card(params)
176+
expect(response).not_to_be_null()

0 commit comments

Comments
 (0)