-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathklarna.php
55 lines (41 loc) · 1.55 KB
/
klarna.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
* Plugin Name: Klarna for WPeC
* Plugin URI: https://klarna.com
* Description: Klarna Gateway Integration with WP E-Commerce
* Version: 1.3
* Author: Zao
* Author URI: http://zaowebdesign.com/
* Sputnik ID: klarna-payment-gateway
**/
function load_klarna_gateways() {
global $wpsc_cart;
if ( ! defined( 'KLARNA_FILE_PATH' ) )
define( 'KLARNA_FILE_PATH', dirname( __FILE__ ) );
if ( ! defined( 'KLARNA_URL' ) )
define( 'KLARNA_URL' , plugins_url( '', __FILE__ ) );
if ( ! function_exists( 'wpsc_core_setup_cart' ) )
return false;
if ( ! is_object( $wpsc_cart ) )
wpsc_core_setup_cart();
include_once 'klarna-invoice.merchant.php';
include_once 'klarna-partpayment.merchant.php';
include_once 'klarna-specialcampaigns.merchant.php';
add_filter( 'wpsc_merchants_modules', 'klarna_add_gateways' );
}
function klarna_add_gateways( $gateways ) {
global $klarna_gateways, $nzshpcrt_gateways;
$nzshpcrt_gateways = array_merge( $klarna_gateways, $gateways );
return $nzshpcrt_gateways;
}
function klarna_sputnik_report_error() {
echo '<div class="error"><p>' . __( 'Please install & activate Renku to enable Klarna.', 'klarna' ) . '</p></div>';
}
function klarna_sputnik_verify() {
remove_action( 'all_admin_notices', 'klarna_sputnik_report_error' );
Sputnik::check( __FILE__, 'load_klarna_gateways' );
}
add_action( 'wpsc_pre_load' , 'load_klarna_gateways' );
add_action( 'sputnik_loaded' , 'klarna_sputnik_verify' );
add_action( 'all_admin_notices', 'klarna_sputnik_report_error' );
?>