Get Payvia Rule

From TMMwiki
Jump to: navigation, search
NATS 4
SOAP API
API
WSDL Cache
Add Affiliate
Add Member Note
Admin Get Adtools
Adtool Categories
Adtool Types
Affiliate Get Campaigns
Bulk Import Adtools
Caching
Decode Natscode
Expire Manual Member
Get Affiliate Campaigns
Get Affiliate Hit Data
Get Affiliate Loginids
Get Affiliate Nats Codes
Get Affiliate Payout
Get Affiliate Program Campaign List
Get_Affiliate_Program_Campaign_List
Get Member Details
Get Member Instant Upgrade String
Get Member Package Upgrade String
Get Member Token Rebuy String
Get Member Upsell String
Get Payment Data
Get Payvia Rule
Get Profit Loss Report
Ping
Record Member Login
Search Affiliate Info
Search Member Info
Send Email API Function
Set Affiliate Admin Settings
Set Affiliate Customs
Set Affiliate Defaults
Set Affiliate Information
Set Affiliate Settings
Set Member Details
Set Payment Status
Set Payvia Rule
REST API
API Overview
REST API PATH UPDATES
GET /adtools/types
GET /adtools/categories
GET /adtools/admin
POST /adtools/importdump
GET /affiliate/hitdata
GET /affiliate/campaigns
GET /affiliate/payout
GET /affiliate/searchinfo
POST /affiliate/addaffiliate
PATCH /affiliate/setcustoms
PATCH /affiliate/setinformation
PATCH /affiliate/setadminsettings
PATCH /affiliate/setpayviainfo
PATCH /affiliate/setdefaults
PATCH /affiliate/setsettings
GET /decodenatscode
GET /member/upsellstring
GET /member/tokenrebuystring
GET /member/instantupgradestring
GET /member/packageupgradestring
GET /member/details
GET /member/cancelstring
GET /member/signupplusstring
GET /member/searchinfo
POST /member/addnote
POST /member/recordlogin
PUT /member/expiremanual
PATCH /member/setdetails
PATCH /member/setexpiration
GET /option/getrule
POST /option/addrule
PUT /option/edittext
PATCH /option/editrule
GET /payments/getpayments
PATCH /payments/setstatus
GET /payviarule
PATCH /payviarule
GET /ping
GET /profitlossreport
POST /sendemail
GET /suggestedcanceloffers

NATS4 supports an API function to get a list of payvia rules based on either a specific payvia type ID, and/or a certain type of payvia rule.


get_payvia_rule accepts the following input parameters:

• payvia_type_id (the ID number of the specific Payvia type, such as Check, Paxum, Domestic Wire, etc.)
• type (i.e. "enabled", "disabled", or "ignored")


get_payvia_rule will output the following parameters:

• payvia_rule_id (the internal ID number of the Payvia Rule)
• payvia_type_id (the ID number of the Payvia Type)
• rule_type (the type of rule it is: "enabled", "disabled", or "ignored")
• identid (the internal identifier of this particular payvia rule)
• start_time (the starting date/time for when this rule is/was effective, format=YYYY-MM-DD HH:MM:SS)
• end_time (the ending date/time for when this rule is/was effective, format=YYYY-MM-DD HH:MM:SS, or "Never")
• login (if the rule is specific to an affiliate, the affiliate's login ID. If for ALL affiliates, the value will be 0) *
• country (if a country is specified in the rule, it will be the 2 letter designation of that country. If for ALL countries, the value will be "All") **

* If more than one affiliate is specified in a given rule, there will be a separate payvia_rule_id and a separate identid for each affiliate
** Likewise, if more than one country is specified in a given rule, there will be a separate payvia_rule_id and a separate identid for each country 

NOTE: Anytime a payvia rule is edited, both the payvia_rule_id and identid will be changed (i.e. incremented from previous values).


NuSOAP Example

This example continues from the main article NuSOAP Example:

To give a complete example of this (e.g. showing the Payvia "Enabled" Rules for Paxum, which is Payvia type ID = 9), this is how to call it:

<?php
require_once('nusoap/lib/nusoap.php');

$url = 'http://nats.site.com/admin_api.php'; // change to be the domain of your NATS install
$username = 'NATSADMIN'; // your admin username
$apikey = '3385e1b470b0864e27a9b648da6c0692'; // your api key

$client = new nusoap_client($url.'?wsdl', true);
$client->setCredentials($username,$apikey);
// Check for an error
$err = $client->getError();
if ($err) {
    // Display the error
    echo 'Constructor error' . $err . "\n";
    exit; // At this point, you know the call that follows will fail
    
}


//This example will show the Payvia "Enabled" Rules for Paxum, which is Payvia type ID = 9

$values = array(
'payvia_type_id' => 9,
'type' => "enabled"
 );
    

$result = $client->call('get_payvia_rule', $values, 'natsapiadmin_wsdl');

echo '<HR><PRE>';

print_r($result);

echo '</PRE>';
?>

Get Payvia Rule output

Assuming the following Pay Via Rules have been set in NATS:

Display Advanced Tour Details

The output will be a multi-dimensional array, as shown below:

Array
(
    [0] => TRUE
    [1] => Array
        (
            [0] => Array
                (
                    [payvia_rule_id] => 17
                    [payvia_type_id] => 9
                    [rule_type] => enabled
                    [identid] => 6
                    [start_time] => 2015-10-16 00:37:11
                    [end_time] => Never
                    [login] => 0
                    [country] => All
                )

            [1] => Array
                (
                    [payvia_rule_id] => 20
                    [payvia_type_id] => 9
                    [rule_type] => enabled
                    [identid] => 20
                    [start_time] => 2016-08-22 18:36:01
                    [end_time] => 2016-11-30 11:54:15
                    [login] => 2
                    [country] => HN
                )

            [2] => Array
                (
                    [payvia_rule_id] => 18
                    [payvia_type_id] => 9
                    [rule_type] => enabled
                    [identid] => 21
                    [start_time] => 2016-08-22 18:36:01
                    [end_time] => 2016-11-30 11:54:15
                    [login] => 7
                    [country] => HN
                )

            [3] => Array
                (
                    [payvia_rule_id] => 21
                    [payvia_type_id] => 9
                    [rule_type] => enabled
                    [identid] => 22
                    [start_time] => 2016-08-22 18:36:01
                    [end_time] => 2016-11-30 11:54:15
                    [login] => 2
                    [country] => US
                )

            [4] => Array
                (
                    [payvia_rule_id] => 19
                    [payvia_type_id] => 9
                    [rule_type] => enabled
                    [identid] => 23
                    [start_time] => 2016-08-22 18:36:01
                    [end_time] => 2016-11-30 11:54:15
                    [login] => 7
                    [country] => US
                )

        )

)