Skip to content

Commit addb59b

Browse files
authored
Merge pull request #22 from davidbankes/payeezy-json-api
payeezy updated to supported JSON api
2 parents c0123a0 + 68509e5 commit addb59b

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: php
22

33
php:
4-
- 5.3
54
- 5.4
65
- 5.5
76
- 5.6

src/Message/PayeezyAbstractRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ protected function getHeaders()
209209
{
210210
return array(
211211
'Content-Type' => self::CONTENT_TYPE,
212-
'Accept' => 'text/html'
212+
'Accept' => 'application/json'
213213
);
214214
}
215215

src/Message/PayeezyResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PayeezyResponse extends AbstractResponse
2525
public function __construct(RequestInterface $request, $data)
2626
{
2727
$this->request = $request;
28-
parse_str($data, $this->data);
28+
$this->data = json_decode($data, true);
2929
}
3030

3131
public function isSuccessful()

tests/Message/PayeezyPurchaseResponseTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class PayeezyPurchaseResponseTest extends TestCase
99
{
1010
public function testPurchaseSuccess()
1111
{
12-
$response = new PayeezyResponse($this->getMockRequest(), http_build_query(array(
12+
$response = new PayeezyResponse($this->getMockRequest(), json_encode(array(
1313
'amount' => 1000,
1414
'exact_resp_code' => 00,
1515
'exact_message' => 'Transaction Normal',
@@ -26,7 +26,7 @@ public function testPurchaseSuccess()
2626

2727
public function testPurchaseError()
2828
{
29-
$response = new PayeezyResponse($this->getMockRequest(), http_build_query(array(
29+
$response = new PayeezyResponse($this->getMockRequest(), json_encode(array(
3030
'amount' => 1000,
3131
'exact_resp_code' => 22,
3232
'exact_message' => 'Invalid Credit Card Number',
@@ -43,7 +43,7 @@ public function testPurchaseError()
4343

4444
public function testBankError()
4545
{
46-
$response = new PayeezyResponse($this->getMockRequest(), http_build_query(array(
46+
$response = new PayeezyResponse($this->getMockRequest(), json_encode(array(
4747
'amount' => 1000,
4848
'exact_resp_code' => 00,
4949
'reference_no' => 'abc123',
@@ -55,5 +55,4 @@ public function testBankError()
5555
$this->assertEquals('::', $response->getTransactionReference());
5656
$this->assertEquals('00', $response->getCode());
5757
}
58-
5958
}

tests/Mock/PurchaseSuccess.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ HTTP/1.1 201 OK
22
Date: Tue, 11 Feb 2014 02:34:58 GMT
33
Content-type: text/html; charset=utf-8
44

5-
account_number=&amount=13.0&amount_requested=&authorization=&authorization_num=ET181147&avs=1&bank_id=&bank_message=Approved&bank_resp_code=100&bank_resp_code_2=&card_cost=&cardholder_name=Example+User&cavv=&cavv_algorithm=&cavv_response=&cc_expiry=0318&cc_number=%23%23%23%23%23%23%23%23%23%23%23%231111&cc_verification_str1=123+Billing+St%7C12345%7CBillstown%7CCA%7CUS&cc_verification_str2=208&check_number=&check_type=&clerk_id=&client_email=&client_ip=104.36.244.246&correlation_id=&credit_card_type=Visa&ctr=%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D+TRANSACTION+RECORD+%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0APriceWaiter+DEMO0243%0A426+Market+St%0AChattenooga%2C+TN+37402%0AUnited+States%0Ahttps%3A%2F%2Fwww.pricewaiter.com%2F%0A%0ATYPE%3A+Purchase%0A%0AACCT%3A+Visa++%24+13.00+USD%0A%0ACARDHOLDER+NAME+%3A+Example+User%0ACARD+NUMBER+++++%3A+%23%23%23%23%23%23%23%23%23%23%23%231111%0ADATE%2FTIME+++++++%3A+11+Aug+14+14%3A09%3A06%0AREFERENCE+%23+++++%3A++000056+M%0AAUTHOR.+%23+++++++%3A+ET181147%0ATRANS.+REF.+++++%3A+order2%0A%0A++++Approved+-+Thank+You+100%0A%0A%0APlease+retain+this+copy+for+your+records.%0A%0ACardholder+will+pay+above+amount+to+card%0Aissuer+pursuant+to+cardholder+agreement.%0A%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D&currency_code=USD&current_balance=&customer_id_number=&customer_id_type=&customer_name=&customer_ref=&cvd_presence_ind=0&cvv2=N&date_of_birth=&device_id=&ean=&ecommerce_flag=&error_description=&error_number=&exact_message=Transaction+Normal&exact_resp_code=00&fraud_suspected=&gateway_id=AF8163-05&gift_card_amount=&gross_amount_currency_id=&language=&logon_message=&merchant_address=426+Market+St&merchant_city=Chattenooga&merchant_country=United+States&merchant_name=PriceWaiter+DEMO0243&merchant_postal=37402&merchant_province=Tennessee&merchant_url=https%3A%2F%2Fwww.pricewaiter.com%2F&message=&micr=&pan=&partial_redemption=0&password=&payer_id=&previous_balance=&reference_3=&reference_no=order2&registration_date=&registration_no=&release_type=&retrieval_ref_no=7775501&secure_auth_required=&secure_auth_result=&sequence_no=000056&success=&surcharge_amount=&tax1_amount=&tax1_number=&tax2_amount=&tax2_number=&timestamp=&track1=&track2=&transaction_approved=1&transaction_error=0&transaction_tag=28513493&transaction_type=00&transarmor_token=&user_name=&vip=&virtual_card=&xid=&zip_code=
5+
{"account_number":"","amount":"13.0","amount_requested":"","authorization":"","authorization_num":"ET181147","avs":"1","bank_id":"","bank_message":"Approved","bank_resp_code":"100","bank_resp_code_2":"","card_cost":"","cardholder_name":"Example User","cavv":"","cavv_algorithm":"","cavv_response":"","cc_expiry":"0318","cc_number":"############1111","cc_verification_str1":"123 Billing St|12345|Billstown|CA|US","cc_verification_str2":"208","check_number":"","check_type":"","clerk_id":"","client_email":"","client_ip":"104.36.244.246","correlation_id":"","credit_card_type":"Visa","ctr":"=========== TRANSACTION RECORD ==========\nPriceWaiter DEMO0243\n426 Market St\nChattenooga, TN 37402\nUnited States\nhttps:\/\/www.pricewaiter.com\/\n\nTYPE: Purchase\n\nACCT: Visa $ 13.00 USD\n\nCARDHOLDER NAME : Example User\nCARD NUMBER : ############1111\nDATE\/TIME : 11 Aug 14 14:09:06\nREFERENCE # : 000056 M\nAUTHOR. # : ET181147\nTRANS. REF. : order2\n\n Approved - Thank You 100\n\n\nPlease retain this copy for your records.\n\nCardholder will pay above amount to card\nissuer pursuant to cardholder agreement.\n=========================================","currency_code":"USD","current_balance":"","customer_id_number":"","customer_id_type":"","customer_name":"","customer_ref":"","cvd_presence_ind":"0","cvv2":"N","date_of_birth":"","device_id":"","ean":"","ecommerce_flag":"","error_description":"","error_number":"","exact_message":"Transaction Normal","exact_resp_code":"00","fraud_suspected":"","gateway_id":"AF8163-05","gift_card_amount":"","gross_amount_currency_id":"","language":"","logon_message":"","merchant_address":"426 Market St","merchant_city":"Chattenooga","merchant_country":"United States","merchant_name":"PriceWaiter DEMO0243","merchant_postal":"37402","merchant_province":"Tennessee","merchant_url":"https:\/\/www.pricewaiter.com\/","message":"","micr":"","pan":"","partial_redemption":"0","password":"","payer_id":"","previous_balance":"","reference_3":"","reference_no":"order2","registration_date":"","registration_no":"","release_type":"","retrieval_ref_no":"7775501","secure_auth_required":"","secure_auth_result":"","sequence_no":"000056","success":"","surcharge_amount":"","tax1_amount":"","tax1_number":"","tax2_amount":"","tax2_number":"","timestamp":"","track1":"","track2":"","transaction_approved":"1","transaction_error":"0","transaction_tag":"28513493","transaction_type":"00","transarmor_token":"","user_name":"","vip":"","virtual_card":"","xid":"","zip_code":""}

0 commit comments

Comments
 (0)