|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Omnipay\CyberSource; |
| 4 | + |
| 5 | +use Omnipay\Common\AbstractGateway; |
| 6 | +use Omnipay\CyberSource\Message\CompletePurchaseRequest; |
| 7 | +use Omnipay\CyberSource\Message\PurchaseRequest; |
| 8 | + |
| 9 | +/** |
| 10 | + * CyberSource Secure Acceptance Hosted Checkout Gateway |
| 11 | + * |
| 12 | + * @link https://www.cybersource.com/developers/getting_started/integration_methods/secure_acceptance_wm/ |
| 13 | + */ |
| 14 | +class HostedGateway extends AbstractGateway |
| 15 | +{ |
| 16 | + public function getName() |
| 17 | + { |
| 18 | + return 'CyberSource Hosted'; |
| 19 | + } |
| 20 | + |
| 21 | + public function getDefaultParameters() |
| 22 | + { |
| 23 | + return array( |
| 24 | + 'profileId' => '', |
| 25 | + 'accessKey' => '', |
| 26 | + 'secretKey' => '', |
| 27 | + 'testMode' => false, |
| 28 | + ); |
| 29 | + } |
| 30 | + |
| 31 | + /** |
| 32 | + * Get the profile ID for the merchant account |
| 33 | + * |
| 34 | + * @return string |
| 35 | + */ |
| 36 | + public function getProfileId() |
| 37 | + { |
| 38 | + return $this->getParameter('profileId'); |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * Set the profile ID for the merchant account |
| 43 | + * |
| 44 | + * @param string $value ASCII Alphanumeric + punctuation string, maximum 36 characters |
| 45 | + * |
| 46 | + * @return AbstractRequest |
| 47 | + */ |
| 48 | + public function setProfileId($value) |
| 49 | + { |
| 50 | + return $this->setParameter('profileId', $value); |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * Get the secret key for the merchant account |
| 55 | + * |
| 56 | + * @return string |
| 57 | + */ |
| 58 | + public function getSecretKey() |
| 59 | + { |
| 60 | + return $this->getParameter('secretKey'); |
| 61 | + } |
| 62 | + |
| 63 | + /** |
| 64 | + * Set the secret key for the merchant account |
| 65 | + * |
| 66 | + * @param string $value Alphanumeric string, maximum 32 characters |
| 67 | + * |
| 68 | + * @return AbstractRequest |
| 69 | + */ |
| 70 | + public function setSecretKey($value) |
| 71 | + { |
| 72 | + return $this->setParameter('secretKey', $value); |
| 73 | + } |
| 74 | + |
| 75 | + /** |
| 76 | + * Get the access key for the merchant account |
| 77 | + * |
| 78 | + * @return string |
| 79 | + */ |
| 80 | + public function getAccessKey() |
| 81 | + { |
| 82 | + return $this->getParameter('accessKey'); |
| 83 | + } |
| 84 | + |
| 85 | + /** |
| 86 | + * Set the access key for the merchant account |
| 87 | + * |
| 88 | + * @param string $value Alphanumeric string, maximum 32 characters |
| 89 | + * |
| 90 | + * @return AbstractRequest |
| 91 | + */ |
| 92 | + public function setAccessKey($value) |
| 93 | + { |
| 94 | + return $this->setParameter('accessKey', $value); |
| 95 | + } |
| 96 | + |
| 97 | + /** |
| 98 | + * Redirect the customer to CyberSource to make a purchase |
| 99 | + * |
| 100 | + * @param array $parameters |
| 101 | + * |
| 102 | + * @return \Omnipay\Common\Message\AbstractRequest |
| 103 | + */ |
| 104 | + public function purchase(array $parameters = array()) |
| 105 | + { |
| 106 | + return $this->createRequest('\Omnipay\CyberSource\Message\PurchaseRequest', $parameters); |
| 107 | + } |
| 108 | + |
| 109 | + /** |
| 110 | + * Complete a purchase process |
| 111 | + * |
| 112 | + * @param array $parameters |
| 113 | + * |
| 114 | + * @return \Omnipay\Common\Message\AbstractRequest |
| 115 | + */ |
| 116 | + public function completePurchase(array $parameters = array()) |
| 117 | + { |
| 118 | + return $this->createRequest('\Omnipay\CyberSource\Message\CompletePurchaseRequest', $parameters); |
| 119 | + } |
| 120 | +} |
0 commit comments