protected function parseIOS7StyleReceipt(): void
    {
        $this->receipt = $this->raw_data['receipt'];
        $this->app_item_id = $this->raw_data['receipt']['app_item_id'];
        $this->purchases = [];

        if (array_key_exists('original_purchase_date_ms', $this->raw_data['receipt'])) {
            $this->original_purchase_date = Carbon::createFromTimestampUTC(
                (int)round($this->raw_data['receipt']['original_purchase_date_ms'] / 1000)
            );
        }

        if (array_key_exists('request_date_ms', $this->raw_data['receipt'])) {
            $this->request_date = Carbon::createFromTimestampUTC(
                (int)round($this->raw_data['receipt']['request_date_ms'] / 1000)
            );
        }

        if (array_key_exists('receipt_creation_date_ms', $this->raw_data['receipt'])) {
            $this->receipt_creation_date = Carbon::createFromTimestampUTC(
                (int)round($this->raw_data['receipt']['receipt_creation_date_ms'] / 1000)
            );
        }

        foreach ($this->raw_data['receipt']['in_app'] as $purchase_item_data) {
            $this->purchases[] = new PurchaseItem($purchase_item_data);
        }

        if (array_key_exists('bundle_id', $this->raw_data['receipt'])) {
            $this->bundle_id = $this->raw_data['receipt']['bundle_id'];
        }

        if (array_key_exists('latest_receipt_info', $this->raw_data)) {

            $this->latest_receipt_info = array_map(
                function ($data) {
                    return new PurchaseItem($data);
                },
                $this->raw_data['latest_receipt_info']
            );

            usort(
                $this->latest_receipt_info,
                function (PurchaseItem $a, PurchaseItem $b) {
                    return $b->getPurchaseDate()->timestamp - $a->getPurchaseDate()->timestamp;
                }
            );
        }

        if (array_key_exists('latest_receipt', $this->raw_data)) {
            $this->latest_receipt = $this->raw_data['latest_receipt'];
        }

        if (array_key_exists('pending_renewal_info', $this->raw_data)) {
            $this->pending_renewal_info = array_map(
                function ($data) {
                    return new PendingRenewalInfo($data);
                },
                $this->raw_data['pending_renewal_info']
            );
        }

        if (array_key_exists('is-retryable', $this->raw_data)) {
            $this->is_retryable = true;
        }
    }
protected function parseIOS7StyleReceipt(): void
    {
        $this->receipt = $this->raw_data['receipt'];
        $this->app_item_id = $this->raw_data['receipt']['app_item_id'];
        $this->purchases = [];

        if (array_key_exists('original_purchase_date_ms', $this->raw_data['receipt'])) {
            $this->original_purchase_date = Carbon::createFromTimestampUTC(
                (int)round($this->raw_data['receipt']['original_purchase_date_ms'] / 1000)
            );
        }

        if (array_key_exists('request_date_ms', $this->raw_data['receipt'])) {
            $this->request_date = Carbon::createFromTimestampUTC(
                (int)round($this->raw_data['receipt']['request_date_ms'] / 1000)
            );
        }

        if (array_key_exists('receipt_creation_date_ms', $this->raw_data['receipt'])) {
            $this->receipt_creation_date = Carbon::createFromTimestampUTC(
                (int)round($this->raw_data['receipt']['receipt_creation_date_ms'] / 1000)
            );
        }

        foreach ($this->raw_data['receipt']['in_app'] as $purchase_item_data) {
            $this->purchases[] = new PurchaseItem($purchase_item_data);
        }

        if (array_key_exists('bundle_id', $this->raw_data['receipt'])) {
            $this->bundle_id = $this->raw_data['receipt']['bundle_id'];
        }

        if (array_key_exists('latest_receipt_info', $this->raw_data)) {

            $this->latest_receipt_info = array_map(
                function ($data) {
                    return new PurchaseItem($data);
                },
                $this->raw_data['latest_receipt_info']
            );

            usort(
                $this->latest_receipt_info,
                function (PurchaseItem $a, PurchaseItem $b) {
                    return $b->getPurchaseDate()->timestamp - $a->getPurchaseDate()->timestamp;
                }
            );
        }

        if (array_key_exists('latest_receipt', $this->raw_data)) {
            $this->latest_receipt = $this->raw_data['latest_receipt'];
        }

        if (array_key_exists('pending_renewal_info', $this->raw_data)) {
            $this->pending_renewal_info = array_map(
                function ($data) {
                    return new PendingRenewalInfo($data);
                },
                $this->raw_data['pending_renewal_info']
            );
        }

        if (array_key_exists('is-retryable', $this->raw_data)) {
            $this->is_retryable = true;
        }
    }
protected function parseIOS7StyleReceipt ( ) : void { $ this -> receipt = $ this -> raw_data [ 'receipt' ] ; $ this -> app_item_id = $ this -> raw_data [ 'receipt' ] [ 'app_item_id' ] ; $ this -> purchases = [ ] ; if ( array_key_exists ( 'original_purchase_date_ms' , $ this -> raw_data [ 'receipt' ] ) ) { $ this -> original_purchase_date = Carbon :: createFromTimestampUTC ( ( int ) round ( $ this -> raw_data [ 'receipt' ] [ 'original_purchase_date_ms' ] / 1000 ) ) ; } if ( array_key_exists ( 'request_date_ms' , $ this -> raw_data [ 'receipt' ] ) ) { $ this -> request_date = Carbon :: createFromTimestampUTC ( ( int ) round ( $ this -> raw_data [ 'receipt' ] [ 'request_date_ms' ] / 1000 ) ) ; } if ( array_key_exists ( 'receipt_creation_date_ms' , $ this -> raw_data [ 'receipt' ] ) ) { $ this -> receipt_creation_date = Carbon :: createFromTimestampUTC ( ( int ) round ( $ this -> raw_data [ 'receipt' ] [ 'receipt_creation_date_ms' ] / 1000 ) ) ; } foreach ( $ this -> raw_data [ 'receipt' ] [ 'in_app' ] as $ purchase_item_data ) { $ this -> purchases [ ] = new PurchaseItem ( $ purchase_item_data ) ; } if ( array_key_exists ( 'bundle_id' , $ this -> raw_data [ 'receipt' ] ) ) { $ this -> bundle_id = $ this -> raw_data [ 'receipt' ] [ 'bundle_id' ] ; } if ( array_key_exists ( 'latest_receipt_info' , $ this -> raw_data ) ) { $ this -> latest_receipt_info = array_map ( function ( $ data ) { return new PurchaseItem ( $ data ) ; } , $ this -> raw_data [ 'latest_receipt_info' ] ) ; usort ( $ this -> latest_receipt_info , function ( PurchaseItem $ a , PurchaseItem $ b ) { return $ b -> getPurchaseDate ( ) -> timestamp - $ a -> getPurchaseDate ( ) -> timestamp ; } ) ; } if ( array_key_exists ( 'latest_receipt' , $ this -> raw_data ) ) { $ this -> latest_receipt = $ this -> raw_data [ 'latest_receipt' ] ; } if ( array_key_exists ( 'pending_renewal_info' , $ this -> raw_data ) ) { $ this -> pending_renewal_info = array_map ( function ( $ data ) { return new PendingRenewalInfo ( $ data ) ; } , $ this -> raw_data [ 'pending_renewal_info' ] ) ; } if ( array_key_exists ( 'is-retryable' , $ this -> raw_data ) ) { $ this -> is_retryable = true ; } }
Collect data for iOS >= 7.0 receipt
@throws RunTimeException
Collect data for iOS > = 7 . 0 receipt