Skip to content

Commit

Permalink
add bizum payment method for direct payments
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyn committed Feb 2, 2023
1 parent 59536c5 commit 503e5c8
Show file tree
Hide file tree
Showing 67 changed files with 4,418 additions and 0 deletions.
1,406 changes: 1,406 additions & 0 deletions src/App/ApiClient.php

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions src/App/ApiClientFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);

namespace App;

use Articus\DataTransfer as DT;
use Interop\Container\ContainerInterface;
use OpenAPIGenerator\APIClient as OAGAC;

class ApiClientFactory extends DT\ConfigAwareFactory
{
public function __construct(string $configKey = ApiClient::class)
{
parent::__construct($configKey);
}

public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$config = new OAGAC\ApiClientOptions(\array_merge($this->getServiceConfig($container), $options ?? []));
return new ApiClient(
$config->serverUrl,
$container->get($config->dataTransferServiceName),
$container->get($config->requestFactoryServiceName),
$container->get($config->httpClientServiceName),
$container->get($config->securityProviderFactoryServiceName),
$container->get($config->bodyCoderFactoryServiceName),
$container->get($config->bodyCoderFactoryServiceName)
);
}
}
68 changes: 68 additions & 0 deletions src/App/DTO/ActivateSubscriptionRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
declare(strict_types=1);

namespace App\DTO;

use Articus\DataTransfer\Annotation as DTA;

/**
*/
class ActivateSubscriptionRequest
{
/**
* A payment token generated by monei.js [Components](https://docs.monei.com/docs/monei-js-overview) or a paymentToken [saved after a previous successful payment](https://docs.monei.com/docs/save-payment-method). In case of the first one, you will also need to send the &#x60;sessionId&#x60; used to generate the token in the first place.
* @DTA\Data(field="paymentToken", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $payment_token;

/**
* A unique identifier within your system that adds security to the payment process. You need to pass the same session ID as the one used on the frontend to initialize MONEI Component (if you needed to). This is required if a payment token (not permanent) was already generated in the frontend.
* @DTA\Data(field="sessionId", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $session_id;

/**
* The amount to be added to the subscription&#39;s initial payment. A positive integer representing how much to charge in the smallest currency unit (e.g., 100 cents to charge 1.00 USD).
* @DTA\Data(field="addAmount", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"int"})
* @var int|null
*/
public $add_amount;

/**
* A permanent identifier that refers to the initial payment of a sequence of payments. This value needs to be sent in the path for &#x60;RECURRING&#x60; payments.
* @DTA\Data(field="sequenceId", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $sequence_id;

/**
* The URL the customer will be directed to after transaction completed (successful or failed - except if &#x60;failUrl&#x60; is provided).
* @DTA\Data(field="completeUrl", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $complete_url;

/**
* The URL the customer will be directed to after transaction has failed, instead of &#x60;completeUrl&#x60; (used in hosted payment page). This allows to provide two different URLs for successful and failed payments.
* @DTA\Data(field="failUrl", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $fail_url;

/**
* The URL the customer will be directed to if they decide to cancel payment and return to your website (used in hosted payment page).
* @DTA\Data(field="cancelUrl", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $cancel_url;

}
60 changes: 60 additions & 0 deletions src/App/DTO/Address.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
declare(strict_types=1);

namespace App\DTO;

use Articus\DataTransfer\Annotation as DTA;

/**
*/
class Address
{
/**
* Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
* @DTA\Data(field="country", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $country;

/**
* City, district, suburb, town, or village.
* @DTA\Data(field="city", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $city;

/**
* Address line 1 (e.g., street, PO Box, or company name).
* @DTA\Data(field="line1", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $line1;

/**
* Address line 2 (e.g., apartment, suite, unit, or building).
* @DTA\Data(field="line2", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $line2;

/**
* ZIP or postal code.
* @DTA\Data(field="zip", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $zip;

/**
* State, county, province, or region.
* @DTA\Data(field="state", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $state;

}
20 changes: 20 additions & 0 deletions src/App/DTO/CancelPaymentRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);

namespace App\DTO;

use Articus\DataTransfer\Annotation as DTA;

/**
*/
class CancelPaymentRequest
{
/**
* @DTA\Data(field="cancellationReason", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\PaymentCancellationReason::class})
* @DTA\Validator(name="TypeCompliant", options={"type":\App\DTO\PaymentCancellationReason::class})
* @var \App\DTO\PaymentCancellationReason|null
*/
public $cancellation_reason;

}
20 changes: 20 additions & 0 deletions src/App/DTO/CancelSubscriptionRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);

namespace App\DTO;

use Articus\DataTransfer\Annotation as DTA;

/**
*/
class CancelSubscriptionRequest
{
/**
* If true, the subscription will be canceled at the end of the current period.
* @DTA\Data(field="cancelAtPeriodEnd", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"bool"})
* @var bool|null
*/
public $cancel_at_period_end;

}
20 changes: 20 additions & 0 deletions src/App/DTO/CapturePaymentRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);

