Code Monkey home page Code Monkey logo

smsapi-php-client's People

Contributors

bujnos avatar crashuxx avatar evangellion avatar jlabno avatar kyryl-bogach avatar lozynskiadam avatar maciejlew avatar marcin-zadworny avatar mdrost avatar rollenes avatar smsapi avatar snapshotpl avatar sudlik avatar waclawjacek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smsapi-php-client's Issues

gh-pages

I would like to discuss here how do we want to document this lib

DateTime::__construct() expects parameter 1 to be string, null given

DateTime::__construct() expects parameter 1 to be string, null given

inside \Smsapi\Client\Feature\Sms\Sendernames\Data\SendernameFactory:18

When $object->created_at is null, an exception is thrown.

I'm actually using this package as a part of Magento integration module.

An easy fix is to check if created_at is not empty before using it as argument for DateTime object. I can make PR if you want to fix it that way and not by implementing changes inside Magento integration extension.

Release branch

I have some changes that I would like to merge, but those changes will break some interfaces. So those changes should be included in another version. In order to share and develop, release branch is required.
Can you create this branch?

Problem with findContact by SMS API

Hello

I have a searching phone number like this:

/**
 * @param string $phone
 * @return array
 */
public function findByPhone(string $phone): array
{
    $params = new FindContactsBag();
    $params->phoneNumber = $phone;

    return $this->getService()->contactsFeature()->findContacts($params);
}

And sometimes this code return error

Argument 2 passed to Smsapi\Client\Feature\Contacts\Data\ContactCustomFieldFactory::create() must be of the type string, int given, called in ...../vendor/smsapi/php-client/src/Feature/Contacts/Data/ContactFactory.php on line 66

Have no idea how to set encoding to UTF-8

Currently i tried to send a sms message with UTF-8 characters in polish language. Sms is being sended correctly but it has bushes instead of proper utf-8 characters. There is no place in this library documentation describing how to set it and i am feeling like the only one who is using this API. No one encounter this problem at this version??

Vesioning policy

I had some troubles time ago when my application died after I upgraded smsapi-php-client.
I had to give composer straight version. Reason was that public interface changed.
I would recommend to establish versioning policy.

Readme in english

For those who do not speak polish it is hard to understand what is README.md.

Phonebook - ContactGet and ContactResponse - missing concept

ContactGet::uri() is factory method. Calling withGroups() method changes state of ContactGet object. So we have Painfull Side Effect here.

What is purpose of throwing exception in ContactResponse::getGroups method?

  1. whitGroups method is always called in uri() method so:
    • whitGroups method is private so it cannot be called by programmer
    • exception messege is invalid
    • we never got exception here
  2. ContactResponse Objects should never throw exception. IMO.

Useless method stub

I found something like this:

    $proxy->expects($this->any())
        ->method('execute')
        ->will($this->returnValue('{}'));

in ContactAddTest, ContactEditTest, and ContactGetTest in setUp, merged in #18, and #19.

As those tests do not call execute() method I found this stub useless at the moment.

[RFC] Replace Guzzle with HTTPlug

Hi.
What do you think about replacing explicit Guzzle dependency with HTTPlug?

HTTPlug is an http client abstraction meant especially for libraries, to avoid binding to specific implementation so teams using your library can choose their favorite implementation without risk of getting version conflicts.
So it makes life easier.

I can prepare a PR, but wanted to ask first.

Problem z instalacja

przy instalacji przez composer na symfony2 dostaje

composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for webit/smsapi-bundle dev-master -> satisfiable by webit/smsapi-bundle[dev-master].
- webit/smsapi-bundle dev-master requires webit/smsapi dev-master -> no matching package found.

Potential causes:

Read http://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

Custom Contact fields cannot be set.

As long as I can define new - custom fields for Contact from Smsapi's back office - I should be able to set those via Api. Magic getter/setter should be implemented.

Mfa verification error when code validity period has expired

$mfaBag = new VerificationMfaBag($code, $phoneNumber); // expired code

$mfaResponse = (new SmsapiHttpClient())
  ->smsapiPlService($apiToken)
  ->mfaFeature()
  ->verifyMfa($mfaBag);

output:

