Skip to content

Commit

Permalink
customer profile services
Browse files Browse the repository at this point in the history
  • Loading branch information
akolpakov committed Feb 25, 2015
1 parent af6e63f commit 24d6078
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
23 changes: 22 additions & 1 deletion paynova_api_python_client/paynova.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,25 @@ def refund_payment(self, params):
Refund Payment
Docs: http://docs.paynova.com/display/API/Refund+Payment
"""
return self.request('POST', 'transactions/{transactionId}/refund/{totalAmount}', params)
return self.request('POST', 'transactions/{transactionId}/refund/{totalAmount}', params)

def get_customer_profile(self, params):
"""
Get Customer Profile
Docs: http://docs.paynova.com/display/API/Get+Customer+Profile
"""
return self.request('GET', 'customerprofiles/{profileId}', params)

def remove_customer_profile(self, params):
"""
Remove Customer Profile
Docs: http://docs.paynova.com/display/API/Remove+Customer+Profile
"""
return self.request('DELETE', 'customerprofiles/{profileId}', params)

def remove_customer_profile_card(self, params):
"""
Remove Customer Profile Card
Docs: http://docs.paynova.com/display/API/Remove+Customer+Profile+Card
"""
return self.request('DELETE', 'customerprofiles/{profileId}/cards/{cardId}', params)
42 changes: 42 additions & 0 deletions tests/test_paynova_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,23 @@ def success(content=None):
'batchId': 'batch'
})

# get customer profile

elif url[2] == '/api/customerprofiles/1':
return success({
'profileId': '1'
})

# remove customer profile

elif url[2] == '/api/customerprofiles/1' and request.method == 'DELETE':
return success()

# remove customer profile card

elif url[2] == '/api/customerprofiles/1/cards/1' and request.method == 'DELETE':
return success()

return {'status_code': 404}


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

def test_get_customer_profile(self):
with HTTMock(paynova_mock):
params = {
'profileId': '1'
}
response = self.paynova.get_customer_profile(params)
expect(response).not_to_be_null()
expect(response.get('profileId')).to_equal('1')

def test_remove_customer_profile(self):
with HTTMock(paynova_mock):
params = {
'profileId': '1'
}
response = self.paynova.remove_customer_profile(params)
expect(response).not_to_be_null()

def test_remove_customer_profile_card(self):
with HTTMock(paynova_mock):
params = {
'profileId': '1',
'cardId': '1'
}
response = self.paynova.remove_customer_profile_card(params)
expect(response).not_to_be_null()

0 comments on commit 24d6078

Please sign in to comment.