| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Pronamic\WordPress\Pay\Gateways\Ingenico\OrderStandard; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Pronamic\WordPress\Pay\Gateways\Ingenico\AbstractIntegration; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Pronamic\WordPress\Pay\Gateways\Ingenico\Settings; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | class Integration extends AbstractIntegration { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | 	public function __construct( $args = array() ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | 		$args = wp_parse_args( $args, array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | 			'id'            => 'ogone-orderstandard', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | 			'name'          => 'Ingenico/Ogone - e-Commerce', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | 		) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | 		parent::__construct( $args ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | 	 * Get settings fields. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | 	 * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 	public function get_settings_fields() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 		return Settings::get_settings_fields( 'standard' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  | 	public function get_config( $post_id ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  | 		$mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  | 		$config = new Config(); | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  | 		$form_action_url = get_post_meta( $post_id, '_pronamic_gateway_ogone_form_action_url', true ); | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  | 		if ( '' !== $form_action_url ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  | 			$config->set_form_action_url( $form_action_url ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  | 		$config->mode                = $mode; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  | 		$config->psp_id              = get_post_meta( $post_id, '_pronamic_gateway_ogone_psp_id', true ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  | 		$config->hash_algorithm      = get_post_meta( $post_id, '_pronamic_gateway_ogone_hash_algorithm', true ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  | 		$config->sha_in_pass_phrase  = get_post_meta( $post_id, '_pronamic_gateway_ogone_sha_in_pass_phrase', true ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  | 		$config->sha_out_pass_phrase = get_post_meta( $post_id, '_pronamic_gateway_ogone_sha_out_pass_phrase', true ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  | 		$config->user_id             = get_post_meta( $post_id, '_pronamic_gateway_ogone_user_id', true ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  | 		$config->password            = get_post_meta( $post_id, '_pronamic_gateway_ogone_password', true ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  | 		$config->order_id            = get_post_meta( $post_id, '_pronamic_gateway_ogone_order_id', true ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  | 		$config->param_var           = get_post_meta( $post_id, '_pronamic_gateway_ogone_param_var', true ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  | 		$config->template_page       = get_post_meta( $post_id, '_pronamic_gateway_ogone_template_page', true ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  | 		$config->alias_enabled       = get_post_meta( $post_id, '_pronamic_gateway_ogone_alias_enabled', true ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  | 		$config->alias_usage         = get_post_meta( $post_id, '_pronamic_gateway_ogone_alias_usage', true ); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  | 		return $config; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 	 * Get gateway. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 	 * @param int $post_id Post ID. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 	 * @return Gateway | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 	public function get_gateway( $post_id ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 		return new Gateway( $this->get_config( $post_id ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 	} | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 63 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 64 |  |  |  |