| @@ -31,10 +31,10 @@ | ||
| 31 | 31 | $this->provider = 'rabobank'; | 
| 32 | 32 | |
| 33 | 33 | // Actions. | 
| 34 | - $webhook_listener_function = array( __NAMESPACE__ . '\WebhookListener', 'listen' ); | |
| 34 | + $webhook_listener_function = array(__NAMESPACE__ . '\WebhookListener', 'listen'); | |
| 35 | 35 | |
| 36 | -		if ( ! has_action( 'wp_loaded', $webhook_listener_function ) ) { | |
| 37 | - add_action( 'wp_loaded', $webhook_listener_function ); | |
| 36 | +		if ( ! has_action('wp_loaded', $webhook_listener_function)) { | |
| 37 | +			add_action('wp_loaded', $webhook_listener_function); | |
| 38 | 38 | } | 
| 39 | 39 | } | 
| 40 | 40 | |
| @@ -47,8 +47,8 @@ discard block | ||
| 47 | 47 | * @param array $order_results Order results. | 
| 48 | 48 | * @param string $signature Signature. | 
| 49 | 49 | */ | 
| 50 | -	public function __construct( $more_available, array $order_results, $signature ) { | |
| 51 | - parent::__construct( $signature ); | |
| 50 | +	public function __construct($more_available, array $order_results, $signature) { | |
| 51 | + parent::__construct($signature); | |
| 52 | 52 | |
| 53 | 53 | $this->more_available = $more_available; | 
| 54 | 54 | $this->order_results = $order_results; | 
| @@ -73,7 +73,7 @@ discard block | ||
| 73 | 73 | |
| 74 | 74 | $data[] = $this->more_available() ? 'true' : 'false'; | 
| 75 | 75 | |
| 76 | -		foreach ( $this->order_results as $order_result ) { | |
| 76 | +		foreach ($this->order_results as $order_result) { | |
| 77 | 77 | $data[] = $order_result->get_merchant_order_id(); | 
| 78 | 78 | $data[] = $order_result->get_omnikassa_order_id(); | 
| 79 | 79 | $data[] = $order_result->get_poi_id(); | 
| @@ -95,7 +95,7 @@ discard block | ||
| 95 | 95 | * @return ArrayIterator | 
| 96 | 96 | */ | 
| 97 | 97 |  	public function getIterator() { | 
| 98 | - return new ArrayIterator( $this->order_results ); | |
| 98 | + return new ArrayIterator($this->order_results); | |
| 99 | 99 | } | 
| 100 | 100 | |
| 101 | 101 | /** | 
| @@ -105,27 +105,27 @@ discard block | ||
| 105 | 105 | * @return OrderResults | 
| 106 | 106 | * @throws InvalidArgumentException Throws invalid argument exception when object does not contains the required properties. | 
| 107 | 107 | */ | 
| 108 | -	public static function from_object( stdClass $object ) { | |
| 109 | -		if ( ! isset( $object->signature ) ) { | |
| 110 | - throw new InvalidArgumentException( 'Object must contain `signature` property.' ); | |
| 108 | +	public static function from_object(stdClass $object) { | |
| 109 | +		if ( ! isset($object->signature)) { | |
| 110 | +			throw new InvalidArgumentException('Object must contain `signature` property.'); | |
| 111 | 111 | } | 
| 112 | 112 | |
| 113 | -		if ( ! isset( $object->moreOrderResultsAvailable ) ) { | |
| 114 | - throw new InvalidArgumentException( 'Object must contain `moreOrderResultsAvailable` property.' ); | |
| 113 | +		if ( ! isset($object->moreOrderResultsAvailable)) { | |
| 114 | +			throw new InvalidArgumentException('Object must contain `moreOrderResultsAvailable` property.'); | |
| 115 | 115 | } | 
| 116 | 116 | |
| 117 | -		if ( ! isset( $object->orderResults ) ) { | |
| 118 | - throw new InvalidArgumentException( 'Object must contain `orderResults` property.' ); | |
| 117 | +		if ( ! isset($object->orderResults)) { | |
| 118 | +			throw new InvalidArgumentException('Object must contain `orderResults` property.'); | |
| 119 | 119 | } | 
| 120 | 120 | |
| 121 | -		if ( ! is_array( $object->orderResults ) ) { | |
| 122 | - throw new InvalidArgumentException( 'The `orderResults` property must be an array.' ); | |
| 121 | +		if ( ! is_array($object->orderResults)) { | |
| 122 | +			throw new InvalidArgumentException('The `orderResults` property must be an array.'); | |
| 123 | 123 | } | 
| 124 | 124 | |
| 125 | 125 | $order_results = array(); | 
| 126 | 126 | |
| 127 | -		foreach ( $object->orderResults as $o ) { | |
| 128 | - $order_results[] = OrderResult::from_object( $o ); | |
| 127 | +		foreach ($object->orderResults as $o) { | |
| 128 | + $order_results[] = OrderResult::from_object($o); | |
| 129 | 129 | } | 
| 130 | 130 | |
| 131 | 131 | return new self( | 
| @@ -142,15 +142,15 @@ discard block | ||
| 142 | 142 | * @return Notification | 
| 143 | 143 | * @throws \JsonSchema\Exception\ValidationException Throws JSON schema validation exception when JSON is invalid. | 
| 144 | 144 | */ | 
| 145 | -	public static function from_json( $json ) { | |
| 146 | - $data = json_decode( $json ); | |
| 145 | +	public static function from_json($json) { | |
| 146 | + $data = json_decode($json); | |
| 147 | 147 | |
| 148 | 148 | $validator = new Validator(); | 
| 149 | 149 | |
| 150 | - $validator->validate( $data, (object) array( | |
| 151 | - '$ref' => 'file://' . realpath( __DIR__ . '/../json-schemas/order-results.json' ), | |
| 152 | - ), Constraint::CHECK_MODE_EXCEPTIONS ); | |
| 150 | + $validator->validate($data, (object) array( | |
| 151 | + '$ref' => 'file://' . realpath(__DIR__ . '/../json-schemas/order-results.json'), | |
| 152 | + ), Constraint::CHECK_MODE_EXCEPTIONS); | |
| 153 | 153 | |
| 154 | - return self::from_object( $data ); | |
| 154 | + return self::from_object($data); | |
| 155 | 155 | } | 
| 156 | 156 | } | 
| @@ -39,7 +39,7 @@ discard block | ||
| 39 | 39 | * | 
| 40 | 40 | * @param string $signature Signature. | 
| 41 | 41 | */ | 
| 42 | -	protected function set_signature( $signature ) { | |
| 42 | +	protected function set_signature($signature) { | |
| 43 | 43 | $this->signature = $signature; | 
| 44 | 44 | } | 
| 45 | 45 | |
| @@ -49,9 +49,9 @@ discard block | ||
| 49 | 49 | * @param string $signing_key Signing key. | 
| 50 | 50 | * @return bool True if valid, false otherwise. | 
| 51 | 51 | */ | 
| 52 | -	public function is_valid( $signing_key ) { | |
| 53 | - $signature = Security::get_signature( $this, $signing_key ); | |
| 52 | +	public function is_valid($signing_key) { | |
| 53 | + $signature = Security::get_signature($this, $signing_key); | |
| 54 | 54 | |
| 55 | - return Security::validate_signature( $signature, $this->get_signature() ); | |
| 55 | + return Security::validate_signature($signature, $this->get_signature()); | |
| 56 | 56 | } | 
| 57 | 57 | } | 
| @@ -44,8 +44,8 @@ discard block | ||
| 44 | 44 | * @param string $status Status. | 
| 45 | 45 | * @param string $signature Signature. | 
| 46 | 46 | */ | 
| 47 | -	public function __construct( $order_id, $status, $signature ) { | |
| 48 | - parent::__construct( $signature ); | |
| 47 | +	public function __construct($order_id, $status, $signature) { | |
| 48 | + parent::__construct($signature); | |
| 49 | 49 | |
| 50 | 50 | $this->order_id = $order_id; | 
| 51 | 51 | $this->status = $status; | 
| @@ -89,13 +89,13 @@ discard block | ||
| 89 | 89 | * @param array $data Data array. | 
| 90 | 90 | * @return bool True if array contains return parameters, false otherwise. | 
| 91 | 91 | */ | 
| 92 | -	public static function contains( array $data ) { | |
| 92 | +	public static function contains(array $data) { | |
| 93 | 93 | return ( | 
| 94 | - array_key_exists( 'order_id', $data ) | |
| 94 | +			array_key_exists('order_id', $data) | |
| 95 | 95 | && | 
| 96 | - array_key_exists( 'status', $data ) | |
| 96 | +			array_key_exists('status', $data) | |
| 97 | 97 | && | 
| 98 | - array_key_exists( 'signature', $data ) | |
| 98 | +			array_key_exists('signature', $data) | |
| 99 | 99 | ); | 
| 100 | 100 | } | 
| 101 | 101 | |
| @@ -106,17 +106,17 @@ discard block | ||
| 106 | 106 | * @return ReturnParameters | 
| 107 | 107 | * @throws InvalidArgumentException Throws invalid argument exception when array does not contains the required keys. | 
| 108 | 108 | */ | 
| 109 | -	public static function from_array( array $data ) { | |
| 110 | -		if ( ! array_key_exists( 'order_id', $data ) ) { | |
| 111 | - throw new InvalidArgumentException( 'Data array must contain `order_id` field.' ); | |
| 109 | +	public static function from_array(array $data) { | |
| 110 | +		if ( ! array_key_exists('order_id', $data)) { | |
| 111 | +			throw new InvalidArgumentException('Data array must contain `order_id` field.'); | |
| 112 | 112 | } | 
| 113 | 113 | |
| 114 | -		if ( ! array_key_exists( 'status', $data ) ) { | |
| 115 | - throw new InvalidArgumentException( 'Data array must contain `status` field.' ); | |
| 114 | +		if ( ! array_key_exists('status', $data)) { | |
| 115 | +			throw new InvalidArgumentException('Data array must contain `status` field.'); | |
| 116 | 116 | } | 
| 117 | 117 | |
| 118 | -		if ( ! array_key_exists( 'signature', $data ) ) { | |
| 119 | - throw new InvalidArgumentException( 'Data array must contain `signature` field.' ); | |
| 118 | +		if ( ! array_key_exists('signature', $data)) { | |
| 119 | +			throw new InvalidArgumentException('Data array must contain `signature` field.'); | |
| 120 | 120 | } | 
| 121 | 121 | |
| 122 | 122 | return new self( | 
| @@ -95,7 +95,7 @@ discard block | ||
| 95 | 95 | * @param Money $paid_amount Paid amount. | 
| 96 | 96 | * @param Money $total_amount Total amount. | 
| 97 | 97 | */ | 
| 98 | -	public function __construct( $merchant_order_id, $omnikassa_order_id, $poi_id, $order_status, $order_status_datetime, $error_code, Money $paid_amount, Money $total_amount ) { | |
| 98 | +	public function __construct($merchant_order_id, $omnikassa_order_id, $poi_id, $order_status, $order_status_datetime, $error_code, Money $paid_amount, Money $total_amount) { | |
| 99 | 99 | $this->merchant_order_id = $merchant_order_id; | 
| 100 | 100 | $this->omnikassa_order_id = $omnikassa_order_id; | 
| 101 | 101 | $this->poi_id = $poi_id; | 
| @@ -203,37 +203,37 @@ discard block | ||
| 203 | 203 | * @return OrderResult | 
| 204 | 204 | * @throws InvalidArgumentException Throws invalid argument exception when object does not contains the required properties. | 
| 205 | 205 | */ | 
| 206 | -	public static function from_object( stdClass $object ) { | |
| 207 | -		if ( ! isset( $object->merchantOrderId ) ) { | |
| 208 | - throw new InvalidArgumentException( 'Object must contain `merchantOrderId` property.' ); | |
| 206 | +	public static function from_object(stdClass $object) { | |
| 207 | +		if ( ! isset($object->merchantOrderId)) { | |
| 208 | +			throw new InvalidArgumentException('Object must contain `merchantOrderId` property.'); | |
| 209 | 209 | } | 
| 210 | 210 | |
| 211 | -		if ( ! isset( $object->omnikassaOrderId ) ) { | |
| 212 | - throw new InvalidArgumentException( 'Object must contain `omnikassaOrderId` property.' ); | |
| 211 | +		if ( ! isset($object->omnikassaOrderId)) { | |
| 212 | +			throw new InvalidArgumentException('Object must contain `omnikassaOrderId` property.'); | |
| 213 | 213 | } | 
| 214 | 214 | |
| 215 | -		if ( ! isset( $object->poiId ) ) { | |
| 216 | - throw new InvalidArgumentException( 'Object must contain `poiId` property.' ); | |
| 215 | +		if ( ! isset($object->poiId)) { | |
| 216 | +			throw new InvalidArgumentException('Object must contain `poiId` property.'); | |
| 217 | 217 | } | 
| 218 | 218 | |
| 219 | -		if ( ! isset( $object->orderStatus ) ) { | |
| 220 | - throw new InvalidArgumentException( 'Object must contain `orderStatus` property.' ); | |
| 219 | +		if ( ! isset($object->orderStatus)) { | |
| 220 | +			throw new InvalidArgumentException('Object must contain `orderStatus` property.'); | |
| 221 | 221 | } | 
| 222 | 222 | |
| 223 | -		if ( ! isset( $object->orderStatusDateTime ) ) { | |
| 224 | - throw new InvalidArgumentException( 'Object must contain `orderStatusDateTime` property.' ); | |
| 223 | +		if ( ! isset($object->orderStatusDateTime)) { | |
| 224 | +			throw new InvalidArgumentException('Object must contain `orderStatusDateTime` property.'); | |
| 225 | 225 | } | 
| 226 | 226 | |
| 227 | -		if ( ! isset( $object->errorCode ) ) { | |
| 228 | - throw new InvalidArgumentException( 'Object must contain `errorCode` property.' ); | |
| 227 | +		if ( ! isset($object->errorCode)) { | |
| 228 | +			throw new InvalidArgumentException('Object must contain `errorCode` property.'); | |
| 229 | 229 | } | 
| 230 | 230 | |
| 231 | -		if ( ! isset( $object->paidAmount ) ) { | |
| 232 | - throw new InvalidArgumentException( 'Object must contain `paidAmount` property.' ); | |
| 231 | +		if ( ! isset($object->paidAmount)) { | |
| 232 | +			throw new InvalidArgumentException('Object must contain `paidAmount` property.'); | |
| 233 | 233 | } | 
| 234 | 234 | |
| 235 | -		if ( ! isset( $object->totalAmount ) ) { | |
| 236 | - throw new InvalidArgumentException( 'Object must contain `totalAmount` property.' ); | |
| 235 | +		if ( ! isset($object->totalAmount)) { | |
| 236 | +			throw new InvalidArgumentException('Object must contain `totalAmount` property.'); | |
| 237 | 237 | } | 
| 238 | 238 | |
| 239 | 239 | return new self( | 
| @@ -243,8 +243,8 @@ discard block | ||
| 243 | 243 | $object->orderStatus, | 
| 244 | 244 | $object->orderStatusDateTime, | 
| 245 | 245 | $object->errorCode, | 
| 246 | - Money::from_object( $object->paidAmount ), | |
| 247 | - Money::from_object( $object->totalAmount ) | |
| 246 | + Money::from_object($object->paidAmount), | |
| 247 | + Money::from_object($object->totalAmount) | |
| 248 | 248 | ); | 
| 249 | 249 | } | 
| 250 | 250 | |
| @@ -255,15 +255,15 @@ discard block | ||
| 255 | 255 | * @return Notification | 
| 256 | 256 | * @throws \JsonSchema\Exception\ValidationException Throws JSON schema validation exception when JSON is invalid. | 
| 257 | 257 | */ | 
| 258 | -	public static function from_json( $json ) { | |
| 259 | - $data = json_decode( $json ); | |
| 258 | +	public static function from_json($json) { | |
| 259 | + $data = json_decode($json); | |
| 260 | 260 | |
| 261 | 261 | $validator = new Validator(); | 
| 262 | 262 | |
| 263 | - $validator->validate( $data, (object) array( | |
| 264 | - '$ref' => 'file://' . realpath( __DIR__ . '/../json-schemas/json-schema-order-result.json' ), | |
| 265 | - ), Constraint::CHECK_MODE_EXCEPTIONS ); | |
| 263 | + $validator->validate($data, (object) array( | |
| 264 | + '$ref' => 'file://' . realpath(__DIR__ . '/../json-schemas/json-schema-order-result.json'), | |
| 265 | + ), Constraint::CHECK_MODE_EXCEPTIONS); | |
| 266 | 266 | |
| 267 | - return self::from_object( $data ); | |
| 267 | + return self::from_object($data); | |
| 268 | 268 | } | 
| 269 | 269 | } | 
| @@ -23,7 +23,7 @@ | ||
| 23 | 23 | * | 
| 24 | 24 | * @param string $signature Signature. | 
| 25 | 25 | */ | 
| 26 | -	public function __construct( $signature ) { | |
| 27 | - $this->set_signature( $signature ); | |
| 26 | +	public function __construct($signature) { | |
| 27 | + $this->set_signature($signature); | |
| 28 | 28 | } | 
| 29 | 29 | } | 
| @@ -97,8 +97,8 @@ | ||
| 97 | 97 | * @param string $payment_method Payment method. | 
| 98 | 98 | * @return string | 
| 99 | 99 | */ | 
| 100 | -	public static function transform( $payment_method ) { | |
| 101 | -		switch ( $payment_method ) { | |
| 100 | +	public static function transform($payment_method) { | |
| 101 | +		switch ($payment_method) { | |
| 102 | 102 | case PaymentMethods::BANCONTACT: | 
| 103 | 103 | return self::BANCONTACT; | 
| 104 | 104 | case PaymentMethods::CREDIT_CARD: | 
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 | * @param string $code Code. | 
| 46 | 46 | * @param string $message Message. | 
| 47 | 47 | */ | 
| 48 | -	public function __construct( $code, $message ) { | |
| 48 | +	public function __construct($code, $message) { | |
| 49 | 49 | $this->code = $code; | 
| 50 | 50 | $this->message = $message; | 
| 51 | 51 | } | 
| @@ -75,18 +75,18 @@ discard block | ||
| 75 | 75 | * @return Error | 
| 76 | 76 | * @throws InvalidArgumentException Throws invalid argument exception when object does not contains the required properties. | 
| 77 | 77 | */ | 
| 78 | -	public static function from_object( stdClass $object ) { | |
| 79 | -		if ( ! isset( $object->errorCode ) ) { | |
| 80 | - throw new InvalidArgumentException( 'Object must contain `errorCode` property.' ); | |
| 78 | +	public static function from_object(stdClass $object) { | |
| 79 | +		if ( ! isset($object->errorCode)) { | |
| 80 | +			throw new InvalidArgumentException('Object must contain `errorCode` property.'); | |
| 81 | 81 | } | 
| 82 | 82 | |
| 83 | 83 | $message = null; | 
| 84 | 84 | |
| 85 | -		if ( isset( $object->errorMessage ) ) { | |
| 85 | +		if (isset($object->errorMessage)) { | |
| 86 | 86 | $message = $object->errorMessage; | 
| 87 | 87 | } | 
| 88 | 88 | |
| 89 | -		if ( isset( $object->consumerMessage ) ) { | |
| 89 | +		if (isset($object->consumerMessage)) { | |
| 90 | 90 | $message = $object->consumerMessage; | 
| 91 | 91 | } | 
| 92 | 92 | |
| @@ -103,15 +103,15 @@ discard block | ||
| 103 | 103 | * @return Error | 
| 104 | 104 | * @throws \JsonSchema\Exception\ValidationException Throws JSON schema validation exception when JSON is invalid. | 
| 105 | 105 | */ | 
| 106 | -	public static function from_json( $json ) { | |
| 107 | - $data = json_decode( $json ); | |
| 106 | +	public static function from_json($json) { | |
| 107 | + $data = json_decode($json); | |
| 108 | 108 | |
| 109 | 109 | $validator = new Validator(); | 
| 110 | 110 | |
| 111 | - $validator->validate( $data, (object) array( | |
| 112 | - '$ref' => 'file://' . realpath( __DIR__ . '/../json-schemas/json-schema-error.json' ), | |
| 113 | - ), Constraint::CHECK_MODE_EXCEPTIONS ); | |
| 111 | + $validator->validate($data, (object) array( | |
| 112 | + '$ref' => 'file://' . realpath(__DIR__ . '/../json-schemas/json-schema-error.json'), | |
| 113 | + ), Constraint::CHECK_MODE_EXCEPTIONS); | |
| 114 | 114 | |
| 115 | - return self::from_object( $data ); | |
| 115 | + return self::from_object($data); | |
| 116 | 116 | } | 
| 117 | 117 | } | 
| @@ -44,7 +44,7 @@ discard block | ||
| 44 | 44 | * @param string $currency Authentication. | 
| 45 | 45 | * @param int $amount Amount. | 
| 46 | 46 | */ | 
| 47 | -	public function __construct( $currency, $amount ) { | |
| 47 | +	public function __construct($currency, $amount) { | |
| 48 | 48 | $this->currency = $currency; | 
| 49 | 49 | $this->amount = $amount; | 
| 50 | 50 | } | 
| @@ -86,13 +86,13 @@ discard block | ||
| 86 | 86 | * @return Money | 
| 87 | 87 | * @throws InvalidArgumentException Throws invalid argument exception when object does not contains the required properties. | 
| 88 | 88 | */ | 
| 89 | -	public static function from_object( stdClass $object ) { | |
| 90 | -		if ( ! isset( $object->currency ) ) { | |
| 91 | - throw new InvalidArgumentException( 'Object must contain `currency` property.' ); | |
| 89 | +	public static function from_object(stdClass $object) { | |
| 90 | +		if ( ! isset($object->currency)) { | |
| 91 | +			throw new InvalidArgumentException('Object must contain `currency` property.'); | |
| 92 | 92 | } | 
| 93 | 93 | |
| 94 | -		if ( ! isset( $object->amount ) ) { | |
| 95 | - throw new InvalidArgumentException( 'Object must contain `amount` property.' ); | |
| 94 | +		if ( ! isset($object->amount)) { | |
| 95 | +			throw new InvalidArgumentException('Object must contain `amount` property.'); | |
| 96 | 96 | } | 
| 97 | 97 | |
| 98 | 98 | return new self( | 
| @@ -108,15 +108,15 @@ discard block | ||
| 108 | 108 | * @return Money | 
| 109 | 109 | * @throws \JsonSchema\Exception\ValidationException Throws JSON schema validation exception when JSON is invalid. | 
| 110 | 110 | */ | 
| 111 | -	public static function from_json( $json ) { | |
| 112 | - $data = json_decode( $json ); | |
| 111 | +	public static function from_json($json) { | |
| 112 | + $data = json_decode($json); | |
| 113 | 113 | |
| 114 | 114 | $validator = new Validator(); | 
| 115 | 115 | |
| 116 | - $validator->validate( $data, (object) array( | |
| 117 | - '$ref' => 'file://' . realpath( __DIR__ . '/../json-schemas/json-schema-money.json' ), | |
| 118 | - ), Constraint::CHECK_MODE_EXCEPTIONS ); | |
| 116 | + $validator->validate($data, (object) array( | |
| 117 | + '$ref' => 'file://' . realpath(__DIR__ . '/../json-schemas/json-schema-money.json'), | |
| 118 | + ), Constraint::CHECK_MODE_EXCEPTIONS); | |
| 119 | 119 | |
| 120 | - return self::from_object( $data ); | |
| 120 | + return self::from_object($data); | |
| 121 | 121 | } | 
| 122 | 122 | } |