2024-01-03 11:01:03 [83.16.11.142][173][34e4df4529f07064a3755c27facf89c1][error][TypeError] TypeError: Smsapi\Client\Infrastructure\ResponseMapper\JsonDecode::decode(): Return value must be of type stdClass, array returned in /vendor/smsapi/php-client/src/Infrastructure/ResponseMapper/JsonDecode.php:28
Stack trace:
#0 /vendor/smsapi/php-client/src/Infrastructure/ResponseMapper/RestResponseMapper.php(44): Smsapi\Client\Infrastructure\ResponseMapper\JsonDecode->decode('[]')
#1 /vendor/smsapi/php-client/src/Infrastructure/RequestExecutor/RestRequestExecutor.php(80): Smsapi\Client\Infrastructure\ResponseMapper\RestResponseMapper->map(Object(GuzzleHttp\Psr7\Response))
#2 /vendor/smsapi/php-client/src/Infrastructure/RequestExecutor/RestRequestExecutor.php(45): Smsapi\Client\Infrastructure\RequestExecutor\RestRequestExecutor->sendRequestAndMapResponse(Object(Smsapi\Client\Infrastructure\Request))
#3 /vendor/smsapi/php-client/src/Feature/Mfa/MfaHttpFeature.php(42): Smsapi\Client\Infrastructure\RequestExecutor\RestRequestExecutor->create('mfa/codes/verif...', Array)

Prepare contibure.md

It would be nice to clearly specify how do we want to collaborate on this project.
So I would recommend to prepare some contribution rules.
This document should contain:

  • branching flow
  • codding standards
  • testing approach
  • rules how do we merge PR`s

SMSApi\Proxy\Http\Native::doSocket is never used

I foun that private method SMSApi\Proxy\Http\Native::doSocket cannot be called unless $connGateway is set to SMSApi\Proxy\Http\Native::CONNECT_SOCKET. But private $connGateway property cannot be changed, so doSocket is never called.

Scope of Proxy Interface

I found that Proxy/Uri is used in each action. To create an action you have to pass Proxy Object to Action`s constructor.
When Action::execute() is called proxy is calling Action::uri() to create Proxy/Uri Object. Than proxy uses Uri object to create request to the webservice. So in fact Action knows how its gona be executed.
Action Object should not know nothing about Proxy nor Proxy/Uri nor about anything that is outside Api/Action namespace. Action should be simple container that holds only request parameters.

I`ve prepared some implementaion that partly removes Action knowelege about Proxy namespace.
https://github.com/rollenes/smsapi-php-client/tree/issue/proxy-scope
Please make some code review there, and let me know if I am heading in right direction.

I cannot make pull request because my changes breaks interface. And release branch is required.
See #30.

How to set encoding in smsApi.pl client?

Hi,
In previous version (1.8) It was possible to set custom encoding via setEncoding().
In 2.0 via SendSmsBag there is no such function. I have problem with Polish characters. I saw only encoding property in SendSmsBag class. What can I do ?

Authorization failed

i tried with token and password login - its not working i always get Authorization failed error;

then i tried with the curl version: https://www.smsapi.com/rest
that one is working like it should - couldn't trace the bug any further cause i actually didn't find the error in that package - so i guess its the answer form the server i'm talking to (also tried api2)

Delete Vms action does not remove multiple Vms`es

I want to remove multiple vmses in one request. It is not possible when using SMSApi\Api\Action\Vms::filterByIds method, but it seams to be dedicated for this purpose.
The problem is with sch_del parameter separator. It is pipe "|" in actual implementation. It seems like API does not support pipe.
It works with coma ",' as a separator.

Fix in #7 pull request.

Sending SMS triggers E_USER_DEPRECATED

Calling SmsHttpFeature->sendSms(...) triggers following deprecation error:

E_USER_DEPRECATED: The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.

It comes from \GuzzleHttp\Psr7\Uri. I think changing SmsHttpFeature::makeRequest to use /sms.do instead of sms.do will fix it.

Tested version: 3.0.2 on PHP 7.4. SMSAPI library automatically installed guzzlehttp/psr7 in version 1.7.0.

Add support for getMessageStatus()

Hi,
is there any way to manually retrieve SMS status info using its msgId? Unfortunately, the Callback Reports option is not suitable for me, because if the server is unavailable, I have no information about the status of messages that received such a Callback Report.

Tests for ProxyCurl

Integration tests are executed only with ProxyNative.
In project there is another Proxy - ProxyCurl, and those tests should be run with CurlProxy.

Make prepareRequestHttpClient() is cutting port number from uri passed in smsapiPlServiceWithUri()

Hi,

I was trying to pass uri in smsapiPlServiceWithUri() method, and my uri contained port number. I saw that the messages was sent with default port 80. After some digging I saw that prepareRequestHttpClient is just not picking it from uri.

I have already figured it out and this is really small change.
Or perhaps this is not possible due to backward compatibility or some security related stuff?

TypeError exception

A couple days ago our sentry logged the following exception:

TypeError

Return value of Smsapi\Client\Infrastructure\ResponseMapper\ApiErrorException::getError() must be of the type string, null returned

The code that produced this exception:

try {
    $sms = SendSmsBag::withMessage($params['phone'], $params['message']);
    $sms->from = $params['sender'];

    $response = $this->smsapiPlService->smsFeature()->sendSms($sms);
    $return = $response->status;
} catch (ApiErrorException $e) {
    return $e->getError();
}

What can we do to avoid this situation in the future? Isn't this a bug in your library?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.