Skip to content

Commit

Permalink
Merge pull request #22 from davidbankes/payeezy-json-api
Browse files Browse the repository at this point in the history
payeezy updated to supported JSON api
  • Loading branch information
barryvdh committed Jan 27, 2019
2 parents c0123a0 + 68509e5 commit addb59b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion .travis.yml
@@ -1,7 +1,6 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
Expand Down
2 changes: 1 addition & 1 deletion src/Message/PayeezyAbstractRequest.php
Expand Up @@ -209,7 +209,7 @@ protected function getHeaders()
{
return array(
'Content-Type' => self::CONTENT_TYPE,
'Accept' => 'text/html'
'Accept' => 'application/json'
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Message/PayeezyResponse.php
Expand Up @@ -25,7 +25,7 @@ class PayeezyResponse extends AbstractResponse
public function __construct(RequestInterface $request, $data)
{
$this->request = $request;
parse_str($data, $this->data);
$this->data = json_decode($data, true);
}

public function isSuccessful()
Expand Down
7 changes: 3 additions & 4 deletions tests/Message/PayeezyPurchaseResponseTest.php
Expand Up @@ -9,7 +9,7 @@ class PayeezyPurchaseResponseTest extends TestCase
{
public function testPurchaseSuccess()
{
$response = new PayeezyResponse($this->getMockRequest(), http_build_query(array(
$response = new PayeezyResponse($this->getMockRequest(), json_encode(array(
'amount' => 1000,
'exact_resp_code' => 00,
'exact_message' => 'Transaction Normal',
Expand All @@ -26,7 +26,7 @@ public function testPurchaseSuccess()

public function testPurchaseError()
{
$response = new PayeezyResponse($this->getMockRequest(), http_build_query(array(
$response = new PayeezyResponse($this->getMockRequest(), json_encode(array(
'amount' => 1000,
'exact_resp_code' => 22,
'exact_message' => 'Invalid Credit Card Number',
Expand All @@ -43,7 +43,7 @@ public function testPurchaseError()

public function testBankError()
{
$response = new PayeezyResponse($this->getMockRequest(), http_build_query(array(
$response = new PayeezyResponse($this->getMockRequest(), json_encode(array(
'amount' => 1000,
'exact_resp_code' => 00,
'reference_no' => 'abc123',
Expand All @@ -55,5 +55,4 @@ public function testBankError()
$this->assertEquals('::', $response->getTransactionReference());
$this->assertEquals('00', $response->getCode());
}

}
2 changes: 1 addition & 1 deletion tests/Mock/PurchaseSuccess.txt
Expand Up @@ -2,4 +2,4 @@ HTTP/1.1 201 OK
Date: Tue, 11 Feb 2014 02:34:58 GMT
Content-type: text/html; charset=utf-8

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=
{"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 comments on commit addb59b

Please sign in to comment.