@@ -19,15 +19,15 @@ |
||
| 19 | 19 | $this->id = 'icepay-ideal'; |
| 20 | 20 | $this->name = 'ICEPAY'; |
| 21 | 21 | $this->url = 'https://icepay.com/'; |
| 22 | - $this->product_url = __( 'https://icepay.com/nl/en/pricing-and-accounts/', 'pronamic_ideal' ); |
|
| 22 | + $this->product_url = __('https://icepay.com/nl/en/pricing-and-accounts/', 'pronamic_ideal'); |
|
| 23 | 23 | $this->dashboard_url = 'https://portal.icepay.com/'; |
| 24 | 24 | $this->provider = 'icepay'; |
| 25 | 25 | |
| 26 | 26 | // Actions |
| 27 | - $function = array( __NAMESPACE__ . '\Listener', 'listen' ); |
|
| 27 | + $function = array(__NAMESPACE__ . '\Listener', 'listen'); |
|
| 28 | 28 | |
| 29 | - if ( ! has_action( 'wp_loaded', $function ) ) { |
|
| 30 | - add_action( 'wp_loaded', $function ); |
|
| 29 | + if ( ! has_action('wp_loaded', $function)) { |
|
| 30 | + add_action('wp_loaded', $function); |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
@@ -16,44 +16,44 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class Settings extends GatewaySettings { |
| 18 | 18 | public function __construct() { |
| 19 | - add_filter( 'pronamic_pay_gateway_sections', array( $this, 'sections' ) ); |
|
| 20 | - add_filter( 'pronamic_pay_gateway_fields', array( $this, 'fields' ) ); |
|
| 19 | + add_filter('pronamic_pay_gateway_sections', array($this, 'sections')); |
|
| 20 | + add_filter('pronamic_pay_gateway_fields', array($this, 'fields')); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function sections( array $sections ) { |
|
| 23 | + public function sections(array $sections) { |
|
| 24 | 24 | // iDEAL |
| 25 | 25 | $sections['icepay'] = array( |
| 26 | - 'title' => __( 'ICEPAY', 'pronamic_ideal' ), |
|
| 27 | - 'methods' => array( 'icepay' ), |
|
| 28 | - 'description' => __( 'Account details are provided by the payment provider after registration. These settings need to match with the payment provider dashboard.', 'pronamic_ideal' ), |
|
| 26 | + 'title' => __('ICEPAY', 'pronamic_ideal'), |
|
| 27 | + 'methods' => array('icepay'), |
|
| 28 | + 'description' => __('Account details are provided by the payment provider after registration. These settings need to match with the payment provider dashboard.', 'pronamic_ideal'), |
|
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | 31 | // Advanced |
| 32 | 32 | $sections['icepay_advanced'] = array( |
| 33 | - 'title' => __( 'Advanced', 'pronamic_ideal' ), |
|
| 34 | - 'methods' => array( 'icepay' ), |
|
| 35 | - 'description' => __( 'Optional settings for advanced usage only.', 'pronamic_ideal' ), |
|
| 33 | + 'title' => __('Advanced', 'pronamic_ideal'), |
|
| 34 | + 'methods' => array('icepay'), |
|
| 35 | + 'description' => __('Optional settings for advanced usage only.', 'pronamic_ideal'), |
|
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | // Transaction feedback |
| 39 | 39 | $sections['icepay_feedback'] = array( |
| 40 | - 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
| 41 | - 'methods' => array( 'icepay' ), |
|
| 42 | - 'description' => __( 'Set the below URLs in the payment provider dashboard to receive automatic transaction status updates.', 'pronamic_ideal' ), |
|
| 40 | + 'title' => __('Transaction feedback', 'pronamic_ideal'), |
|
| 41 | + 'methods' => array('icepay'), |
|
| 42 | + 'description' => __('Set the below URLs in the payment provider dashboard to receive automatic transaction status updates.', 'pronamic_ideal'), |
|
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | 45 | return $sections; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function fields( array $fields ) { |
|
| 48 | + public function fields(array $fields) { |
|
| 49 | 49 | // Merchant ID |
| 50 | 50 | $fields[] = array( |
| 51 | 51 | 'filter' => FILTER_SANITIZE_STRING, |
| 52 | 52 | 'section' => 'icepay', |
| 53 | 53 | 'meta_key' => '_pronamic_gateway_icepay_merchant_id', |
| 54 | - 'title' => _x( 'Merchant ID', 'icepay', 'pronamic_ideal' ), |
|
| 54 | + 'title' => _x('Merchant ID', 'icepay', 'pronamic_ideal'), |
|
| 55 | 55 | 'type' => 'text', |
| 56 | - 'tooltip' => __( 'Merchant ID as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal' ), |
|
| 56 | + 'tooltip' => __('Merchant ID as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal'), |
|
| 57 | 57 | ); |
| 58 | 58 | |
| 59 | 59 | // Secret Code |
@@ -61,20 +61,20 @@ discard block |
||
| 61 | 61 | 'filter' => FILTER_SANITIZE_STRING, |
| 62 | 62 | 'section' => 'icepay', |
| 63 | 63 | 'meta_key' => '_pronamic_gateway_icepay_secret_code', |
| 64 | - 'title' => _x( 'Secret Code', 'icepay', 'pronamic_ideal' ), |
|
| 64 | + 'title' => _x('Secret Code', 'icepay', 'pronamic_ideal'), |
|
| 65 | 65 | 'type' => 'text', |
| 66 | - 'classes' => array( 'regular-text', 'code' ), |
|
| 67 | - 'tooltip' => __( 'Secret Code as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal' ), |
|
| 66 | + 'classes' => array('regular-text', 'code'), |
|
| 67 | + 'tooltip' => __('Secret Code as mentioned in the ICEPAY dashboard at the "My websites" page.', 'pronamic_ideal'), |
|
| 68 | 68 | ); |
| 69 | 69 | |
| 70 | 70 | // Transaction feedback |
| 71 | 71 | $fields[] = array( |
| 72 | 72 | 'section' => 'icepay', |
| 73 | - 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
|
| 73 | + 'title' => __('Transaction feedback', 'pronamic_ideal'), |
|
| 74 | 74 | 'type' => 'description', |
| 75 | 75 | 'html' => sprintf( |
| 76 | 76 | '<span class="dashicons dashicons-warning"></span> %s', |
| 77 | - __( 'Receiving payment status updates needs additional configuration, if not yet completed.', 'pronamic_ideal' ) |
|
| 77 | + __('Receiving payment status updates needs additional configuration, if not yet completed.', 'pronamic_ideal') |
|
| 78 | 78 | ), |
| 79 | 79 | ); |
| 80 | 80 | |
@@ -86,17 +86,17 @@ discard block |
||
| 86 | 86 | ), |
| 87 | 87 | 'section' => 'icepay_advanced', |
| 88 | 88 | 'meta_key' => '_pronamic_gateway_icepay_order_id', |
| 89 | - 'title' => __( 'Order ID', 'pronamic_ideal' ), |
|
| 89 | + 'title' => __('Order ID', 'pronamic_ideal'), |
|
| 90 | 90 | 'type' => 'text', |
| 91 | - 'classes' => array( 'regular-text', 'code' ), |
|
| 91 | + 'classes' => array('regular-text', 'code'), |
|
| 92 | 92 | 'tooltip' => sprintf( |
| 93 | 93 | /* translators: %s: <code>OrderID</code> */ |
| 94 | - __( 'The Icepay %s parameter.', 'pronamic_ideal' ), |
|
| 95 | - sprintf( '<code>%s</code>', 'OrderID' ) |
|
| 94 | + __('The Icepay %s parameter.', 'pronamic_ideal'), |
|
| 95 | + sprintf('<code>%s</code>', 'OrderID') |
|
| 96 | 96 | ), |
| 97 | 97 | 'description' => sprintf( |
| 98 | 98 | '%s %s<br />%s', |
| 99 | - __( 'Available tags:', 'pronamic_ideal' ), |
|
| 99 | + __('Available tags:', 'pronamic_ideal'), |
|
| 100 | 100 | sprintf( |
| 101 | 101 | '<code>%s</code> <code>%s</code>', |
| 102 | 102 | '{order_id}', |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | ), |
| 105 | 105 | sprintf( |
| 106 | 106 | /* translators: %s: <code>{payment_id}</code> */ |
| 107 | - __( 'Default: <code>%s</code>', 'pronamic_ideal' ), |
|
| 107 | + __('Default: <code>%s</code>', 'pronamic_ideal'), |
|
| 108 | 108 | '{payment_id}' |
| 109 | 109 | ) |
| 110 | 110 | ), |
@@ -113,30 +113,30 @@ discard block |
||
| 113 | 113 | // Thank you page URL |
| 114 | 114 | $fields[] = array( |
| 115 | 115 | 'section' => 'icepay_feedback', |
| 116 | - 'title' => __( 'Thank you page URL', 'pronamic_ideal' ), |
|
| 116 | + 'title' => __('Thank you page URL', 'pronamic_ideal'), |
|
| 117 | 117 | 'type' => 'text', |
| 118 | - 'classes' => array( 'regular-text', 'code' ), |
|
| 119 | - 'value' => home_url( '/' ), |
|
| 118 | + 'classes' => array('regular-text', 'code'), |
|
| 119 | + 'value' => home_url('/'), |
|
| 120 | 120 | 'readonly' => true, |
| 121 | 121 | ); |
| 122 | 122 | |
| 123 | 123 | // Error page URL |
| 124 | 124 | $fields[] = array( |
| 125 | 125 | 'section' => 'icepay_feedback', |
| 126 | - 'title' => __( 'Error page URL', 'pronamic_ideal' ), |
|
| 126 | + 'title' => __('Error page URL', 'pronamic_ideal'), |
|
| 127 | 127 | 'type' => 'text', |
| 128 | - 'classes' => array( 'regular-text', 'code' ), |
|
| 129 | - 'value' => home_url( '/' ), |
|
| 128 | + 'classes' => array('regular-text', 'code'), |
|
| 129 | + 'value' => home_url('/'), |
|
| 130 | 130 | 'readonly' => true, |
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | 133 | // Postback URL |
| 134 | 134 | $fields[] = array( |
| 135 | 135 | 'section' => 'icepay_feedback', |
| 136 | - 'title' => __( 'Postback URL', 'pronamic_ideal' ), |
|
| 136 | + 'title' => __('Postback URL', 'pronamic_ideal'), |
|
| 137 | 137 | 'type' => 'text', |
| 138 | - 'classes' => array( 'regular-text', 'code' ), |
|
| 139 | - 'value' => home_url( '/' ), |
|
| 138 | + 'classes' => array('regular-text', 'code'), |
|
| 139 | + 'value' => home_url('/'), |
|
| 140 | 140 | 'readonly' => true, |
| 141 | 141 | ); |
| 142 | 142 | |
@@ -15,12 +15,12 @@ |
||
| 15 | 15 | * @since 1.0.0 |
| 16 | 16 | */ |
| 17 | 17 | class ConfigFactory extends GatewayConfigFactory { |
| 18 | - public function get_config( $post_id ) { |
|
| 18 | + public function get_config($post_id) { |
|
| 19 | 19 | $config = new Config(); |
| 20 | 20 | |
| 21 | - $config->merchant_id = get_post_meta( $post_id, '_pronamic_gateway_icepay_merchant_id', true ); |
|
| 22 | - $config->secret_code = get_post_meta( $post_id, '_pronamic_gateway_icepay_secret_code', true ); |
|
| 23 | - $config->order_id = get_post_meta( $post_id, '_pronamic_gateway_icepay_order_id', true ); |
|
| 21 | + $config->merchant_id = get_post_meta($post_id, '_pronamic_gateway_icepay_merchant_id', true); |
|
| 22 | + $config->secret_code = get_post_meta($post_id, '_pronamic_gateway_icepay_secret_code', true); |
|
| 23 | + $config->order_id = get_post_meta($post_id, '_pronamic_gateway_icepay_order_id', true); |
|
| 24 | 24 | |
| 25 | 25 | return $config; |
| 26 | 26 | } |
@@ -16,37 +16,37 @@ |
||
| 16 | 16 | class Listener { |
| 17 | 17 | public static function listen() { |
| 18 | 18 | if ( |
| 19 | - filter_has_var( INPUT_GET, 'Status' ) |
|
| 19 | + filter_has_var(INPUT_GET, 'Status') |
|
| 20 | 20 | && |
| 21 | - filter_has_var( INPUT_GET, 'StatusCode' ) |
|
| 21 | + filter_has_var(INPUT_GET, 'StatusCode') |
|
| 22 | 22 | && |
| 23 | - filter_has_var( INPUT_GET, 'Merchant' ) |
|
| 23 | + filter_has_var(INPUT_GET, 'Merchant') |
|
| 24 | 24 | && |
| 25 | - filter_has_var( INPUT_GET, 'OrderID' ) |
|
| 25 | + filter_has_var(INPUT_GET, 'OrderID') |
|
| 26 | 26 | && |
| 27 | - filter_has_var( INPUT_GET, 'PaymentID' ) |
|
| 27 | + filter_has_var(INPUT_GET, 'PaymentID') |
|
| 28 | 28 | && |
| 29 | - filter_has_var( INPUT_GET, 'Reference' ) |
|
| 29 | + filter_has_var(INPUT_GET, 'Reference') |
|
| 30 | 30 | && |
| 31 | - filter_has_var( INPUT_GET, 'TransactionID' ) |
|
| 31 | + filter_has_var(INPUT_GET, 'TransactionID') |
|
| 32 | 32 | && |
| 33 | - filter_has_var( INPUT_GET, 'Checksum' ) |
|
| 33 | + filter_has_var(INPUT_GET, 'Checksum') |
|
| 34 | 34 | ) { |
| 35 | - $reference = filter_input( INPUT_GET, 'OrderID', FILTER_SANITIZE_STRING ); |
|
| 35 | + $reference = filter_input(INPUT_GET, 'OrderID', FILTER_SANITIZE_STRING); |
|
| 36 | 36 | |
| 37 | - $payment = get_pronamic_payment( $reference ); |
|
| 37 | + $payment = get_pronamic_payment($reference); |
|
| 38 | 38 | |
| 39 | 39 | // Add note. |
| 40 | 40 | $note = sprintf( |
| 41 | 41 | /* translators: %s: ICEPAY */ |
| 42 | - __( 'Webhook requested by %s.', 'pronamic_ideal' ), |
|
| 43 | - __( 'ICEPAY', 'pronamic_ideal' ) |
|
| 42 | + __('Webhook requested by %s.', 'pronamic_ideal'), |
|
| 43 | + __('ICEPAY', 'pronamic_ideal') |
|
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | - $payment->add_note( $note ); |
|
| 46 | + $payment->add_note($note); |
|
| 47 | 47 | |
| 48 | 48 | // Update payment. |
| 49 | - Plugin::update_payment( $payment ); |
|
| 49 | + Plugin::update_payment($payment); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -35,21 +35,21 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @param Config $config |
| 37 | 37 | */ |
| 38 | - public function __construct( Config $config ) { |
|
| 39 | - parent::__construct( $config ); |
|
| 38 | + public function __construct(Config $config) { |
|
| 39 | + parent::__construct($config); |
|
| 40 | 40 | |
| 41 | 41 | // Default properties for this gateway |
| 42 | - $this->set_method( Gateway::METHOD_HTTP_REDIRECT ); |
|
| 43 | - $this->set_has_feedback( true ); |
|
| 44 | - $this->set_amount_minimum( 1.20 ); |
|
| 45 | - $this->set_slug( 'icepay' ); |
|
| 42 | + $this->set_method(Gateway::METHOD_HTTP_REDIRECT); |
|
| 43 | + $this->set_has_feedback(true); |
|
| 44 | + $this->set_amount_minimum(1.20); |
|
| 45 | + $this->set_slug('icepay'); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Filter iDEAL |
| 50 | 50 | */ |
| 51 | - private function filter_ideal( $method ) { |
|
| 52 | - return is_array( $method ) && isset( $method['PaymentMethodCode'] ) && 'IDEAL' === $method['PaymentMethodCode']; |
|
| 51 | + private function filter_ideal($method) { |
|
| 52 | + return is_array($method) && isset($method['PaymentMethodCode']) && 'IDEAL' === $method['PaymentMethodCode']; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -63,25 +63,25 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $methods = Icepay_Api_Webservice::getInstance() |
| 65 | 65 | ->paymentmethodService() |
| 66 | - ->setMerchantID( $this->config->merchant_id ) |
|
| 67 | - ->setSecretCode( $this->config->secret_code ) |
|
| 66 | + ->setMerchantID($this->config->merchant_id) |
|
| 67 | + ->setSecretCode($this->config->secret_code) |
|
| 68 | 68 | ->retrieveAllPaymentmethods() |
| 69 | 69 | ->asArray(); |
| 70 | 70 | |
| 71 | - $ideal_methods = array_filter( $methods, array( $this, 'filter_ideal' ) ); |
|
| 71 | + $ideal_methods = array_filter($methods, array($this, 'filter_ideal')); |
|
| 72 | 72 | |
| 73 | - if ( ! empty( $ideal_methods ) ) { |
|
| 73 | + if ( ! empty($ideal_methods)) { |
|
| 74 | 74 | $issuers = Icepay_Api_Webservice::getInstance()->singleMethod() |
| 75 | - ->loadFromArray( $methods ) |
|
| 76 | - ->selectPaymentMethodByCode( 'IDEAL' ) |
|
| 75 | + ->loadFromArray($methods) |
|
| 76 | + ->selectPaymentMethodByCode('IDEAL') |
|
| 77 | 77 | ->getIssuers(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if ( $issuers ) { |
|
| 80 | + if ($issuers) { |
|
| 81 | 81 | $options = array(); |
| 82 | 82 | |
| 83 | - foreach ( $issuers as $issuer ) { |
|
| 84 | - $options[ $issuer['IssuerKeyword'] ] = $issuer['Description']; |
|
| 83 | + foreach ($issuers as $issuer) { |
|
| 84 | + $options[$issuer['IssuerKeyword']] = $issuer['Description']; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $groups[] = array( |
@@ -103,25 +103,25 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $method = new Icepay_Paymentmethod_Creditcard(); |
| 105 | 105 | |
| 106 | - if ( isset( $method->_issuer ) ) { |
|
| 106 | + if (isset($method->_issuer)) { |
|
| 107 | 107 | $issuers = $method->_issuer; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if ( $issuers ) { |
|
| 110 | + if ($issuers) { |
|
| 111 | 111 | $options = array(); |
| 112 | 112 | |
| 113 | - foreach ( $issuers as $issuer ) { |
|
| 114 | - switch ( $issuer ) { |
|
| 113 | + foreach ($issuers as $issuer) { |
|
| 114 | + switch ($issuer) { |
|
| 115 | 115 | case 'AMEX': |
| 116 | - $name = _x( 'AMEX', 'Payment method name', 'pronamic_ideal' ); |
|
| 116 | + $name = _x('AMEX', 'Payment method name', 'pronamic_ideal'); |
|
| 117 | 117 | |
| 118 | 118 | break; |
| 119 | 119 | case 'MASTER': |
| 120 | - $name = _x( 'MASTER', 'Payment method name', 'pronamic_ideal' ); |
|
| 120 | + $name = _x('MASTER', 'Payment method name', 'pronamic_ideal'); |
|
| 121 | 121 | |
| 122 | 122 | break; |
| 123 | 123 | case 'VISA': |
| 124 | - $name = _x( 'VISA', 'Payment method name', 'pronamic_ideal' ); |
|
| 124 | + $name = _x('VISA', 'Payment method name', 'pronamic_ideal'); |
|
| 125 | 125 | |
| 126 | 126 | break; |
| 127 | 127 | default: |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | break; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $options[ $issuer ] = $name; |
|
| 133 | + $options[$issuer] = $name; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $groups[] = array( |
@@ -149,12 +149,12 @@ discard block |
||
| 149 | 149 | * @return mixed |
| 150 | 150 | */ |
| 151 | 151 | public function get_issuer_field() { |
| 152 | - switch ( $this->get_payment_method() ) { |
|
| 152 | + switch ($this->get_payment_method()) { |
|
| 153 | 153 | case PaymentMethods::IDEAL: |
| 154 | 154 | return array( |
| 155 | 155 | 'id' => 'pronamic_ideal_issuer_id', |
| 156 | 156 | 'name' => 'pronamic_ideal_issuer_id', |
| 157 | - 'label' => __( 'Choose your bank', 'pronamic_ideal' ), |
|
| 157 | + 'label' => __('Choose your bank', 'pronamic_ideal'), |
|
| 158 | 158 | 'required' => true, |
| 159 | 159 | 'type' => 'select', |
| 160 | 160 | 'choices' => $this->get_transient_issuers(), |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | return array( |
| 164 | 164 | 'id' => 'pronamic_credit_card_issuer_id', |
| 165 | 165 | 'name' => 'pronamic_credit_card_issuer_id', |
| 166 | - 'label' => __( 'Choose your credit card issuer', 'pronamic_ideal' ), |
|
| 166 | + 'label' => __('Choose your credit card issuer', 'pronamic_ideal'), |
|
| 167 | 167 | 'required' => true, |
| 168 | 168 | 'type' => 'select', |
| 169 | 169 | 'choices' => $this->get_transient_credit_card_issuers(), |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | * |
| 193 | 193 | * @param Payment $payment |
| 194 | 194 | */ |
| 195 | - public function start( Payment $payment ) { |
|
| 195 | + public function start(Payment $payment) { |
|
| 196 | 196 | try { |
| 197 | 197 | $locale = $payment->get_locale(); |
| 198 | 198 | |
| 199 | - $language = strtoupper( substr( $locale, 0, 2 ) ); |
|
| 200 | - $country = strtoupper( substr( $locale, 3, 2 ) ); |
|
| 199 | + $language = strtoupper(substr($locale, 0, 2)); |
|
| 200 | + $country = strtoupper(substr($locale, 3, 2)); |
|
| 201 | 201 | |
| 202 | 202 | /* |
| 203 | 203 | * Order ID |
@@ -212,14 +212,14 @@ discard block |
||
| 212 | 212 | // Payment object |
| 213 | 213 | $payment_object = new Icepay_PaymentObject(); |
| 214 | 214 | $payment_object |
| 215 | - ->setAmount( Util::amount_to_cents( $payment->get_amount()->get_amount() ) ) |
|
| 216 | - ->setCountry( $country ) |
|
| 217 | - ->setLanguage( $language ) |
|
| 218 | - ->setReference( $payment->get_order_id() ) |
|
| 219 | - ->setDescription( $payment->get_description() ) |
|
| 220 | - ->setCurrency( $payment->get_currency() ) |
|
| 221 | - ->setIssuer( $payment->get_issuer() ) |
|
| 222 | - ->setOrderID( $payment->format_string( $this->config->order_id ) ); |
|
| 215 | + ->setAmount(Util::amount_to_cents($payment->get_amount()->get_amount())) |
|
| 216 | + ->setCountry($country) |
|
| 217 | + ->setLanguage($language) |
|
| 218 | + ->setReference($payment->get_order_id()) |
|
| 219 | + ->setDescription($payment->get_description()) |
|
| 220 | + ->setCurrency($payment->get_currency()) |
|
| 221 | + ->setIssuer($payment->get_issuer()) |
|
| 222 | + ->setOrderID($payment->format_string($this->config->order_id)); |
|
| 223 | 223 | |
| 224 | 224 | /* |
| 225 | 225 | * Payment method |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | $icepay_method = null; |
| 229 | 229 | |
| 230 | - switch ( $payment->get_method() ) { |
|
| 230 | + switch ($payment->get_method()) { |
|
| 231 | 231 | case PaymentMethods::CREDIT_CARD: |
| 232 | 232 | // @see https://github.com/icepay/icepay/blob/2.4.0/api/paymentmethods/creditcard.php |
| 233 | 233 | $icepay_method = new Icepay_Paymentmethod_Creditcard(); |
@@ -251,9 +251,9 @@ discard block |
||
| 251 | 251 | break; |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - if ( isset( $icepay_method ) ) { |
|
| 254 | + if (isset($icepay_method)) { |
|
| 255 | 255 | // @see https://github.com/icepay/icepay/blob/2.4.0/api/icepay_api_base.php#L342-L353 |
| 256 | - $payment_object->setPaymentMethod( $icepay_method->getCode() ); |
|
| 256 | + $payment_object->setPaymentMethod($icepay_method->getCode()); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | // Protocol |
@@ -262,17 +262,17 @@ discard block |
||
| 262 | 262 | // Basic mode |
| 263 | 263 | $basicmode = Icepay_Basicmode::getInstance(); |
| 264 | 264 | $basicmode |
| 265 | - ->setMerchantID( $this->config->merchant_id ) |
|
| 266 | - ->setSecretCode( $this->config->secret_code ) |
|
| 267 | - ->setProtocol( $protocol ) |
|
| 268 | - ->setSuccessURL( $payment->get_return_url() ) |
|
| 269 | - ->setErrorURL( $payment->get_return_url() ) |
|
| 270 | - ->validatePayment( $payment_object ); |
|
| 265 | + ->setMerchantID($this->config->merchant_id) |
|
| 266 | + ->setSecretCode($this->config->secret_code) |
|
| 267 | + ->setProtocol($protocol) |
|
| 268 | + ->setSuccessURL($payment->get_return_url()) |
|
| 269 | + ->setErrorURL($payment->get_return_url()) |
|
| 270 | + ->validatePayment($payment_object); |
|
| 271 | 271 | |
| 272 | 272 | // Payment |
| 273 | - $payment->set_action_url( $basicmode->getURL() ); |
|
| 274 | - } catch ( Exception $exception ) { |
|
| 275 | - $this->error = new WP_Error( 'icepay_error', $exception->getMessage(), $exception ); |
|
| 273 | + $payment->set_action_url($basicmode->getURL()); |
|
| 274 | + } catch (Exception $exception) { |
|
| 275 | + $this->error = new WP_Error('icepay_error', $exception->getMessage(), $exception); |
|
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | |
@@ -283,34 +283,34 @@ discard block |
||
| 283 | 283 | * |
| 284 | 284 | * @throws Exception |
| 285 | 285 | */ |
| 286 | - public function update_status( Payment $payment ) { |
|
| 286 | + public function update_status(Payment $payment) { |
|
| 287 | 287 | // Get the Icepay Result and set the required fields |
| 288 | 288 | $result = new Icepay_Result(); |
| 289 | 289 | $result |
| 290 | - ->setMerchantID( $this->config->merchant_id ) |
|
| 291 | - ->setSecretCode( $this->config->secret_code ); |
|
| 290 | + ->setMerchantID($this->config->merchant_id) |
|
| 291 | + ->setSecretCode($this->config->secret_code); |
|
| 292 | 292 | |
| 293 | 293 | try { |
| 294 | 294 | // Determine if the result can be validated |
| 295 | - if ( $result->validate() ) { |
|
| 295 | + if ($result->validate()) { |
|
| 296 | 296 | // What was the status response |
| 297 | - switch ( $result->getStatus() ) { |
|
| 297 | + switch ($result->getStatus()) { |
|
| 298 | 298 | case Icepay_StatusCode::SUCCESS: |
| 299 | - $payment->set_status( Statuses::SUCCESS ); |
|
| 299 | + $payment->set_status(Statuses::SUCCESS); |
|
| 300 | 300 | |
| 301 | 301 | break; |
| 302 | 302 | case Icepay_StatusCode::OPEN: |
| 303 | - $payment->set_status( Statuses::OPEN ); |
|
| 303 | + $payment->set_status(Statuses::OPEN); |
|
| 304 | 304 | |
| 305 | 305 | break; |
| 306 | 306 | case Icepay_StatusCode::ERROR: |
| 307 | - $payment->set_status( Statuses::FAILURE ); |
|
| 307 | + $payment->set_status(Statuses::FAILURE); |
|
| 308 | 308 | |
| 309 | 309 | break; |
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | - } catch ( Exception $exception ) { |
|
| 313 | - $this->error = new WP_Error( 'icepay_error', $exception->getMessage(), $exception ); |
|
| 312 | + } catch (Exception $exception) { |
|
| 313 | + $this->error = new WP_Error('icepay_error', $exception->getMessage(), $exception); |
|
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | } |