Skip to content

Commit

Permalink
Merge pull request #311 from reepay/refactor
Browse files Browse the repository at this point in the history
Refactor
  • Loading branch information
dimaspolohov authored Apr 4, 2024
2 parents 013b6b4 + abfcdca commit f63536a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions includes/Gateways/ReepayGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ public function add_payment_method() {

$result = reepay()->api( $this )->request( 'POST', 'https://checkout-api.reepay.com/v1/session/recurring', $params );
if ( is_wp_error( $result ) ) {
if ( $result->get_error_code() === API::ERROR_CODES['Customer has been deleted'] ||
$result->get_error_code() === API::ERROR_CODES['Customer not found'] ) {
if ( $result->get_error_code() === Api::ERROR_CODES['Customer has been deleted'] ||
$result->get_error_code() === Api::ERROR_CODES['Customer not found'] ) {
$params = array(
'locale' => $this->get_language(),
'button_text' => __( 'Add card', 'reepay-checkout-gateway' ),
Expand Down Expand Up @@ -339,7 +339,7 @@ public function check_is_active(): bool {

$current_name = str_replace( 'reepay_', '', $this->id );

if ( ! empty( $gateways_reepay ) ) {
if ( ! empty( $gateways_reepay ) && ! is_wp_error( $gateways_reepay ) ) {
foreach ( $gateways_reepay as $app ) {
if ( stripos( $app['type'], $current_name ) !== false ) {
return true;
Expand Down Expand Up @@ -1208,11 +1208,11 @@ public function process_session_charge( array $params, WC_Order $order ): array
if ( in_array(
$result->get_error_code(),
array(
API::ERROR_CODES['Invoice already authorized'],
API::ERROR_CODES['Invoice already settled'],
API::ERROR_CODES['Invoice already cancelled'],
API::ERROR_CODES['Customer cannot be changed on invoice'],
API::ERROR_CODES['Currency change not allowed'],
Api::ERROR_CODES['Invoice already authorized'],
Api::ERROR_CODES['Invoice already settled'],
Api::ERROR_CODES['Invoice already cancelled'],
Api::ERROR_CODES['Customer cannot be changed on invoice'],
Api::ERROR_CODES['Currency change not allowed'],
),
true
) ) {
Expand Down
2 changes: 1 addition & 1 deletion reepay-woocommerce-payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public function api( $source ): Api {
*
* @var Api $api
*/
$api = $this->di()->get( API::class );
$api = $this->di()->get( Api::class );
$api->set_logging_source( $source );

return $api;
Expand Down

0 comments on commit f63536a

Please sign in to comment.