From 5c87490ee9d98e098d2419e6109512b95c3aac3c Mon Sep 17 00:00:00 2001 From: Adar Porat Date: Fri, 21 Nov 2014 09:43:59 -0500 Subject: [PATCH] added php 5.6 support --- .travis.yml | 1 + README.md | 2 +- src/ReceiptValidator/iTunes/Response.php | 10 ++++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 94e8411..67f698c 100755 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: php php: - "5.4" - "5.5" + - "5.6" before_script: diff --git a/README.md b/README.md index 25ead46..b478614 100755 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ store-receipt-validator [![Latest Stable Version](https://poser.pugx.org/aporat/store-receipt-validator/version.png)](https://packagist.org/packages/aporat/store-receipt-validator) [![Composer Downloads](https://poser.pugx.org/aporat/store-receipt-validator/d/total.png)](https://packagist.org/packages/aporat/store-receipt-validator) -[![Build Status](https://travis-ci.org/aporat/store-receipt-validator.png?branch=master)](https://travis-ci.org/aporat/store-receipt-validator) [![Dependency Status](https://www.versioneye.com/user/projects/529f708e632bac512c000002/badge.png)](https://www.versioneye.com/user/projects/521b6fd1632bac7a5900b02a) [![Coverage Status](https://coveralls.io/repos/aporat/store-receipt-validator/badge.png)](https://coveralls.io/r/aporat/store-receipt-validator) [![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/aporat/store-receipt-validator/badges/quality-score.png?s=5b8ac393ba82b0d8850c6397ba32ec460cd398cf)](https://scrutinizer-ci.com/g/aporat/store-receipt-validator/) +[![Build Status](https://travis-ci.org/aporat/store-receipt-validator.png?branch=master)](https://travis-ci.org/aporat/store-receipt-validator) [![Dependency Status](https://www.versioneye.com/user/projects/546f4d8c810106c2af0005b0/badge.svg?style=flat)](https://www.versioneye.com/user/projects/546f4d8c810106c2af0005b0) [![Coverage Status](https://img.shields.io/coveralls/aporat/store-receipt-validator.svg)](https://coveralls.io/r/aporat/store-receipt-validator) PHP library that can be used to validate base64 encoded iTunes in app purchase receipts. diff --git a/src/ReceiptValidator/iTunes/Response.php b/src/ReceiptValidator/iTunes/Response.php index cc78fa4..84cd75f 100644 --- a/src/ReceiptValidator/iTunes/Response.php +++ b/src/ReceiptValidator/iTunes/Response.php @@ -163,7 +163,10 @@ public function parseJsonResponse($jsonResponse) $this->_code = $jsonResponse['status']; $this->_receipt = $jsonResponse['receipt']; $this->_purchases = $jsonResponse['receipt']['in_app']; - $this->_bundle_id = $jsonResponse['receipt']['bundle_id']; + + if (array_key_exists('bundle_id', $jsonResponse['receipt'])) { + $this->_bundle_id = $jsonResponse['receipt']['bundle_id']; + } } elseif (array_key_exists('receipt', $jsonResponse)) { @@ -173,7 +176,10 @@ public function parseJsonResponse($jsonResponse) if (array_key_exists('receipt', $jsonResponse)) { $this->_receipt = $jsonResponse['receipt']; $this->_purchases = [$jsonResponse['receipt']]; - $this->_bundle_id = $jsonResponse['receipt']['bid']; + + if (array_key_exists('bid', $jsonResponse['receipt'])) { + $this->_bundle_id = $jsonResponse['receipt']['bid']; + } } } else { $this->_code = self::RESULT_DATA_MALFORMED;