Skip to content

Commit bb27369

Browse files
committed
Namespacing in new testfiles.
1 parent 75d839d commit bb27369

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

example/index.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/*
2222
* Account information. Below is all the variables needed to perform a purchase with
23-
* payson. Replace the placeholders with your actual information
23+
* payson. Replace the placeholders with your actual information
2424
*/
2525

2626
// Your agent ID and md5 key
@@ -47,10 +47,10 @@
4747
$senderLastname = "Person";
4848

4949

50-
/* Every interaction with Payson goes through the PaysonApi object which you set up as follows.
50+
/* Every interaction with Payson goes through the PaysonApi object which you set up as follows.
5151
* For the use of our test or live environment use one following parameters:
5252
* TRUE: Use test environment, FALSE: use live environment */
53-
$credentials = new PaysonCredentials($agentID, $md5Key);
53+
$credentials = new PaysonApi_PaysonCredentials($agentID, $md5Key);
5454
$api = new PaysonApi($credentials, TRUE);
5555

5656
/*
@@ -67,38 +67,38 @@
6767

6868

6969
// Details about the receiver
70-
$receiver = new Receiver(
70+
$receiver = new PaysonApi_Receiver(
7171
$receiverEmail, // The email of the account to receive the money
7272
$amountToReceive); // The amount you want to charge the user, here in SEK (the default currency)
7373
$receivers = array($receiver);
7474

7575
// Details about the user that is the sender of the money
76-
$sender = new Sender($senderEmail, $senderFirstname, $senderLastname);
76+
$sender = new PaysonApi_Sender($senderEmail, $senderFirstname, $senderLastname);
7777

78-
$payData = new PayData($returnURL, $cancelURL, $ipnURL, "Min fina vara", $sender, $receivers);
78+
$payData = new PaysonApi_PayData($returnURL, $cancelURL, $ipnURL, "Min fina vara", $sender, $receivers);
7979

8080
//Set the list of products. For direct payment this is optional
8181
$orderItems = array();
82-
$orderItems[] = new OrderItem("Test produkt", 100, 1, 0.25, "kalle");
82+
$orderItems[] = new PaysonApi_OrderItem("Test produkt", 100, 1, 0.25, "kalle");
8383

8484
$payData->setOrderItems($orderItems);
8585

8686

8787
//Set the payment method
88-
$constraints = array(FundingConstraint::BANK);
88+
$constraints = array(PaysonApi_FundingConstraint::BANK);
8989
$payData->setFundingConstraints($constraints);
9090

9191
//Set the payer of Payson fees
92-
$payData->setFeesPayer(FeesPayer::PRIMARYRECEIVER);
92+
$payData->setFeesPayer(PaysonApi_FeesPayer::PRIMARYRECEIVER);
9393

9494
// Set currency code
95-
$payData->setCurrencyCode(CurrencyCode::SEK);
95+
$payData->setCurrencyCode(PaysonApi_CurrencyCode::SEK);
9696

9797
// Set locale code
98-
$payData->setLocaleCode(LocaleCode::SWEDISH);
98+
$payData->setLocaleCode(PaysonApi_LocaleCode::SWEDISH);
9999

100100
// Set guarantee options
101-
$payData->setGuaranteeOffered(GuaranteeOffered::OPTIONAL);
101+
$payData->setGuaranteeOffered(PaysonApi_GuaranteeOffered::OPTIONAL);
102102

103103
/*
104104
* Step 2 initiate payment
@@ -114,4 +114,4 @@
114114
*/
115115
header("Location: " . $api->getForwardPayUrl($payResponse));
116116
}
117-
?>
117+
?>

example/ipn-example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
file_put_contents("test.txt", $postData);
1616

1717
// Set up API
18-
$credentials = new PaysonApi_Credentials($agentID, $md5Key);
18+
$credentials = new PaysonApi_PaysonCredentials($agentID, $md5Key);
1919
$api = new PaysonApi($credentials, TRUE);
2020

2121
// Validate the request

example/return.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@
1111
$token = $_GET["TOKEN"];
1212

1313
// Initialize the API in test mode
14-
$credentials = new PaysonCredentials($agentID, $md5Key);
14+
$credentials = new PaysonApi_PaysonCredentials($agentID, $md5Key);
1515
$api = new PaysonApi($credentials, TRUE);
1616

1717
// Get the details about this purchase
18-
$detailsResponse = $api->paymentDetails(new PaymentDetailsData($token));
18+
$detailsResponse = $api->paymentDetails(new PaysonApi_PaymentDetailsData($token));
1919

2020
// First we verify that the call to payson succeeded.
2121
if ($detailsResponse->getResponseEnvelope()->wasSuccessful()) {
2222

2323
// Get the payment details from the response
2424
$details = $detailsResponse->getPaymentDetails();
2525

26-
// If the call to Payson went well we also have to check the actual status
26+
// If the call to Payson went well we also have to check the actual status
2727
// of the transfer
2828
if ($details->getType() == "TRANSFER" && $details->getStatus() == "COMPLETED") {
2929
echo "Purchase has been completed <br /><h4>Details</h4><pre>" . $details . "</pre>";
@@ -51,7 +51,7 @@
5151
$details->getInvoiceStatus();
5252
$details->getGuaranteeStatus();
5353
$details->getReceiverFee();
54-
*
54+
*
5555
*/
5656
} else {
5757
$detailsErrors = $detailsResponse->getResponseEnvelope()->getErrors();

0 commit comments

Comments
 (0)