diff --git a/.gitignore b/.gitignore index e22ebed..e45637d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /vendor composer.lock -.DS_Store \ No newline at end of file +.DS_Store +/nbproject/private/ \ No newline at end of file diff --git a/Composer-Setup.exe b/Composer-Setup.exe new file mode 100644 index 0000000..4d41662 Binary files /dev/null and b/Composer-Setup.exe differ diff --git a/Lib/AlternativePayments/Error/ExceptionBase.php b/Lib/AlternativePayments/Error/ExceptionBase.php index aedd54e..28383ee 100644 --- a/Lib/AlternativePayments/Error/ExceptionBase.php +++ b/Lib/AlternativePayments/Error/ExceptionBase.php @@ -3,7 +3,7 @@ namespace AlternativePayments\Error; /** - * Abstract Error class inherented by all specific error classes + * Abstract Error class inherited by all specific error classes */ abstract class ExceptionBase extends \Exception { diff --git a/Lib/AlternativePayments/Model/Element.php b/Lib/AlternativePayments/Model/Element.php index b63206f..fb4e2a7 100644 --- a/Lib/AlternativePayments/Model/Element.php +++ b/Lib/AlternativePayments/Model/Element.php @@ -3,7 +3,7 @@ namespace AlternativePayments\Model; /** - * Abstract Model class inherented by all model classes + * Abstract Model class inherited by all model classes */ abstract class Element { diff --git a/Lib/AlternativePayments/Model/Payment.php b/Lib/AlternativePayments/Model/Payment.php index b5961a8..4389c43 100644 --- a/Lib/AlternativePayments/Model/Payment.php +++ b/Lib/AlternativePayments/Model/Payment.php @@ -39,7 +39,6 @@ class Payment extends Element * @var string */ protected $creditCardNumber; - /* * @var string */ @@ -49,7 +48,6 @@ class Payment extends Element * @var string */ protected $expirationYear; - /* * @var string */ @@ -59,7 +57,10 @@ class Payment extends Element * @var string */ protected $documentId; - + /* + * @var string + */ + protected $creditCardType; /* * @var string */ @@ -211,7 +212,20 @@ public function setExpirationYear($expirationYear) { $this->expirationYear = $expirationYear; } - + /* + * @param string + */ + public function setCreditCardType($creditCardType) + { + $this->creditCardType = $creditCardType; + } + /* + * @param string + */ + public function getCreditCardType($creditCardType) + { + return $this->creditCardType; + } /* * @param string */ diff --git a/Lib/AlternativePayments/Model/PhoneVerification.php b/Lib/AlternativePayments/Model/PhoneVerification.php index 72c2d29..d959cf0 100644 --- a/Lib/AlternativePayments/Model/PhoneVerification.php +++ b/Lib/AlternativePayments/Model/PhoneVerification.php @@ -4,44 +4,45 @@ class PhoneVerification extends Element { - /* * @var string */ - protected $pin; - + protected $phone; + /* * @var string */ - protected $token; + protected $key; /* * @return string */ - public function getPin() + public function getPhone() { - return $this->pin; + return $this->phone; } + /* - * @param string + * @var string */ - public function setPin($pin) + public function setPhone($phone) { - $this->pin = $pin; + $this->phone = $phone; } - + /* - * @return string + * @var string */ - public function getToken() + public function getKey() { - return $this->token; + return $this->key; } + /* - * @param string + * @var string */ - public function setToken($token) + public function setKey($key) { - $this->token = $token; + $this->key = $key; } } diff --git a/Lib/AlternativePayments/Model/Plan.php b/Lib/AlternativePayments/Model/Plan.php index 09d268d..13230ff 100644 --- a/Lib/AlternativePayments/Model/Plan.php +++ b/Lib/AlternativePayments/Model/Plan.php @@ -8,7 +8,12 @@ class Plan extends Element /* * @var string */ - protected $merchantIdentification; + protected $name; + + /* + * @var string + */ + protected $description; /* * @var integer @@ -19,63 +24,69 @@ class Plan extends Element * @var string */ protected $currency; - + /* - * @var integer + * @var string */ - protected $period; - + protected $intervalUnit; + /* * @var integer */ - protected $interval; - + protected $intervalCount; + /* * @var integer */ - protected $recurTimes; - + protected $billingCycles; + /* - * @var integer + * @var string */ - protected $trialDays; - + protected $isConversionRateFixed; + /* * @var integer */ - protected $discountAmount; - + protected $ipAddress; + /* * @var integer */ - protected $discountRecurTimes; - + protected $trialPeriod; + /* - * @var string + * @return string */ - protected $name; - + public function getName() + { + return $this->name; + } + /* - * @var string + * @return string */ - protected $description; - - + public function setName($name) + { + $this->name = $name; + } + /* - * @return string + * @return integer */ - public function getMerchantIdentification() + public function getDescription() { - return $this->merchantIdentification; + return $this->description; } + /* - * @param string + * @return integer */ - public function setMerchantIdentification($merchantIdentification) + public function setDescription($description) { - $this->merchantIdentification = $merchantIdentification; + $this->description = $description; } - + /* * @return integer */ @@ -83,6 +94,7 @@ public function getAmount() { return $this->amount; } + /* * @param integer */ @@ -90,140 +102,116 @@ public function setAmount($amount) { $this->amount = $amount; } - - + /* - * @return string + * @return integer */ public function getCurrency() { return $this->currency; } + /* - * @param string + * @return integer */ public function setCurrency($currency) { $this->currency = $currency; } - + /* * @return integer */ - public function getPeriod() - { - return $this->period; - } - /* - * @param integer - */ - public function setPeriod($period) + public function getintervalUnit() { - $this->period = $period; + return $this->intervalUnit; } - + /* * @return integer */ - public function getInterval() + public function setIntervalUnit($intervalUnit) { - return $this->interval; + $this->intervalUnit = $intervalUnit; } - /* - * @param integer - */ - public function setInterval($interval) - { - $this->interval = $interval; - } - + /* * @return integer */ - public function getRecurTimes() + public function getIntervalCount($intervalCount) { - return $this->recurTimes; + return $this->intervalCount; } - /* - * @param integer - */ - public function setRecurTimes($recurTimes) - { - $this->recurTimes = $recurTimes; - } - + /* * @return integer */ - public function getTrialDays() - { - return $this->trialDays; - } - /* - * @param integer - */ - public function setTrialDays($trialDays) + public function setIntervalCount($intervalCount) { - $this->trialDays = $trialDays; + $this->intervalCount = $intervalCount; } - + /* * @return integer */ - public function getDiscountAmount() + public function getBillingCycle() { - return $this->discountAmount; + return $this->billingCycles; } + /* - * @param integer + * @return integer */ - public function setDiscountAmount($discountAmount) + public function setBillingCycle($billingCycle) { - $this->discountAmount = $discountAmount; + $this->billingCycles = $billingCycle; } - + /* * @return integer */ - public function getDiscountRecurTimes() + public function getIsConversionRateFixed() { - return $this->discountRecurTimes; + return $this->isConversionRateFixed; } + /* - * @param integer + * @return integer */ - public function setDiscountRecurTimes($discountRecurTimes) + public function setIsConversionRateFixed($isConversionRateFixed) { - $this->discountRecurTimes = $discountRecurTimes; + $this->isConversionRateFixed = $isConversionRateFixed; } - + /* - * @return string + * @return integer */ - public function getName() + public function getIpAddress($ipAddress) { - return $this->name; + return $ipAddress->ipAddress; } + /* - * @param string + * @return integer */ - public function setName($name) + public function setIpAddress($ipAddress) { - $this->name = $name; + $this->ipAddress = $ipAddress; } - + /* - * @return string + * @return integer */ - public function getDescription() + public function getTrialPeriod() { - return $this->description; + return $this->trialPeriod; } + /* - * @param string + * @return integer */ - public function setDescription($description) + public function setTrialPeriod($trialPeriod) { - $this->description = $description; + $this->trialPeriod = $trialPeriod; } } diff --git a/Lib/AlternativePayments/Model/Refund.php b/Lib/AlternativePayments/Model/Refund.php index 6f356a3..3e6c85f 100644 --- a/Lib/AlternativePayments/Model/Refund.php +++ b/Lib/AlternativePayments/Model/Refund.php @@ -42,6 +42,7 @@ public function getAmount() { return $this->amount; } + /* * @param integer */ @@ -72,7 +73,10 @@ public function getReason() { return $this->reason; } - + + /* + * @param string + */ public function setReason($reason) { $this->reason = $reason; @@ -85,6 +89,7 @@ public function getOriginalTransactionCode() { return $this->originalTransactionCode; } + /* * @param string */ @@ -103,7 +108,7 @@ public function getCreated() /* * @param string */ - public function setCretaed($created) + public function setCreated($created) { $this->created = $created; } @@ -115,6 +120,7 @@ public function getRequestIp() { return $this->requestIp; } + /* * @param string */ diff --git a/Lib/AlternativePayments/Model/Subscription.php b/Lib/AlternativePayments/Model/Subscription.php index 16c414f..ebdb4d5 100644 --- a/Lib/AlternativePayments/Model/Subscription.php +++ b/Lib/AlternativePayments/Model/Subscription.php @@ -19,6 +19,11 @@ class Subscription extends Element * @var string */ protected $paymentId; + + /* + * @var string + */ + protected $ipAddress; /* * @return string @@ -27,6 +32,7 @@ public function getPlanId() { return $this->planId; } + /* * @param string */ @@ -42,6 +48,7 @@ public function getCustomerId() { return $this->customerId; } + /* * @param string */ @@ -57,6 +64,7 @@ public function getPaymentId() { return $this->paymentId; } + /* * @param string */ @@ -64,4 +72,20 @@ public function setPaymentId($paymentId) { $this->paymentId = $paymentId; } + + /* + * @param string + */ + public function getIPAddress() + { + return $this->ipAddress; + } + + /* + * @param string + */ + public function setIPAddress($ipAddress) + { + $this->ipAddress = $ipAddress; + } } diff --git a/Lib/AlternativePayments/Model/TokenSms.php b/Lib/AlternativePayments/Model/TokenSms.php new file mode 100644 index 0000000..668d927 --- /dev/null +++ b/Lib/AlternativePayments/Model/TokenSms.php @@ -0,0 +1,46 @@ +token; + } + + /* + * @var string + */ + public function setToken($token) + { + $this->token = $token; + } + /* + * @var string + */ + public function getPin() + { + return $this->pin; + } + /* + * @var string + */ + public function setPin($pin) + { + $this->pin = $pin; + } +} diff --git a/Lib/AlternativePayments/Model/Transaction.php b/Lib/AlternativePayments/Model/Transaction.php index 970e0f6..bf5fa5e 100644 --- a/Lib/AlternativePayments/Model/Transaction.php +++ b/Lib/AlternativePayments/Model/Transaction.php @@ -9,7 +9,13 @@ class Transaction extends Element * @var \AlternativePayments\Model\Customer */ protected $customer; - + + + /* + * @var integer + */ + protected $pin; + /* * @var \AlternativePayments\Model\Payment */ @@ -40,7 +46,7 @@ class Transaction extends Element */ protected $merchantPassThruData; - /* + /* * @var string */ protected $merchantTransactionId; @@ -125,6 +131,7 @@ public function getAmount() { return $this->amount; } + /* * @param integer */ @@ -172,6 +179,7 @@ public function getPhoneVerification() { return $this->phoneVerification; } + /* * @param \AlternativePayments\Model\PhoneVerification */ @@ -187,6 +195,7 @@ public function setMerchantPassThruData($merchantPassThruData) { $this->merchantPassThruData = $merchantPassThruData; } + /* * @return string */ @@ -195,13 +204,14 @@ public function getMerchantPassThruData() return $this->merchantPassThruData; } - /* + /* * @param string */ public function setMerchantTransactionId($merchantTransactionId) { $this->merchantTransactionId = $merchantTransactionId; } + /* * @return string */ @@ -229,7 +239,7 @@ public function getDescription() /* * @param string */ - public function setIpAddress($ipAddress) + public function setIPAddress($ipAddress) { $this->ipAddress = $ipAddress; } @@ -237,7 +247,7 @@ public function setIpAddress($ipAddress) /* * @return string */ - public function getIpAddress() + public function getIPAddress() { return $this->ipAddress; } @@ -289,6 +299,21 @@ public function setInitialTransactionId($initialTransactionId) { $this->initialTransactionId = $initialTransactionId; } - + + /* + * @param integer + */ + public function getPin() + { + return $this->pin; + } + + /* + * @return integer + */ + public function setPin($pin) + { + $this->pin = $pin; + } } diff --git a/Lib/AlternativePayments/Model/Void.php b/Lib/AlternativePayments/Model/Void.php index 2098fa9..165119f 100644 --- a/Lib/AlternativePayments/Model/Void.php +++ b/Lib/AlternativePayments/Model/Void.php @@ -48,6 +48,7 @@ public function getCurrency() { return $this->currency; } + /* * @param string */ diff --git a/Lib/AlternativePayments/PhoneVerification.php b/Lib/AlternativePayments/PhoneVerification.php new file mode 100644 index 0000000..c6dcc75 --- /dev/null +++ b/Lib/AlternativePayments/PhoneVerification.php @@ -0,0 +1,26 @@ +getAll(self::RESOURCE); + } + + public static function get($code) + { + $service = new Request; + return $service->get(self::RESOURCE, $code); + } + + public static function post($data) + { + $service = new Request; + return $service->post(self::RESOURCE, $data); + } +} diff --git a/Lib/AlternativePayments/Request.php b/Lib/AlternativePayments/Request.php index ed6775d..b90a295 100644 --- a/Lib/AlternativePayments/Request.php +++ b/Lib/AlternativePayments/Request.php @@ -8,7 +8,7 @@ use AlternativePayments\Error\InvalidParameterException; /** - * Abstract Service class inherented by all services + * Abstract Service class inherited by all services */ class Request { @@ -151,6 +151,7 @@ protected function curlRequest($ctrl, $method, $param) $curl = curl_init($url); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_POSTFIELDS, $param); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', diff --git a/Lib/AlternativePayments/TokenSms.php b/Lib/AlternativePayments/TokenSms.php new file mode 100644 index 0000000..7567242 --- /dev/null +++ b/Lib/AlternativePayments/TokenSms.php @@ -0,0 +1,26 @@ +getAll(self::RESOURCE); + } + + public static function get($code) + { + $service = new Request; + return $service->get(self::RESOURCE, $code); + } + + public static function post($data) + { + $service = new Request; + return $service->post(self::RESOURCE, $data); + } +} diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..b038207 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,7 @@ +include.path=${php.global.include.path} +php.version=PHP_70 +source.encoding=UTF-8 +src.dir=Lib +tags.asp=false +tags.short=false +web.root=. diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..242710b --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,9 @@ + + + org.netbeans.modules.php.project + + + alternativepayments + + + diff --git a/samples/customer/get.php b/samples/customer/get.php index fc840f6..29b2a00 100644 --- a/samples/customer/get.php +++ b/samples/customer/get.php @@ -1,5 +1,5 @@ @@ -24,25 +24,51 @@ - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + +
Add SEPA transaction
Create SMS PIN
Add BrazilPayBoleto transaction
Create Plan SEPA
Add BrazilPayBankTransfer transaction
Create Subscription SEPA
Add Teleingreso transaction
Create SEPA transaction
Add SafetyPay transaction
Create BrazilPayBoleto transaction
Add POLi transaction
Create BrazilPayBankTransfer transaction
Add IDEAL transaction
Create BrazilPayChargeCard transaction
Add TrustPay transaction
Create Cashu transaction
Add MisterCash transaction
Create Teleingreso transaction
Add Przelewy24 transaction
Create SafetyPay transaction
Create Sofort transaction
Create PaySafe transaction
Create AliPay transaction
Create TenPay transaction
Create UnionPay transaction
Create EPS transaction
Create Verkkopankki transaction
Create POLi transaction
Create IDEAL transaction
Create TrustPay transaction
Create BanContact transaction
Create Przelewy24 transaction
Create Qiwi transaction
Get transaction Get all transactions diff --git a/samples/payment/add.php b/samples/payment/add.php index 0a22f40..ced256d 100644 --- a/samples/payment/add.php +++ b/samples/payment/add.php @@ -3,7 +3,7 @@ $payment = new \AlternativePayments\Model\Payment(); $payment->setPaymentOption("SEPA"); $payment->setHolder("John Doe"); -$payment->setIBAN("DE7170130700813633XXXX"); +$payment->setIBAN("DE71701307008136XXXXXX"); $res = \AlternativePayments\Request :: post("Payment", $payment); var_dump($res); diff --git a/samples/phoneverification/add.php b/samples/phoneverification/add.php new file mode 100644 index 0000000..5f65ba5 --- /dev/null +++ b/samples/phoneverification/add.php @@ -0,0 +1,8 @@ +setKey("pk_live_cyelxxxxxxxxddddddddBQuFeAGDDNG"); +$phoneVerification->setPhone("++15555555555"); + +$res = \AlternativePayments\PhoneVerification:: post($phoneVerification); +var_dump($res); diff --git a/samples/phoneverification/get.php b/samples/phoneverification/get.php new file mode 100644 index 0000000..1d1a110 --- /dev/null +++ b/samples/phoneverification/get.php @@ -0,0 +1,5 @@ +setPlanId("pln_e8e9e6b"); -$subscription->setCustomerId("cus_bfa4a7b9d7e740ccb"); -$subscription->setPaymentId("pay_5aca3bf14a8e4b728"); +$subscription->setPlanId("pln_f0e8ddfxxxe"); +$subscription->setCustomerId("cus_e0b56f09fxxxx5b"); +$subscription->setPaymentId("pay_f2d95bddaxxxx5aa9"); +$subscription->setIPAddress("127.0.0.1"); $res = \AlternativePayments\Subscription :: post($subscription); var_dump($res); diff --git a/samples/transaction/create_new_plan_sepa.php b/samples/transaction/create_new_plan_sepa.php new file mode 100644 index 0000000..de76576 --- /dev/null +++ b/samples/transaction/create_new_plan_sepa.php @@ -0,0 +1,17 @@ +setName("Gold Unlimited"); +$plan->setDescription("Monthly subscription to Gold Plan - 1 year"); +$plan->setAmount("1000"); +$plan->setCurrency("EUR"); +$plan->setIntervalUnit("Month"); +$plan->setIntervalCount("1"); +$plan->setBillingCycle("12"); +$plan->setIsConversionRateFixed("true"); +$plan->setIpAddress("127.0.0.1"); +$plan->setTrialPeriod("7"); + +$res = \AlternativePayments\Plan :: post($plan); +var_dump($res); diff --git a/samples/transaction/create_new_sms_pin.php b/samples/transaction/create_new_sms_pin.php new file mode 100644 index 0000000..411cef1 --- /dev/null +++ b/samples/transaction/create_new_sms_pin.php @@ -0,0 +1,9 @@ +setKey("pk_test_7mVNfNOG0rebepqgy0VKuy6jKA8ustTm4EbbOFhq"); +$phoneVerification->setPhone("+381612453385"); + +$res = \AlternativePayments\PhoneVerification:: post($phoneVerification); +var_dump($res); diff --git a/samples/transaction/create_new_subscription_sepa.php b/samples/transaction/create_new_subscription_sepa.php new file mode 100644 index 0000000..f61db62 --- /dev/null +++ b/samples/transaction/create_new_subscription_sepa.php @@ -0,0 +1,10 @@ +setPlanId("pln_f0e8ddf8884e"); +$subscription->setCustomerId("cus_e0b56f09fd284415b"); +$subscription->setPaymentId("pay_f2d95bddaea645aa9"); +$subscription->setIPAddress("127.0.0.1"); +$res = \AlternativePayments\Subscription :: post($subscription); + +var_dump($res); diff --git a/samples/transaction/create_new_transaction_alipay.php b/samples/transaction/create_new_transaction_alipay.php new file mode 100644 index 0000000..02f3cde --- /dev/null +++ b/samples/transaction/create_new_transaction_alipay.php @@ -0,0 +1,27 @@ +setEmail("john.doe@example.com"); +$customer->setCountry("CN"); +$customer->setFirstName("John"); +$customer->setLastName("Doe"); + +$payment = new \AlternativePayments\Model\Payment(); +$payment->setPaymentOption("AliPay"); +$payment->setHolder("John Doe"); + +$transaction = new \AlternativePayments\Model\Transaction(); +$transaction->setCustomer($customer); +$transaction->setPayment($payment); +$transaction->setAmount(4500); +$transaction->setCurrency("EUR"); +$transaction->setIPAddress("127.0.0.1"); + +$redirectUrls = new AlternativePayments\Model\RedirectUrls(); +$redirectUrls->setReturnUrl("http://plugins.alternativepayments.com/message/success.html"); +$redirectUrls->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html"); +$transaction->setRedirectUrls($redirectUrls); + +$res = \AlternativePayments\Transaction :: post($transaction); + +var_dump($res); diff --git a/samples/transaction/create_new_transaction_mistercash.php b/samples/transaction/create_new_transaction_bancontact.php similarity index 93% rename from samples/transaction/create_new_transaction_mistercash.php rename to samples/transaction/create_new_transaction_bancontact.php index b3056f3..765798c 100644 --- a/samples/transaction/create_new_transaction_mistercash.php +++ b/samples/transaction/create_new_transaction_bancontact.php @@ -7,7 +7,7 @@ $customer->setLastName("Doe"); $payment = new \AlternativePayments\Model\Payment(); -$payment->setPaymentOption("MisterCash"); +$payment->setPaymentOption("Bancontact"); $payment->setHolder("John Doe"); $transaction = new \AlternativePayments\Model\Transaction(); diff --git a/samples/transaction/create_new_transaction_brazilpayboleto.php b/samples/transaction/create_new_transaction_brazilpayboleto.php index 05dcc91..b8b6261 100644 --- a/samples/transaction/create_new_transaction_brazilpayboleto.php +++ b/samples/transaction/create_new_transaction_brazilpayboleto.php @@ -10,8 +10,8 @@ $customer->setCity("Manaus"); $customer->setState("AM"); $customer->setZip("69050-240"); -$customer->setPhone("+55AA711111"); -$customer->setBirthDate("13/05/1974"); +$customer->setPhone("+5566711111"); +$customer->setBirthDate("10/10/1974"); $payment = new \AlternativePayments\Model\Payment(); $payment->setPaymentOption("BrazilPayBoleto"); diff --git a/samples/transaction/create_new_transaction_brazilpaychargecard.php b/samples/transaction/create_new_transaction_brazilpaychargecard.php new file mode 100644 index 0000000..3370583 --- /dev/null +++ b/samples/transaction/create_new_transaction_brazilpaychargecard.php @@ -0,0 +1,40 @@ +setEmail("Roberto@Doe.com"); +$customer->setCountry("BR"); +$customer->setFirstName("Roberto"); +$customer->setLastName("Doe"); +$customer->setAddress("Av Max Teixeira"); +$customer->setAddress2("1040"); +$customer->setCity("Manaus"); +$customer->setState("AM"); +$customer->setZip("69050-240"); +$customer->setPhone("+5522711111"); +$customer->setBirthDate("02/05/1974"); + +$payment = new \AlternativePayments\Model\Payment(); +$payment->setPaymentOption("BrazilPayChargeCard"); +$payment->setHolder("Roberto Doe"); +$payment->setDocumentId("924.521.873-24"); +$payment->setCreditCardNumber("4111111111111111"); +$payment->setCVV2("123"); +$payment->setExpirationMonth("12"); +$payment->setExpirationYear("2018"); +$payment->setCreditCardType("visa"); + +$transaction = new \AlternativePayments\Model\Transaction(); +$transaction->setCustomer($customer); +$transaction->setPayment($payment); +$transaction->setAmount(4500); +$transaction->setCurrency("EUR"); +$transaction->setIPAddress("127.0.0.1"); + +$redirectUrls = new AlternativePayments\Model\RedirectUrls(); +$redirectUrls->setReturnUrl("http://plugins.alternativepayments.com/message/success.html"); +$redirectUrls->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html"); +$transaction->setRedirectUrls($redirectUrls); + +$res = \AlternativePayments\Transaction :: post($transaction); + +var_dump($res); diff --git a/samples/transaction/create_new_transaction_cashu.php b/samples/transaction/create_new_transaction_cashu.php new file mode 100644 index 0000000..bbe3c89 --- /dev/null +++ b/samples/transaction/create_new_transaction_cashu.php @@ -0,0 +1,28 @@ +setEmail("john.doe@example.com"); +$customer->setCountry("EG"); +$customer->setFirstName("John"); +$customer->setLastName("Doe"); + +$payment = new \AlternativePayments\Model\Payment(); +$payment->setPaymentOption("cashu"); +$payment->setHolder("John Doe"); + +$transaction = new \AlternativePayments\Model\Transaction(); +$transaction->setCustomer($customer); +$transaction->setPayment($payment); +$transaction->setAmount(4500); +$transaction->setCurrency("EUR"); +$transaction->setIPAddress("227.100.15.72"); + +$redirectUrls = new AlternativePayments\Model\RedirectUrls(); +$redirectUrls->setReturnUrl("http://plugins.alternativepayments.com/message/success.html"); +$redirectUrls->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html"); +$transaction->setRedirectUrls($redirectUrls); + +$res = \AlternativePayments\Transaction :: post($transaction); + +var_dump($res); + diff --git a/samples/transaction/create_new_transaction_eps.php b/samples/transaction/create_new_transaction_eps.php new file mode 100644 index 0000000..139b3e0 --- /dev/null +++ b/samples/transaction/create_new_transaction_eps.php @@ -0,0 +1,29 @@ +setEmail("john.doe@example.com"); +$customer->setCountry("AT"); +$customer->setFirstName("John"); +$customer->setLastName("Doe"); + +$payment = new \AlternativePayments\Model\Payment(); +$payment->setPaymentOption("EPS"); +$payment->setBIC("TESTDETT421"); +$payment->setHolder("John Doe"); + +$transaction = new \AlternativePayments\Model\Transaction(); +$transaction->setCustomer($customer); +$transaction->setPayment($payment); +$transaction->setAmount(4500); +$transaction->setCurrency("EUR"); +$transaction->setIPAddress("227.100.15.72"); + +$redirectUrls = new AlternativePayments\Model\RedirectUrls(); +$redirectUrls->setReturnUrl("http://plugins.alternativepayments.com/message/success.html"); +$redirectUrls->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html"); +$transaction->setRedirectUrls($redirectUrls); + +$res = \AlternativePayments\Transaction :: post($transaction); + +var_dump($res); + diff --git a/samples/transaction/create_new_transaction_paysafe.php b/samples/transaction/create_new_transaction_paysafe.php new file mode 100644 index 0000000..9e1019f --- /dev/null +++ b/samples/transaction/create_new_transaction_paysafe.php @@ -0,0 +1,27 @@ +setEmail("john.doe@example.com"); +$customer->setCountry("DE"); +$customer->setFirstName("John"); +$customer->setLastName("Doe"); + +$payment = new \AlternativePayments\Model\Payment(); +$payment->setPaymentOption("PaySafe"); +$payment->setHolder("John Doe"); + +$transaction = new \AlternativePayments\Model\Transaction(); +$transaction->setCustomer($customer); +$transaction->setPayment($payment); +$transaction->setAmount(4500); +$transaction->setCurrency("EUR"); +$transaction->setIPAddress("127.0.0.1"); + +$redirectUrls = new AlternativePayments\Model\RedirectUrls(); +$redirectUrls->setReturnUrl("http://plugins.alternativepayments.com/message/success.html"); +$redirectUrls->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html"); +$transaction->setRedirectUrls($redirectUrls); + +$res = \AlternativePayments\Transaction :: post($transaction); + +var_dump($res); diff --git a/samples/transaction/create_new_transaction_qiwi.php b/samples/transaction/create_new_transaction_qiwi.php new file mode 100644 index 0000000..086be5d --- /dev/null +++ b/samples/transaction/create_new_transaction_qiwi.php @@ -0,0 +1,29 @@ +setEmail("john.doe@example.com"); +$customer->setCountry("RU"); +$customer->setFirstName("John"); +$customer->setLastName("Doe"); +$customer->setPhone("+78000005149"); + +$payment = new \AlternativePayments\Model\Payment(); +$payment->setPaymentOption("qiwi"); +$payment->setHolder("John Doe"); + +$transaction = new \AlternativePayments\Model\Transaction(); +$transaction->setCustomer($customer); +$transaction->setPayment($payment); +$transaction->setAmount(4500); +$transaction->setCurrency("EUR"); +$transaction->setIPAddress("227.100.15.72"); + +$redirectUrls = new AlternativePayments\Model\RedirectUrls(); +$redirectUrls->setReturnUrl("http://plugins.alternativepayments.com/message/success.html"); +$redirectUrls->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html"); +$transaction->setRedirectUrls($redirectUrls); + +$res = \AlternativePayments\Transaction :: post($transaction); + +var_dump($res); + diff --git a/samples/transaction/create_new_transaction_sepa.php b/samples/transaction/create_new_transaction_sepa.php index 465f06f..e1fc9e8 100644 --- a/samples/transaction/create_new_transaction_sepa.php +++ b/samples/transaction/create_new_transaction_sepa.php @@ -1,7 +1,7 @@ setEmail("john.doe@example.com"); +$customer->setEmail("john.doe@gmail.com"); $customer->setCountry("DE"); $customer->setFirstName("John"); $customer->setLastName("Doe"); @@ -9,11 +9,16 @@ $payment = new \AlternativePayments\Model\Payment(); $payment->setPaymentOption("SEPA"); $payment->setHolder("John Doe"); -$payment->setIBAN("DEST1000200030004000500"); +$payment->setIBAN("DE89370400440532013000"); + +$phoneVerification = new \AlternativePayments\Model\TokenSms(); +$phoneVerification->setToken("cac2fc997f5348f19e967d6e2cc3ec28"); +$phoneVerification->setPin("1234"); $transaction = new \AlternativePayments\Model\Transaction(); $transaction->setCustomer($customer); $transaction->setPayment($payment); +$transaction->setPhoneVerification($phoneVerification); $transaction->setAmount(4500); $transaction->setCurrency("EUR"); $transaction->setDescription("test sepa php sdk"); diff --git a/samples/transaction/create_new_transaction_sofort.php b/samples/transaction/create_new_transaction_sofort.php new file mode 100644 index 0000000..b858d8c --- /dev/null +++ b/samples/transaction/create_new_transaction_sofort.php @@ -0,0 +1,28 @@ +setEmail("john.doe@example.com"); +$customer->setCountry("AT"); +$customer->setFirstName("John"); +$customer->setLastName("Doe"); + +$payment = new \AlternativePayments\Model\Payment(); +$payment->setPaymentOption("sofortuberweisung"); +$payment->setHolder("John Doe"); + +$transaction = new \AlternativePayments\Model\Transaction(); +$transaction->setCustomer($customer); +$transaction->setPayment($payment); +$transaction->setAmount(4500); +$transaction->setCurrency("EUR"); +$transaction->setIPAddress("227.100.15.72"); + +$redirectUrls = new AlternativePayments\Model\RedirectUrls(); +$redirectUrls->setReturnUrl("http://plugins.alternativepayments.com/message/success.html"); +$redirectUrls->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html"); +$transaction->setRedirectUrls($redirectUrls); + +$res = \AlternativePayments\Transaction :: post($transaction); + +var_dump($res); + diff --git a/samples/transaction/create_new_transaction_tenpay.php b/samples/transaction/create_new_transaction_tenpay.php new file mode 100644 index 0000000..6b073e6 --- /dev/null +++ b/samples/transaction/create_new_transaction_tenpay.php @@ -0,0 +1,27 @@ +setEmail("john.doe@example.com"); +$customer->setCountry("CN"); +$customer->setFirstName("John"); +$customer->setLastName("Doe"); + +$payment = new \AlternativePayments\Model\Payment(); +$payment->setPaymentOption("TenPay"); +$payment->setHolder("John Doe"); + +$transaction = new \AlternativePayments\Model\Transaction(); +$transaction->setCustomer($customer); +$transaction->setPayment($payment); +$transaction->setAmount(4500); +$transaction->setCurrency("EUR"); +$transaction->setIPAddress("127.0.0.1"); + +$redirectUrls = new AlternativePayments\Model\RedirectUrls(); +$redirectUrls->setReturnUrl("http://plugins.alternativepayments.com/message/success.html"); +$redirectUrls->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html"); +$transaction->setRedirectUrls($redirectUrls); + +$res = \AlternativePayments\Transaction :: post($transaction); + +var_dump($res); diff --git a/samples/transaction/create_new_transaction_unionpay.php b/samples/transaction/create_new_transaction_unionpay.php new file mode 100644 index 0000000..531aed8 --- /dev/null +++ b/samples/transaction/create_new_transaction_unionpay.php @@ -0,0 +1,27 @@ +setEmail("john.doe@example.com"); +$customer->setCountry("CN"); +$customer->setFirstName("John"); +$customer->setLastName("Doe"); + +$payment = new \AlternativePayments\Model\Payment(); +$payment->setPaymentOption("UnionPay"); +$payment->setHolder("John Doe"); + +$transaction = new \AlternativePayments\Model\Transaction(); +$transaction->setCustomer($customer); +$transaction->setPayment($payment); +$transaction->setAmount(4500); +$transaction->setCurrency("EUR"); +$transaction->setIPAddress("127.0.0.1"); + +$redirectUrls = new AlternativePayments\Model\RedirectUrls(); +$redirectUrls->setReturnUrl("http://plugins.alternativepayments.com/message/success.html"); +$redirectUrls->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html"); +$transaction->setRedirectUrls($redirectUrls); + +$res = \AlternativePayments\Transaction :: post($transaction); + +var_dump($res); diff --git a/samples/transaction/create_new_transaction_verkkopankki.php b/samples/transaction/create_new_transaction_verkkopankki.php new file mode 100644 index 0000000..feaa85c --- /dev/null +++ b/samples/transaction/create_new_transaction_verkkopankki.php @@ -0,0 +1,28 @@ +setEmail("john.doe@example.com"); +$customer->setCountry("FI"); +$customer->setFirstName("John"); +$customer->setLastName("Doe"); + +$payment = new \AlternativePayments\Model\Payment(); +$payment->setPaymentOption("verkkopankki"); +$payment->setHolder("John Doe"); + +$transaction = new \AlternativePayments\Model\Transaction(); +$transaction->setCustomer($customer); +$transaction->setPayment($payment); +$transaction->setAmount(4500); +$transaction->setCurrency("EUR"); +$transaction->setIPAddress("227.100.15.72"); + +$redirectUrls = new AlternativePayments\Model\RedirectUrls(); +$redirectUrls->setReturnUrl("http://plugins.alternativepayments.com/message/success.html"); +$redirectUrls->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html"); +$transaction->setRedirectUrls($redirectUrls); + +$res = \AlternativePayments\Transaction :: post($transaction); + +var_dump($res); +