namespace App\DTO;

use Articus\DataTransfer\Annotation as DTA;

/**
*/
class CapturePaymentRequest
{
/**
* The amount to capture, which must be less than or equal to the original amount. Any additional amount will be automatically refunded.
* @DTA\Data(field="amount", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"int"})
* @var int|null
*/
public $amount;

}
16 changes: 16 additions & 0 deletions src/App/DTO/Collection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
declare(strict_types=1);

namespace App\DTO;

use Articus\DataTransfer\Annotation as DTA;

/**
* @DTA\Strategy(name="ScalarList", options={"type":"string"})
* @DTA\Validator(name="Collection", options={"validators":{
* {"name":"Scalar", "options":{"type":"string"}}
* }})
*/
class Collection extends \ArrayObject
{
}
60 changes: 60 additions & 0 deletions src/App/DTO/ConfirmPaymentRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
declare(strict_types=1);

namespace App\DTO;

use Articus\DataTransfer\Annotation as DTA;

/**
*/
class ConfirmPaymentRequest
{
/**
* A payment token generated by monei.js [Components](https://docs.monei.com/docs/monei-js-overview) or a paymentToken [saved after a previous successful payment](https://docs.monei.com/docs/save-payment-method).
* @DTA\Data(field="paymentToken")
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $payment_token;

/**
* @DTA\Data(field="paymentMethod", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\ConfirmPaymentRequestPaymentMethod::class})
* @DTA\Validator(name="TypeCompliant", options={"type":\App\DTO\ConfirmPaymentRequestPaymentMethod::class})
* @var \App\DTO\ConfirmPaymentRequestPaymentMethod|null
*/
public $payment_method;

/**
* If set to true a permanent token that represents a payment method used in the payment will be generated.
* @DTA\Data(field="generatePaymentToken", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"bool"})
* @var bool|null
*/
public $generate_payment_token;

/**
* @DTA\Data(field="customer", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\PaymentCustomer::class})
* @DTA\Validator(name="TypeCompliant", options={"type":\App\DTO\PaymentCustomer::class})
* @var \App\DTO\PaymentCustomer|null
*/
public $customer;

/**
* @DTA\Data(field="billingDetails", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\PaymentBillingDetails::class})
* @DTA\Validator(name="TypeCompliant", options={"type":\App\DTO\PaymentBillingDetails::class})
* @var \App\DTO\PaymentBillingDetails|null
*/
public $billing_details;

/**
* @DTA\Data(field="shippingDetails", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\PaymentShippingDetails::class})
* @DTA\Validator(name="TypeCompliant", options={"type":\App\DTO\PaymentShippingDetails::class})
* @var \App\DTO\PaymentShippingDetails|null
*/
public $shipping_details;

}
21 changes: 21 additions & 0 deletions src/App/DTO/ConfirmPaymentRequestPaymentMethod.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);

namespace App\DTO;

use Articus\DataTransfer\Annotation as DTA;

/**
* Additional information about the payment method used for this payment.
*/
class ConfirmPaymentRequestPaymentMethod
{
/**
* @DTA\Data(field="card", nullable=true)
* @DTA\Strategy(name="Object", options={"type":\App\DTO\ConfirmPaymentRequestPaymentMethodCard::class})
* @DTA\Validator(name="TypeCompliant", options={"type":\App\DTO\ConfirmPaymentRequestPaymentMethodCard::class})
* @var \App\DTO\ConfirmPaymentRequestPaymentMethodCard|null
*/
public $card;

}
29 changes: 29 additions & 0 deletions src/App/DTO/ConfirmPaymentRequestPaymentMethodCard.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);

namespace App\DTO;

use Articus\DataTransfer\Annotation as DTA;

/**
* Additional information about the card used for this payment.
*/
class ConfirmPaymentRequestPaymentMethodCard
{
/**
* The cardholder&#39;s name, as stated in the credit card.
* @DTA\Data(field="cardholderName", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $cardholder_name;

/**
* The cardholder&#39;s email address.
* @DTA\Data(field="cardholderEmail", nullable=true)
* @DTA\Validator(name="Scalar", options={"type":"string"})
* @var string|null
*/
public $cardholder_email;

}
Loading

0 comments on commit 503e5c8

Please sign in to comment.