-
Notifications
You must be signed in to change notification settings - Fork 14
[CC-2672] add WERO #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CC-2672] add WERO #216
Changes from all commits
8958783
654c8e3
40715b0
3905f3e
a14a78b
cfe962c
277d2cb
e6219ac
0049af0
2c26e4d
6a54c01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <?php | ||
|
|
||
| namespace UnzerSDK\Constants; | ||
|
|
||
| /** | ||
| * Allowed amount payment type values for Wero event-dependent payment. | ||
| */ | ||
| class WeroAmountPaymentTypes | ||
| { | ||
| public const PAY = 'PAY'; | ||
| public const PAYUPTO = 'PAYUPTO'; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <?php | ||
|
|
||
| namespace UnzerSDK\Constants; | ||
|
|
||
| /** | ||
| * Allowed capture trigger values for Wero event dependent payment. | ||
| */ | ||
| class WeroCaptureTriggers | ||
| { | ||
| public const SHIPPING = 'SHIPPING'; | ||
| public const DELIVERY = 'DELIVERY'; | ||
| public const AVAILABILITY = 'AVAILABILITY'; | ||
| public const SERVICEFULFILMENT = 'SERVICEFULFILMENT'; | ||
| public const OTHER = 'OTHER'; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| <?php | ||
|
|
||
| namespace UnzerSDK\Resources\EmbeddedResources; | ||
|
|
||
| use UnzerSDK\Constants\WeroAmountPaymentTypes; | ||
| use UnzerSDK\Constants\WeroCaptureTriggers; | ||
| use UnzerSDK\Resources\AbstractUnzerResource; | ||
|
|
||
| /** | ||
| * Represents the `eventDependentPayment` object for Wero additional transaction data. | ||
| */ | ||
| class WeroEventDependentPayment extends AbstractUnzerResource | ||
| { | ||
| /** @see WeroCaptureTriggers */ | ||
| protected ?string $captureTrigger = null; | ||
| /** @see WeroAmountPaymentTypes */ | ||
| protected ?string $amountPaymentType = null; | ||
| protected ?int $maxAuthToCaptureTime = null; | ||
| protected ?bool $multiCapturesAllowed = null; | ||
|
|
||
| public function getCaptureTrigger(): ?string | ||
| { | ||
| return $this->captureTrigger; | ||
| } | ||
|
|
||
| /** | ||
| * @see WeroCaptureTriggers for allowed values | ||
| */ | ||
| public function setCaptureTrigger(?string $captureTrigger): WeroEventDependentPayment | ||
| { | ||
| $this->captureTrigger = $captureTrigger; | ||
| return $this; | ||
| } | ||
|
|
||
| public function getAmountPaymentType(): ?string | ||
| { | ||
| return $this->amountPaymentType; | ||
| } | ||
|
|
||
| /** | ||
| * @see WeroAmountPaymentTypes for allowed values | ||
| */ | ||
| public function setAmountPaymentType(?string $amountPaymentType): WeroEventDependentPayment | ||
| { | ||
| $this->amountPaymentType = $amountPaymentType; | ||
| return $this; | ||
| } | ||
|
|
||
| public function getMaxAuthToCaptureTime(): ?int | ||
| { | ||
| return $this->maxAuthToCaptureTime; | ||
| } | ||
|
|
||
| public function setMaxAuthToCaptureTime(?int $maxAuthToCaptureTime): WeroEventDependentPayment | ||
| { | ||
| $this->maxAuthToCaptureTime = $maxAuthToCaptureTime; | ||
| return $this; | ||
| } | ||
|
|
||
| public function getMultiCapturesAllowed(): ?bool | ||
| { | ||
| return $this->multiCapturesAllowed; | ||
| } | ||
|
|
||
| public function setMultiCapturesAllowed(?bool $multiCapturesAllowed): WeroEventDependentPayment | ||
| { | ||
| $this->multiCapturesAllowed = $multiCapturesAllowed; | ||
| return $this; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,48 @@ | ||||||
| <?php | ||||||
|
|
||||||
| namespace UnzerSDK\Resources\EmbeddedResources; | ||||||
|
|
||||||
| use stdClass; | ||||||
| use UnzerSDK\Adapter\HttpAdapterInterface; | ||||||
| use UnzerSDK\Resources\AbstractUnzerResource; | ||||||
|
|
||||||
| /* | ||||||
|
||||||
| /* | |
| /** |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <?php | ||
|
|
||
| namespace UnzerSDK\Resources\PaymentTypes; | ||
|
|
||
| class Wero extends BasePaymentType | ||
| { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,18 +13,18 @@ | |
| namespace UnzerSDK\test\integration\PaymentTypes; | ||
|
|
||
| use UnzerSDK\Constants\CustomerTypes; | ||
| use UnzerSDK\Constants\ShippingTypes; | ||
| use UnzerSDK\Exceptions\UnzerApiException; | ||
| use UnzerSDK\Resources\Customer; | ||
| use UnzerSDK\Resources\CustomerFactory; | ||
| use UnzerSDK\Resources\EmbeddedResources\Address; | ||
| use UnzerSDK\Resources\EmbeddedResources\Paylater\InstallmentPlansQuery; | ||
| use UnzerSDK\Resources\EmbeddedResources\Paylater\InstallmentPlan; | ||
| use UnzerSDK\Resources\EmbeddedResources\Paylater\InstallmentPlansQuery; | ||
|
Comment on lines
15
to
+22
|
||
| use UnzerSDK\Resources\PaymentTypes\PaylaterInstallment; | ||
| use UnzerSDK\Resources\TransactionTypes\Authorization; | ||
| use UnzerSDK\Resources\TransactionTypes\Cancellation; | ||
| use UnzerSDK\Resources\TransactionTypes\Charge; | ||
| use UnzerSDK\test\BaseIntegrationTest; | ||
|
|
||
| use function count; | ||
|
|
||
| class PaylaterInstallmentTest extends BaseIntegrationTest | ||
|
|
@@ -232,7 +232,7 @@ protected function createAuthorizeTransaction(): Authorization | |
| $ins = new PaylaterInstallment($plans->getId(), $selectedPlan->getNumberOfRates(), 'DE89370400440532013000', 'DE', 'Peter Mustermann'); | ||
| $this->unzer->createPaymentType($ins); | ||
|
|
||
| $customer = $this->getCustomer()->setFirstname('Peter')->setLastname('Mustermann'); | ||
| $customer = $this->getCustomer(); | ||
| $basket = $this->createBasket(); | ||
|
|
||
| $authorization = new Authorization(99.99, 'EUR', self::RETURN_URL); | ||
|
|
@@ -244,17 +244,22 @@ protected function createAuthorizeTransaction(): Authorization | |
| */ | ||
| public function getCustomer(): Customer | ||
| { | ||
| $customer = CustomerFactory::createCustomer('Manuel', 'Weißmann'); | ||
| $customer = CustomerFactory::createCustomer('Maximilian', 'Mustermann'); | ||
| $address = (new Address()) | ||
| ->setStreet('Hugo-Junckers-Straße 3') | ||
| ->setName('Maximilian Mustermann') | ||
| ->setStreet('Hugo-Junkers-Str. 3') | ||
| ->setState('DE-BO') | ||
| ->setZip('60386') | ||
| ->setCity('Frankfurt am Main') | ||
| ->setCountry('DE'); | ||
| $customer | ||
| ->setSalutation('mr') | ||
| ->setBillingAddress($address) | ||
| ->setBirthDate('2000-12-12') | ||
| ->setEmail('manuel-weissmann@unzer.com'); | ||
| ->setCustomerId('c' . substr(self::generateRandomId(), 0, 7)) | ||
| ->setShippingAddress((clone $address)->setShippingType(ShippingTypes::EQUALS_BILLING)) | ||
| ->setLanguage('de') | ||
| ->setBirthDate('1974-10-02') | ||
| ->setEmail('accept@unzer.com'); | ||
|
|
||
| return $customer; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it maybe make sense to set some default values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not for now. If we have default values we want to use, i can update that later